-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.php
More file actions
69 lines (59 loc) · 1.41 KB
/
entry.php
File metadata and controls
69 lines (59 loc) · 1.41 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
<?php
require_once("site_dim.php");
function new_entry($val)
{
include('db-config.php');
switch($val['type'])
{
case 'menu':
$query = "INSERT INTO `menu` VALUES ('', '".$val['url']."', '".$val['label']."')";
$result = mysqli_query($dbc, $query)
or die("Error executing query!");
break;
case 'project':
$query = "INSERT INTO `project` VALUES ('','".$val['img_url']."','".$val['label']."','".$val['title']."', '".$val['sub_title']."', '".$val['url']."')";
$result = mysqli_query($dbc, $query)
or die("Error executing query!");
break;
case 'social':
$query = "INSERT INTO `social` VALUES ('', '".$val['url']."', '".$val['label']."')";
$result = mysqli_query($dbc, $query)
or die("Error executing query!");
break;
default : $result == 'false';
echo "No such type exists!";
}
if($result)
{
echo "Added new ".$val['type']." ".$val['label']." successfully";
return true;
}
else
{
return false;
}
}
function redirect($url, $statusCode = 303)
{
header('Location: ' . $url, true, $statusCode);
die();
}
if(isset($_POST['type']))
{
$reply = new_entry($_POST);
if($reply == 'true')
{
echo "<br>Redirecting...";
sleep(2);
redirect($site_url.'/input.php');
}
else
{
echo "Error occurred. Please contact the developer!";
}
}
else
{
echo "Please veirfy the input data!";
}
?>