-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart_share.php
46 lines (38 loc) · 1.04 KB
/
cart_share.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
<?
include("connect.php");
if(isset($_GET['personid'])) {
$personid=$_GET['personid'];
$cart_number=$_GET['cart'];
}
// Grab the cart
$user_info=mysql_fetch_array(mysql_query("SELECT * FROM user_data WHERE uid='$personid'"));
$carts=explode("%",$user_info['saved_carts']);
$cart=explode(";",$carts[$cart_number]);
//echo $cart_number;
//print_r($_SESSION);
// Don't change
if(!isset($_GET['change'])) {
if($cart[3]=="Yes") {
$todo="Make Private";
} else if($cart[3]=="No") {
$todo="Make Public";
}
}
// Change the cart
if(isset($_GET['change'])) {
if($cart[3]=="Yes") {
$cart[3]="No";
$todo="Make Public";
} else if($cart[3]=="No") {
$cart[3]="Yes";
$todo="Make Private";
} else {
echo "This shouldn't have happened.";
}
// Put the carts back together
$carts[$cart_number]=implode(";",$cart);
$changed_carts=implode("%",$carts);
mysql_query("UPDATE user_data SET saved_carts='$changed_carts' WHERE uid='$personid'");
}
echo "<a href='javascript:share_cart($cart_number,$personid);yesToNo($personid,$cart_number)'>$todo</a>";
?>