-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
42 lines (38 loc) · 940 Bytes
/
index.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
<?php
//include auth.php file on all secure pages
include("auth.php");
require("db.php");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome Home</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="form">
<p>Welcome <?php echo $_SESSION['username']; ?>!</p>
<p>This is secure area.</p>
<p><a href="dashboard.php">Dashboard</a></p>
<a href="logout.php">Logout</a>
</div>
<?php
// Check connection
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $con->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["Product_ID"]. " - Product: " . $row["Product"]. " - Price: " . $row["Price"]. ",-" , "<br>";
}
} else {
echo "0 results";
}
$con->close();
?>
</body>
</html>