-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
67 lines (60 loc) · 2.14 KB
/
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
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="style/style.css" media="screen" />
<title>T-shirts Spring Index</title>
</head>
<body>
<div id="wrapper">
<?php include('includes/header.php'); ?>
<?php
session_start();
if (isset($_SESSION['username'])) {
include('includes/nav2.php');
echo "<div class='info'>";
echo "You are logged in as: ".$_SESSION['username'];
echo "<p>";
echo "<a href='logout.php'>Click here to logout</a>";
echo "</div>";
} else {
include('includes/nav.php');
echo"Please log in.";
}
?>
<div id="content">
<h1>T-shirts on sale</h1>
<?php
$connect = MYSQL_CONNECT('localhost', 'root', '') or die('Unable to connect to MySQL server');
mysql_select_db('product') or die('Unable to select database');
$favor=1;
while ($favor<=10) {
$result=mysql_query("SELECT id ,name FROM product where favor ='$favor'") or die("Can't Perform Query");
while ($row=mysql_fetch_row($result)) {
echo"<div class='img'>";
echo"<a href=\"product.php?name=$row[1]\">";
echo "<img src=\"getdata2.php?id=$row[0]\"><br>";
echo"</a>";
$name=$row[1];
echo "<a href=\"product.php?name=$row[1]\">$name</a><br>";
echo"</div>";
}
$favor++;
}
?>
</div>
<?php include('includes/sidebar.php'); ?>
<div id="content">
<p></p>
<p></p>
<h1></h1>
<a href="recent.php">recent viewed T-shirts</a>
<h1></h1>
</div> <!-- end #content -->
<?php include('includes/footer.php'); ?>
</div> <!-- End #wrapper -->
</body>
</html>