-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
78 lines (68 loc) · 2.09 KB
/
insert.php
File metadata and controls
78 lines (68 loc) · 2.09 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
<?php
session_start();
$ip="192.168.1.1";
$mac = shell_exec('arp '.$ip.' | awk \'{print $4}\'');
if(!isset($_SESSION["mac"]) && !isset($_SESSION["uname"])) {
$_SESSION["mac"] = $mac;
$_SESSION["uname"]= $uname;
}
else if($_SESSION["mac"]== $mac && $_SESSION["uname"]== $uname)
{
echo '<script type="text/javascript">
window.location = "/php/menu.php"
</script>';
}
else
{
echo '<script type="text/javascript">
window.location = "/php/index.php"
</script>';
}
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "token";
$uname = $_POST['email'];
$name = $_POST['name'];
$pass = $_POST['password'];
echo " <html>
<head>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<meta http-equiv=\"refresh\" content=\"3;url=/php/menu.php\" />
<link rel=\"stylesheet\" href=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js\"></script>
<script src=\"http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\"></script>
</head>
<body>";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("<div class=\"alert alert-danger\">
<strong>Failure: </strong>" . $conn->connect_error . "!!!</div>");
echo '<script type="text/javascript">
window.location = "/php/index.php"
</script>';
}
$sql = "INSERT INTO customers (name, email, password) VALUES ('$name', '$uname', '$pass')";
if ($conn->query($sql) === TRUE) {
echo "
<div class=\"alert alert-info\">
<strong>Info!</strong> Hello '$uname' .!!!
</div>";
echo "<div class=\"alert alert-success\">
<strong>Success!</strong> You can order your items.!!!
</div>";
} else {
echo "
<div class=\"alert alert-danger\">
<strong>Error!</strong> Error in inserting into Database.!!
</div>";
echo '<script type="text/javascript">
window.location = "/php/index.php"
</script>';
}
echo "</body>
</html>";
$conn->close();
?>