对照你的程序写了一遍,没来得及调试。检查用户的部分还需要你自己写程序,程序可能还存在不完善的地方,实际应用的时候可能还需要修改。
<?php$union_id = $_REQUEST['union_id'];
if(!$union_id)
{
echo '来源无效!';
exit; Response.End();
}
else
{
if(CheckUnionUser(union_id))
{
//是联盟会员,添加cookie
if ($_COOKIE['union_cookie'])
{
////原来已有的联盟,先移除
setcookie('union_cookie', '');
}
//添加新的联盟来源记录 //cookie时效十天,根据你们自己的需要修改
setcookie('union_cookie', $union_id, time() + 3600*24*10, "/", "okdyd.com", 1); //返回跳转地址
$go = $_REQUEST['goto'];
if(!$go)
{
//来源地址为空,直接跳转到页
Response.Redirect("你们的首页",true);
}
else
{
header('Location: ' . $go);
exit;
}
}
else
{
echo ('联盟会员不存在或未审核!');
exit;
}
}//检查用户的函数
function CheckUnionUser($union_id)
{
//SQL="select count(*) from Member_Info where audit=1 and userid='"+union_id+"'"
//这里检测是否为已审核的联盟会员,如果是返回 True 不是返回 false 上面为SQL 代码
}// 结束
$union_id = isset($_COOKIE['union_cookie']) ? $_COOKIE['union_cookie'] : '';
if($union_id!='') //是从联盟过来
{
//插入数据
//SQL="insert into Order_Info(OrderNo,Amount,UserID) values('"+OrderNo+"',"+Amount+",'"+union_id+"')"
}//在你们的后台订单成交管理页面添添加代码(即订单成交时更新数据的状态)(请修改成php代码)
//SQL="update Order_Info set DealFlag=1,DealDt=GetDate() where OrderNo='"+OrderNo+"'"
?>
<?php$union_id = $_REQUEST['union_id'];
if(!$union_id)
{
echo '来源无效!';
exit; Response.End();
}
else
{
if(CheckUnionUser(union_id))
{
//是联盟会员,添加cookie
if ($_COOKIE['union_cookie'])
{
////原来已有的联盟,先移除
setcookie('union_cookie', '');
}
//添加新的联盟来源记录 //cookie时效十天,根据你们自己的需要修改
setcookie('union_cookie', $union_id, time() + 3600*24*10, "/", "okdyd.com", 1); //返回跳转地址
$go = $_REQUEST['goto'];
if(!$go)
{
//来源地址为空,直接跳转到页
Response.Redirect("你们的首页",true);
}
else
{
header('Location: ' . $go);
exit;
}
}
else
{
echo ('联盟会员不存在或未审核!');
exit;
}
}//检查用户的函数
function CheckUnionUser($union_id)
{
//SQL="select count(*) from Member_Info where audit=1 and userid='"+union_id+"'"
//这里检测是否为已审核的联盟会员,如果是返回 True 不是返回 false 上面为SQL 代码
}// 结束
$union_id = isset($_COOKIE['union_cookie']) ? $_COOKIE['union_cookie'] : '';
if($union_id!='') //是从联盟过来
{
//插入数据
//SQL="insert into Order_Info(OrderNo,Amount,UserID) values('"+OrderNo+"',"+Amount+",'"+union_id+"')"
}//在你们的后台订单成交管理页面添添加代码(即订单成交时更新数据的状态)(请修改成php代码)
//SQL="update Order_Info set DealFlag=1,DealDt=GetDate() where OrderNo='"+OrderNo+"'"
?>
header('Location: 你们的首页');
exit;
exit; Response.End();
将Response.End();删除!呵呵,忘记检查代码了。
$union_id=$_GET["union_id"];
if(empty(union_id))
{
die("来源无效!");
}
else
{
if(CheckUnionUser(union_id))
{
$union_cookie="union_cookie";
//是联盟会员,添加cookie
HttpCookie UnionCookie = new HttpCookie(union_cookie);
if (!empty($_COOKIE[$union_cookie])) //原来已有的联盟,先移除
{
unset($_COOKIE[$union_cookie]);
}
//添加新的联盟来源记录
setcookie('union_cookie', $union_id, time() + 3600*24*10, "/", "okdyd.com", 1);//返回跳转地址
$go=$_GET["goto"];
if(empty(go))
{
//来源地址为空,直接跳转到页
header("location:你们的首页");
}
else
{
header("location:$go");
}
}
else
{
die("联盟会员不存在或未审核!");
}
} CheckUnionUser($union_id)
{
//SQL="select count(*) from Member_Info where audit=1 and userid='"+$union_id+"'"
//这里检测是否为已审核的联盟会员,如果是返回 True 不是返回 false 上面为SQL 代码
}
// 结束
//在你们的订单生成页面添加如下代码(请修改成php代码)
$union_id = $_Cookies["union_cookie"]==null?"":$_Cookies[$union_cookie];
if(union_id!="") //是从联盟过来
{
//插入数据
//SQL="insert into Order_Info(OrderNo,Amount,UserID) values('"+OrderNo+"',"+Amount+",'"+union_id+"')"
} //在你们的后台订单成交管理页面添添加代码(即订单成交时更新数据的状态)(请修改成php代码)
//SQL="update Order_Info set DealFlag=1,DealDt=GetDate() where OrderNo='"+OrderNo+"'"
-----------------------------------------------
<div class="CartWrap" id="log">
<div class="CartNav"><img alt="购物流程--查看购物车" src="statics/cartnavi-3.gif"/></div>
<form method="post" action="<{link ctl="order" act="create"}>" id="order-create" extra="subOrder">
<div style="display:none"><{input type="checkForm" }></div>
<{require file="cart/checkout_base.html"}>
<div class="FormWrap" style="background:#F5F4EC; border:1px solid #E5DDC7;"> <{if $trading.products}> <h3><{t}>购买的商品<{/t}></h3> <div class="division">
<table width="100%" cellpadding="0" cellspacing="0" class="liststyle">
<colgroup class="span-2 "></colgroup>
<colgroup class="span-auto"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-1"></colgroup>
<colgroup class="span-2 ColColorOrange"></colgroup>
<thead>
<tr>
<th class="ident"><{t}>货号<{/t}></th>
<th class="product"><{t}>商品名称<{/t}></th>
<th class="price"><{t}>积分<{/t}></th>
<th class="price"><{t}>销售价格<{/t}></th>
<th class="number"><{t}>优惠价格<{/t}></th>
<th class="number"><{t}>数量<{/t}></th>
<th class="price"><{t}>小计<{/t}></th>
</tr>
</thead>
<tbody>
<{foreach from=$trading.products item="item" key="key"}>
<tr>
<td class="ident">
<{$item.bn}>
<!-- todo 配件 -->
<input type="hidden" name="cart[g][cart][<{$item.key}>]" value="<{$item.nums}>" />
<input type="hidden" name="cart[g][pmt][<{$item.goods_id}>]" value="<{$item.pmt_id}>" />
</td>
<td class="product"><{$item.name}><{$item.addon.adjname}><{if $item._pmt.describe}><div class="ht1"><{$item._pmt.describe}></div><{/if}></td>
<td class="price"><{$item._pmt.score|cur:null:true:false}></td>
<td class="price"><{$item.sale_price|cur}></td>
<td class="cost"><{$item._pmt.price|cur}></td>
<td class="number"><{$item.nums}><{if !is_null($item.store) && $item.nums > $item.store}><h3 class="t"><{t}>(提示:需要备货)<{/t}></h3><{/if}></td>
<td class="cost"><{$item._pmt.amount|cur}></td>
</tr>
<{/foreach}>
</tbody>
</table>
</div>
<{/if}>
<{if $trading.gift_e}> <h3><{t}>赠品<{/t}></h3> <div class="division">
<table width="100%" cellpadding="3" cellspacing="0" class="liststyle">
<colgroup class="span-auto"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-1"></colgroup>
<colgroup class="span-2 ColColorOrange"></colgroup>
<thead>
<tr>
<th><{t}>赠品名称<{/t}></th>
<th><{t}>所需积分<{/t}></th>
<th><{t}>限制购买数量<{/t}></th>
<th><{t}>数量<{/t}></th>
<th><{t}>小计<{/t}></th>
</tr>
</thead>
<tbody>
<{foreach from=$trading.gift_e item="item" key="key"}>
<tr>
<td><{$item.name}></td>
<td><{$item.point}></td>
<td ><{if $item.limit_num=='0'}><{t}>不限制<{/t}><{else}><{$item.limit_num}><{/if}></td>
<td><{$item.nums}></td>
<td><{$item.amount}></td>
</tr>
<{/foreach}>
</tbody>
</table>
</div>
<{/if}>
<{if $trading.package}> <h3><{t}>捆绑商品<{/t}></h3>
<div class="division">
<table width="100%" cellpadding="3" cellspacing="0" class="liststyle">
<colgroup class="span-2"></colgroup>
<colgroup class="span-auto"></colgroup>
<colgroup class="span-2"></colgroup>
<colgroup class="span-1"></colgroup>
<colgroup class="span-2 ColColorOrange"></colgroup>
<thead>
<tr>
<th class="ident" width="10%"><{t}>货号<{/t}></th>
<th class="product" width="53%"><{t}>捆绑名称<{/t}></th>
<th class="price" width="12%"><{t}>优惠价格<{/t}></th>
<th class="number" width="4%"><{t}>数量<{/t}></th>
<th class="price" width="9%"><{t}>小计<{/t}></th>
</tr>
</thead>
<tbody>
<{foreach from=$trading.package item="item" key="key"}>
<tr>
<td class="ident"><{$item.bn}></td>
<td class="product"><{$item.name}> <{$item.addon.adjname}></td>
<td class="price"><{$item.price|cur}></td>
<td class="number"><{$item.nums}></td>
<td class="cost"><{$item.amount|cur}></td>
</tr>
<{/foreach}>
</tbody>
</table>
</div>
<{/if}>
<{if count($trading.pmt_o.list)>0 || count($trading.gift_p)>0 || count($trading.coupon_p)>0}>
<div class="division">
<table width="100%" cellpadding="0" cellspacing="0" class="liststyle data">
<colgroup class="span-4 ColColorGray"></colgroup>
<colgroup class="span-auto"></colgroup> <{if count($trading.pmt_o.list)>0}>
<tr>
<th><{t}>享受的优惠:<{/t}></th>
<td>
<ol>
<{foreach from=$trading.pmt_o.list item=item}>
<li><{$item.pmt_describe}></li>
<{/foreach}>
</ol>
</td>
</tr>
<{/if}>
<{if count($trading.gift_p)>0}>
<tr>
<th><{t}>获得赠品:<{/t}></th>
<td>
<ol>
<{foreach from=$trading.gift_p item="item" key="key"}>
<li><{$item.name}> <{$item.nums}><{t}> 件 <{/t}></li>
<{/foreach}>
</ol>
</td>
</tr>
<{/if}>
<{if count($trading.coupon_p)>0}>
<tr>
<th><{t}>获得优惠券:<{/t}></th>
<td>
<ol>
<{foreach from=$trading.coupon_p item="item" key="key"}>
<li><{$item.cpns_name}> <{$item.nums}><{t}> 张<{/t}></li>
<{/foreach}>
</ol></td>
</tr>
<{/if}>
</table>
</div>
<{/if}>
</div>
<{require file="cart/checkout_total.html"}>
<div class="CartBtn"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="hidden" name="fromCart" value="true" />
<input class="actbtn btn-order" type="submit" value="确认无误,下订单»" /></td>
</tr>
</table>
</div></form>
<script>
if(!extra_validator['subOrder']){
extra_validator['subOrder'] ={
'checkForm':['',function(f,i){
if($('shipping-area').value == ''){
alert('您未选择配送地区!');
return false;
}
var checkNum = 0;
$ES('input[name^=delivery[shipping_id]',"shipping").each(function(item){
if(item.checked == true) checkNum++;
});
if(checkNum == 0){
alert('您未选择配送方式!');
return false;
}
checkNum = 0;
$ES('input[name^=payment[payment]',"payment").each(function(item){
if(item.checked == true) checkNum++;
});
if(checkNum == 0){
alert('您未选择支付方式!');
return false;
}else{
return true;
}
}]
};
}
</script>
</div>
------------------------------------------请问,如何在上面的代码中,添加以下代码,使得它运行并更新到sql数据库中的内容?
--------------------------
//在你们的订单生成页面添加如下代码(请修改成php代码)
$union_id = $_Cookies["union_cookie"]==null?"":$_Cookies[$union_cookie];
if(union_id!="") //是从联盟过来
{
//插入数据
//SQL="insert into Order_Info(OrderNo,Amount,UserID) values('"+OrderNo+"',"+Amount+",'"+union_id+"')"
} //在你们的后台订单成交管理页面添添加代码(即订单成交时更新数据的状态)(请修改成php代码)
//SQL="update Order_Info set DealFlag=1,DealDt=GetDate() where OrderNo='"+OrderNo+"'"
-------------------------------(前提是楼上的朋友语句正确)