forked from halocrak/968hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
41 lines (34 loc) · 1013 Bytes
/
Copy pathinsert.php
File metadata and controls
41 lines (34 loc) · 1013 Bytes
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
<?php
if(isset($_POST['submit'])){
$name = htmlentities($_POST['name']);
$dec = htmlentities ($_POST['dec']);
// this is information of image
$file = $_FILES['file'];
$fileName = $file['name'];
$fileType = $file['type'];
$fileTmpName = $file['tmp_name'];
$fileError = $file['error'];
$fileSize = $file['size'];
$fileExt = explode('.' , $fileName);
$fileActualExt = strtolower(end($fileExt));
$fileAllowed = array('png' , 'jpg' , 'jpeg' , 'svg' , 'gif');
if(in_array($fileActualExt , $fileAllowed)){
if($fileError === 0){
if($fileSize < 10000000){
$fileNewName = rand().".".$fileActualExt;
$fileDestinition = "upload/$fileNewName";
move_uploaded_file($fileTmpName ,$fileDestinition);
$query = mysqli_query($db , "INSERT INTO `name`(`names`,`dec`,`photo`) VALUES('$name','$dec',$fileNewName)");
if($query){
header("location:index.php?success");
}
}else {
$errors['result'] = "photo is 1000000 mg";
}
}else {
$errors['result'] = "plese refresh website";
}
}else {
$errors['result'] = "fake photo";
}
}