-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmylists.php
More file actions
59 lines (50 loc) · 1.39 KB
/
Copy pathmylists.php
File metadata and controls
59 lines (50 loc) · 1.39 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
<?PHP
$errormessage = "";
session_start();
if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: login.php");
}
require '../../configure.php';
$database = "lists";
$db_found = new mysqli(DB_SERVER, DB_USER, DB_PASS, $database);
if ($db_found) {
$SQL = $db_found->prepare('SELECT ID, TITLE, LIST FROM LISTS WHERE L1 = ?');
$SQL->bind_param('s', $_SESSION['user']);
$SQL->execute();
$result = $SQL->get_result();
}
else {
$errormessage = "Database Not Found";
}
?>
<html>
<head>
<title>My Lists</title>
<link rel="stylesheet" type="text/css" href="liststyle.css">
</head>
<body>
<div class="main-container">
<?PHP
while($row = mysqli_fetch_assoc($result)) {
print "<div class=\"list-container\">";
$items = explode(",", $row['LIST']);
print "<div class=\"listtitle\">" . $row['TITLE'] . "<div class=\"title\"><a href=\"editlist.php?list=" . $row['ID'] . "\">edit</a></div></div><br>";
$count = 0;
foreach($items as $item) {
($count % 2 == 0) ? print "<div class=\"listitem\">" . $item . "</div>" : print "<div class=\"mylisteven\">" . $item . "</div>";
$count++;
}
print "</div>";
}
?>
<p>
<a href="newlist.php">new list</a> <a href="logout.php">log out</a>
<p>
<?PHP
print $errormessage;
?>
</p>
</p>
</div>
</body>
</html>