-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdiet_changeplan.php
More file actions
55 lines (44 loc) · 1.21 KB
/
diet_changeplan.php
File metadata and controls
55 lines (44 loc) · 1.21 KB
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
<html>
<head>
<title>LivFit - Updating Workout</title>
<link rel="stylesheet" type="text/css" href="css/message.css">
<link rel="shortcut icon" href="images/ui/favicon.ico">
</head>
<body>
<div id=centerpoint>
<div id=dialog>
<div class=content>
<h1>Liv<font color=red>F</font>it</h1>
<br>
<?php
session_start();
if(!isset($_SESSION['sid']) || !isset($_SESSION['current_user']))
die('Error (not logged in?)');
include("db.php");
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['dietNo']))
{
$plan = $_POST['dietNo'];
$sql = "UPDATE users SET diet = ".$plan." WHERE username='".$_SESSION['current_user']."'";
if(!mysqli_query($conn, $sql))
{
die("Error in MySQL.<br>".mysqli_error());
}
echo "Thank you.<br />Now redirecting...";
// sleep(2);
echo "<script> location.href = 'diethome.php';</script>";
}
else
echo "There was an error.<br>Something isn't working right!";
mysql_close($conn);
?>
</div>
</div>
</div>
</body>
</html>