-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave.php
executable file
·43 lines (30 loc) · 1.09 KB
/
save.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
<?php
require_once('connectionvars.php');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$fullname= mysqli_real_escape_string($dbc, $_GET['fullname']);
$mb= mysqli_real_escape_string($dbc, $_GET['mb']);
$email= mysqli_real_escape_string($dbc, $_GET['email']);
$address= mysqli_real_escape_string($dbc, $_GET['address']);
$model= mysqli_real_escape_string($dbc, $_GET['model']);
$color= mysqli_real_escape_string($dbc, $_GET['color']);
$storage= mysqli_real_escape_string($dbc, $_GET['storage']);
$nowdate = date("Y-m-d H:i:s");
if(empty($fullname) || empty($mb))
{
header('Location: index.php');
exit;
}
//Connect and Log transaction on local db
try
{
$id = "0"; $empty = ""; $zero = "0";
$stmt = $dbc->prepare("INSERT INTO iphone6reg VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("issssssss", $id, $nowdate, $fullname, $mb, $email, $address, $model, $color, $storage);
$stmt->execute();
echo "successfully registered";
}
catch(Exception $e)
{
echo "oops, error";
}
?>