-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCONT.php
64 lines (50 loc) · 1.42 KB
/
CONT.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
<?php
// Initialize message variable
include 'dbfr.php';
// If upload button is clicked ...
// Get image name
$cmd=$_POST['cmd'];
if($cmd=='register')
{
$fw=fopen("ttt.txt", "a");
fwrite($fw, print_r($_POST,true));
fwrite($fw, print_r($_FILES,true));
//echo "ok2";
$e_name=$_POST['e_name'];
$p_name=$_POST['p_name'];
$pin=$_POST['pin'];
$address=$_POST['address'];
$map=$_POST['map'];
$rate=$_POST['rate'];
$comment=$_POST['comment'];
$filename=$_FILES["image"]["name"];
$tmpname=$_FILES["image"]["tmp_name"];
$path="image/".$filename;
$mimetype=mime_content_type($tmpname);
$valid=array('image/jpeg','image/png','image/jpg','image/JPEG','image/PNG','image/JPG');
if(in_array($mimetype, $valid))
{
if(move_uploaded_file($tmpname, $path))
{
//$k=$k+1;
$query="INSERT INTO pandal (EDITOR,PANDALNAME,PINCODE,ADDRESS,MAP,IMAGE,RATING,COMMENT,VERIFY) VALUES ('$e_name','$p_name','$pin','$address','$map','$path','$rate','$comment',0)";
$query_run=mysqli_query($con,$query);
if($query_run)
{
//$t=$t+1;
echo "OK";
// header("Location:main_page.php");
// header("Location:main_page.php");
}
else
{
echo "error".$query.(mysqli_error($con));
}
}
}
else
{
echo "file is not an image";
}
}
?>