/
brands.php
134 lines (94 loc) · 2.57 KB
/
brands.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
require 'data_base_conn.php';
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Video Upload And Playback Tutorial</title>
<style type="text/css">
.galary {
color: #C0C;
}
</style>
</head>
<body>
<!--
<h3><a href="ima.php" class="galary">Show Galary</a>
</h3> -->
<form action="brands.php" method="POST" enctype="multipart/form-data">
<p>
insert new brand <input type="file" name="file" />
<label for="Title">
Ttitle
<input type="text" name="Title" id="Title">
<br>
<br>
</label>
<label for="Price">Price
<input type="text" name="Price" id="Price">
</label>
<input type="submit" name="submit" value="Upload!" />
</p>
</form>
<?php
if(isset($_POST['submit']))
{
$name = $_FILES['file']['name'];
$temp = $_FILES['file']['tmp_name'];
$ttitle =$_POST["Title"];
$pprice = $_POST["Price"];
require 'functions.php';
$fileexit = isfileexit($name,"brands");
if (!fileexit)
{
move_uploaded_file($temp,"brands/".$name);
$url = "http://localhost/brands/$name";
mysqli_query($conn,"INSERT INTO `brands` VALUE ('','$name','$url','$ttitle','$pprice')");
echo "<br />".$name." has been uploaded";
header("Location: brands.php");
unset($_POST);
}
}
$query = mysqli_query($conn,"SELECT * FROM `brands`");
echo "<table width='160' border='1' align='center'>";
while($row = mysqli_fetch_assoc($query))
{
$id = $row['id'];
$name = $row['name'];
$url = "http://localhost/brands/".$name;
echo "<tr>
<td width='152' height='150'>
<a href='products.php?id=$id'>
<img src='$url' width='150' height='150' alt='1' />
</a>
<a href='viewbrand.php?id=$id'>$name</a><br />
<a href='deletebrand.php?id=$id'>delete</a>
<a style='text-decoration:none;'> </a>
<a href='viewbrand.php?id=$id'> view</a>
</td>";
if($roww = mysqli_fetch_assoc($query)) {
$idd = $roww['id'];
$namee = $roww['name'];
$url = "http://localhost/brands/".$namee;
echo "
<td width='152' height='150'>
<a href='products.php?id=$idd'>
<img src='$url' width='150' height='150' alt='1' />
</a>
<a href='watch.php?id=$idd'>$namee</a><br />
<a href='deletebrand.php?id=$idd'>delete</a>
<a style='text-decoration:none;'> </a>
<a href='viewbrand.php?id=$idd'> view</a>
</td>";
}
echo "</tr>";
echo "<tr>
<td> </td>
<td> </td>
</tr>";
}
echo "</table>";
?>
</body>
</html>