-
Notifications
You must be signed in to change notification settings - Fork 0
/
phonecustom.php
66 lines (38 loc) · 2.25 KB
/
phonecustom.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
65
66
<?php
session_start();
$_SESSION['session'] = $_COOKIE['PHPSESSID'];
?>
<?php include 'config/database.php';?>
<?php
if($_SESSION['role']== "0") {
if(isset($_POST['addtocart'])){
$phonenametwo = filter_input(INPUT_POST, 'phonenametwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phoneimagetwo = filter_input(INPUT_POST, 'phoneimagetwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phoneidtwo = filter_input(INPUT_POST, 'phoneidtwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$useridtwo = filter_input(INPUT_POST, 'useridtwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$transactionidtwo = filter_input(INPUT_POST, 'transidtwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phonestoragetwo = filter_input(INPUT_POST, 'capacitytwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phonecolortwo = filter_input(INPUT_POST, 'colortwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$quantity = $_POST['quantity'];
$addcart = "INSERT INTO cart (userid, phoneid, PhoneName, Storage, Color, image, quantity) VALUES (?,?,?,?,?,?,?)";
$stmt= $conn->prepare($addcart);
$stmt->bind_param("ssssssi", $useridtwo, $phoneidtwo, $phonenametwo, $phonestoragetwo, $phonecolortwo, $phoneimagetwo, $quantity);
$stmt->execute();
header('Location: cart.php');
}
} else {
$phonenametwo = filter_input(INPUT_POST, 'phonenametwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phoneimagetwo = filter_input(INPUT_POST, 'phoneimagetwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phoneidtwo = filter_input(INPUT_POST, 'phoneidtwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$usernologin = $_SESSION['session'];
$transactionidtwo = filter_input(INPUT_POST, 'transidtwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phonestoragetwo = filter_input(INPUT_POST, 'capacitytwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$phonecolortwo = filter_input(INPUT_POST, 'colortwo', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$quantity = $_POST['quantity'];
$addcart = "INSERT INTO cart (userid, phoneid, PhoneName, Storage, Color, image, quantity) VALUES (?,?,?,?,?,?,?)";
$stmt= $conn->prepare($addcart);
$stmt->bind_param("ssssssi", $usernologin, $phoneidtwo, $phonenametwo, $phonestoragetwo, $phonecolortwo, $phoneimagetwo, $quantity);
$stmt->execute();
header('Location: cart.php');
}
?>