-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoin.php
106 lines (100 loc) · 2 KB
/
join.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
<?php
ini_set('mysqli.connect_timeout',300);
ini_set('default_socket_timeout',300);
?>
<html>
<head>
<style>
body{
margin-left: 78px;
margin-right: 50px;
}
header{
background-color: #9999ff;
margin-right:10px;
height:60px;
}
footer{
padding: 1em;
color: white;
background-color: #009999;
clear: left;
text-align:center;
margin-right:10px;
}
</style>
</head>
<body>
<header>
<div>
<p style="float:right;margin-right:90px;">
<a href="download"> <button class="download"><b>Images Download</b></button></a>
</p>
</div>
<div class="branding">
<h1 style="margin-left:10px">Images Gallery</h1>
</div>
</header>
<form method="post" enctype="multipart/form-data">
<br/>
<input type="file" name="image" />
<br/><br/>
<input type="submit" name="sumit" value="Upload" />
</form>
<?php
if(isset($_POST['sumit']))
{
if(getimagesize($_FILES['image']['tmp_name'])==FALSE)
{
echo "please select an image.";
}
else
{
$image=addslashes($_FILES['image']['tmp_name']);
$name=addslashes($_FILES['image']['name']);
$image=file_get_contents($image);
$image=base64_encode($image);
saveimage($name,$image);
}
}
displayimage();
function saveimage($name,$image)
{
$servername = "localhost";
$username = "root";
$password = "";
$dbname="kstark";
$con =mysqli_connect($servername, $username, $password, $dbname);
$qry="insert into images (name,image) values('$name','$image')";
$result=mysqli_query($con,$qry);
if($result)
{
echo "<br/>image uploaded";
}
else
{
echo "<br/> image not uploaded";
}
}
function displayimage()
{
$servername = "localhost";
$username = "root";
$password = "";
$dbname="kstark";
$con =mysqli_connect($servername, $username, $password, $dbname);
$qry1="select * from images";
$result=mysqli_query($con,$qry1);
while($row = mysqli_fetch_array($result))
{
$img1='<img height="250" width="300" src="data:image;base64, '.$row[2].'"> ';
echo $img1." ";
}
mysqli_close($con);
}
?>
<div>
<br/><br/><footer>Copyright © yoursite.com</footer>
</div>
</body>
</html>