-
Notifications
You must be signed in to change notification settings - Fork 2
/
wp_cardio.php
93 lines (82 loc) · 2.5 KB
/
wp_cardio.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE HTML>
<html>
<head>
<title>LivFit - Workout Planner</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="shortcut icon" href="images/ui/favicon.ico">
</head>
<body>
<?php include ("header.php"); ?>
<?php include ("nav.php"); ?>
<h1>Today's Workout</h1>
<?php
include("db.php");
$conn = mysql_connect($servername, $username, $password);
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
$db=mysql_select_db($dbname, $conn);
// Echo dummy text
for($i = 0; $i<4096; $i++)
{
echo "<!-- you can't see this -->";
}
// Find user difficulty
$sq = "SELECT difficulty FROM users WHERE username='".$_SESSION['current_user']."';";
$result = mysql_query($sq);
while($row=mysql_fetch_array($result))
{
$udiff=$row[0];
}
// Find user week
$sq = "SELECT week FROM users WHERE username='".$_SESSION['current_user']."';";
$result = mysql_query($sq);
while($row=mysql_fetch_array($result))
{
$week=$row[0];
}
// Print workout table
echo "<table class='feedback_table'>
<tr>
<th>Name</th>
<th>Reps</th>
<th>Sets</th>
<th>Difficulty</th> ";
echo "</tr>";
$sql="SELECT Exercise,Reps,Sets,Difficulty FROM workouts WHERE Muscle='Cardio' and Difficulty<= ".$udiff.";";
$run=mysql_query($sql);
while($row=mysql_fetch_array($run))
{
echo "<tr>";
$name = $row[0];
echo "<td>".$name."</td>";
$reps = $row[1] + ($row[3]-1)*5;
echo "<td>".$reps."</td>";
$sets = $row[2] + ($week - 1);
echo "<td>".$sets."</td>";
$diff = $row[3];
echo "<td>".$diff."</td>";
echo "</tr>";
}
echo "</table>";
?>
<div id=content>
<div id=seldif>
<form class=formwhite>
<br>Your current Level
<input type=text class=bmioutput value="<?php echo $diff?>" readonly>
</form>
</div>
<!--form id=day name=day class=formwhite method="post" action="fetchdata.php">
<input type=text class=bmioutput value="<?php echo $name;?>" readonly>
<input type=text class=bmioutput value="<?php echo $reps;?>" readonly>
<input type=text class=bmioutput value="<?php echo $sets;?>" readonly>
<input type=text class=bmioutput value="<?php echo $diff;?>" readonly>
</form-->
<p><b>Tip(s):</b><ul><li>Rest for around 50-70 seconds after each set.</li><li>Drink sufficient water</li></ul>
</div>
<?php include ("wp_nav.php"); ?>
<?php include ("footer.php"); ?>
</body>
</html>