-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.php
More file actions
116 lines (67 loc) · 2.11 KB
/
Copy pathwelcome.php
File metadata and controls
116 lines (67 loc) · 2.11 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
// Initialize the session
session_start();
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome</title>
<style>
body{ font: 14px sans-serif; text-align: center; }
</style>
</head>
<body>
<h1 class="">Logged as <b><?php echo htmlspecialchars($_SESSION["username"]); ?></b></h1>
<p>
<a href="reset-password.php" class="">Reset Your Password</a>
<a href="logout.php" class="">Sign Out of Your Account</a>
</p>
<p>
<form action="welcome.php" method="post">
<input type="number" placeholder="DD" name="day">
<input type="number" placeholder="MM" name="month">
<input type="number" placeholder="YYYY" name="year">
<input type="text" placeholder="plan" name="plan">
<input type ="submit">
</form>
<calender><?php
require_once "config.php";
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$plan = $_POST['plan'];
$user = $_SESSION["username"];
$sql = "INSERT into calender(Date,Plan,User) values('$year$month$day','$plan','$user')";
if ($link->query($sql) === TRUE) {
// echo "ADDED: ".$name.", ".$age.", ".$gender;
} else {
echo "Error: ".$sql."<br>".$link->error;
}
$sql = "SELECT * FROM calender ORDER BY Date ASC";
$result = mysqli_query($link, $sql);
echo "<table border='1'>
<tr>
<th>Date</th>
<th>User</th>
<th>Plan</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['User'] . "</td>";
echo "<td>" . $row['Plan'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($link);
?>
</calender>
</p>
</body>
</html>