-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwishlist_inter.php
58 lines (51 loc) · 1.38 KB
/
wishlist_inter.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
<?php
include_once("inc_config.php");
if($_SESSION['wishlist_productid'] != "")
{
$productid = $_SESSION['wishlist_productid'];
}
else
{
$productid = $validation->input_validate($_GET['id']);
}
$redirect_url = $validation->input_validate($_GET['q']);
$status = "active";
if($regid == "")
{
$_SESSION['wishlist_productid'] = $productid;
$_SESSION['error_msg_fe'] = "Please login first to continue!";
header("Location: {$base_url}login{$suffix}?q=wishlist");
exit();
}
if($productid == "")
{
//$_SESSION['error_msg_fe'] = "Please select atleast one product!";
header("Location: {$base_url}products{$suffix}");
exit();
}
$checkResult = $db->view('*', 'rb_wishlist', 'wishlistid', "and regid = '$regid' and productid = '$productid' and status = 'active'");
if($checkResult['num_rows'] == 0)
{
$fields = array('regid'=>$regid, 'productid'=>$productid, 'status'=>$status, 'user_ip'=>$user_ip);
$fields['createtime'] = $createtime;
$fields['createdate'] = $createdate;
$wishlistResult = $db->insert("rb_wishlist", $fields);
if(!$wishlistResult)
{
echo mysqli_error($connect);
exit();
}
}
$_SESSION['wishlist_productid'] = "";
if($redirect_url != "")
{
$_SESSION['notify_success_msg_fe'] = "You have successfully added product in the wishlist!";
header("Location: {$redirect_url}");
}
else
{
$_SESSION['success_msg_fe'] = "";
header("Location: {$base_url}wishlist{$suffix}");
}
exit();
?>