-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadd_guide.php
More file actions
52 lines (39 loc) · 854 Bytes
/
add_guide.php
File metadata and controls
52 lines (39 loc) · 854 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
42
43
44
45
46
47
48
49
50
51
52
<?php
print_r($_POST);
include 'db.php';
/*
Array
(
[city] => Ahmedabad
[name] => Yash
[languages] => Hindi,English
[exp] => 6
[id] => 100
)
*/
extract($_POST);
$sql = "INSERT INTO `guide` (`id`, `name`, `city`, `experience`, `rating`)
VALUES ('{$id}', '{$name}', '{$city}', '{$exp}', '0');";
file_put_contents("png/face_". $id . ".png", base64_decode($png));
file_put_contents("npy/face_". $id . ".npy", base64_decode($npy));
$l = explode(",", $languages);
$res = mysqli_query($link, $sql);
if($res)
{
foreach($l as $a)
{
$ss = "INSERT INTO `lang` (`guide_id`, `lang`)
VALUES ('{$id}', '{$a}');";
$result = mysqli_query($link, $ss);
if(!$result)
{
echo "0";
exit();
}
}
echo "1";
}
else
{
echo "0";
}