Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
97 lines (93 loc) · 2.96 KB
/
Copy pathindex.php
File metadata and controls
97 lines (93 loc) · 2.96 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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = 'movies';
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<?php
$is_logged = 0;
$conn = mysqli_connect("localhost", "root", "", "movies");
if($conn === false){
die("ERROR: Could not connect. "
. mysqli_connect_error());
}
$sql = "SELECT * FROM `userloginstatus`";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
if($row["username"]){
$currentuser = $row["username"];
$is_logged = 1;
break;
}
}
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>BruhMilk Tea</title>
<meta charset="utf-8">
<link rel="stylesheet" href="stylesheet.css">
<link rel="stylesheet" href="./header_login/button.css">
<script type="text/javascript" src="./header_login/button.js"></script>
</head>
<body>
<div id="wrapper">
<header>
<a href="index.php">
<img src="images/logo.png" alt="logo?" target="_blank" width="100%"
title="JavaJam" alt="JavaJam"/>
</a>
<nav>
<a href="index.php">Home</a>
<?php
if($is_logged == 1){
echo "<a href='cart_page/cart.php'>Cart</a>";
}
?>
<a href="aboutus_page/aboutus.php">About Us</a>
<?php
if($is_logged == 1) {
echo "<div class=\"dropdown\">
<button onclick=\"myFunction()\" class=\"dropbtn\">{$currentuser}</button>
<div id=\"myDropdown\" class=\"dropdown-content\">
<a href=\"./header_login/log_out.php\">Log Out</a>
</div></div>";
} else {
echo "<a href=\"login_page/login_page.php\">Log In</a>";
}
?>
</nav>
</header>
<div class="content">
<h2>Movie List</h2>
<?php
$sql = "SELECT * FROM `movielist`";
$result = $conn->query($sql);
$array= array();
while($row = $result->fetch_assoc()) {
array_push($array,$row["moviename"]);
}
for ($i = 0; $i <= count($array)-1; $i++) {
echo "<div class='movie'>";
echo "<form id='formName' name='formName' method='post' action='movie_page/movie_page.php'>";
echo "<input type='hidden' value='$array[$i]' name='movie'>";
echo "<input type='image' style='width: 100%;' name='submit' src='images/$array[$i].png' alt='$array[$i]' alt='Submit'/>";
echo "<p>$array[$i]</p>";
echo "</form>";
echo "</div>";
}
?>
</div>
<footer>
<small><i>Copyright © 2022 Movie Place</i></small> <br>
<a href="mailto:Jeremy@Chua.com"><small><i>Bruh@CMilk.com</i></small></a>
</footer>
</div>
</body>
</html>