This repository was archived by the owner on May 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupload.php
More file actions
executable file
·113 lines (99 loc) · 3.47 KB
/
upload.php
File metadata and controls
executable file
·113 lines (99 loc) · 3.47 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
session_start();
$id = $_SESSION['id'];
?>
<?php
if(getimagesize($_FILES['photo']['tmp_name'])==FALSE OR getimagesize($_FILES['signature']['tmp_name'])==FALSE){
echo "Failed";
}
else {
$pname= addslashes($_FILES['photo']['tmp_name']);
$pimage=base64_encode(file_get_contents(addslashes($_FILES['photo']['tmp_name'])));
$simage=base64_encode(file_get_contents(addslashes($_FILES['signature']['tmp_name'])));
saveimage($simage,$pimage,$id);
}
function saveimage($simage,$pimage,$id){
//echo '<img height="100px" width="100px" src="data:image;base64,'.$pimage.'">';
//echo '<img height="100px" width="100px" src="data:image;base64,'.$simage.'">';
$connect = mysqli_connect("localhost","root","","erp");
$command = " UPDATE Student_Record SET image = '$pimage' WHERE id =$id ";
$query = mysqli_query($connect,$command) or die(mysqli_error($connect));
$command = " UPDATE Student_Record SET signature = '$simage' WHERE id =$id ";
$query = mysqli_query($connect,$command) or die(mysqli_error($connect));
if($query){
//echo "Success";
Display($id);
}
else{
echo "Not uploaded";
}
}
function Display($id){
$connect = mysqli_connect("localhost","root","","erp");
$command = "SELECT * FROM Student_Record WHERE id=$id ";
$query = mysqli_query($connect,$command);
$rownum = mysqli_num_rows($query);
for($a=0;$a<$rownum;$a++){
$result = mysqli_fetch_array($query);
$ppicture = $result['image'];
$spicture = $result['signature'];
?>
<html>
<head>
<title>Login</title>
</head>
<body>
<center>
<fieldset>
<tr><h2><b><u>Data Recorded successfully<u><b></h2></tr>
<tr><h3>Confirm Your Submissions</h3></tr>
<table cellspacing="10">
<tr>
<td>uploaded Photo       :</td>
<td><?php echo '<img height="100px" width="100px" src="data:image;base64,'.$ppicture.'">'; ?></td>
</tr>
<tr>
<td>uploaded signature :      </td>
<td><?php echo '<img height="100px" width="100px" src="data:image;base64,'.$spicture.'">'; ?></td>
</tr>
</table>
<form action="regisForm.html">
<button name="submit" type="submit"> Final Submit </button>
</form>
</fieldset>
</center>
</body>
</html>
<?php
}
}
/*function showdetails(){
echo "Hi";
$connect = mysqli_connect("localhost","root","","erp");
$vari = RandomString(8);
$command = "INSERT INTO login (level, Password) VALUES ('Student','$vari')";
$query = mysqli_query($connect,$command) or die(mysqli_error($con));
$command = "SELECT * FROM login WHERE id=(SELECT max(id) FROM login)";
$query = mysqli_query($connect,$command) or die(mysqli_error($con));
$rownum = mysqli_num_rows($query);
for($a=0;$a<$rownum;$a++){
$result = mysqli_fetch_array($query);
$id = $result['id'];
$pas = $result['Password'];
}
?>
<html><script>
alert("Your Username is <?php echo $id ?> and password is <?php echo $pas ?> .")
</script>
</html>
<?php
}
function RandomString($length) {
$keys = array_merge(range(0,9), range('a', 'z'),range('A','Z'));
$key = "";
for($i=0; $i < $length; $i++) {
$key .= $keys[mt_rand(0, count($keys) - 1)];
}
return $key;
}*/
?>