📄 addtocart.php
字号:
<?php
include_once('myconnect.php');
if( !isset($_REQUEST["sb_id"]) || !is_numeric($_REQUEST["sb_id"]) || ($_REQUEST["sb_id"] <= 0) || !isset($_REQUEST["sb_type"]) || !is_numeric($_REQUEST["sb_type"]) || ($_REQUEST["sb_type"] <= 0) || ($_REQUEST["sb_type"] > 3))
{
header("Location: gen_confirm.php?errmsg=".urlencode("Invalid access, denied"));
die();
}
$sb_id=$_REQUEST["sb_id"];
$sb_type=$_REQUEST["sb_type"];
include_once "logincheck.php";
//=======================maintaining cart items=======================================
if(!isset($_SESSION["offer_count"]))
{
$_SESSION["offer_count"]=0;
}
switch($sb_type)
{
case 1:
for($i=0;$i<=$_SESSION["offer_count"];$i++)
{
if((isset($_SESSION["sell_offer_".$i]))&&($_SESSION["sell_offer_".$i]==$sb_id))
{
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Sell Offer is
already in the inquiry basket"));
die();
}
}
case 2:
for($i=0;$i<=$_SESSION["offer_count"];$i++)
{
if((isset($_SESSION["buy_offer_".$i]))&&($_SESSION["buy_offer_".$i]==$sb_id))
{
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Buy Offer is
already in the inquiry basket"));
die();
}
}
case 3:
for($i=0;$i<=$_SESSION["offer_count"];$i++)
{
if((isset($_SESSION["catalog_offer_".$i]))&&($_SESSION["catalog_offer_".$i]==$sb_id))
{
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Product Catalog
is already in the inquiry basket"));
die();
}
}
}
$_SESSION["offer_count"]=$_SESSION["offer_count"]+1;
$cnt=$_SESSION["offer_count"];
switch($sb_type)
{
case 1:
session_register("sell_offer_".$cnt);
$_SESSION["sell_offer_".$cnt]=$sb_id;
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Sell Offer has been added to inquiry basket"));
die();
case 2:
session_register("buy_offer_".$cnt);
$_SESSION["buy_offer_".$cnt]=$sb_id;
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Buy Offer has been added to inquiry basket"));
die();
case 3:
session_register("catalog_offer_".$cnt);
$_SESSION["catalog_offer_".$cnt]=$sb_id;
header("Location:"."gen_confirm.php?sb_type=$sb_type&id=$sb_id&errmsg=".urlencode("Product has been added to inquiry basket"));
die();
}
//=======================maintaining cart items=======================================
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -