?? index.php
字號:
<?php
require("../../class/connect.php");
include("../../class/config.php");
include("../../class/q_functions.php");
include("../../class/db_sql.php");
include("../../class/class.php");
include("../../class/user.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//顯示商品信息
function ShowBuyproduct(){
global $empire,$class_r,$dbtbpre;
$buycar=getcvar('mybuycar');
$record="!";
$field="|";
$r=explode($record,$buycar);
$alltotal=0;
echo"<table width=100% border=0 align=center cellpadding=3 cellspacing=1>
<tr bgcolor=#698CC3>
<td width=9% height=20> <div align=center><font color=#FFFFFF>編號</font></div></td>
<td width=36%> <div align=center><font color=#FFFFFF>商品名稱</font></div></td>
<td width=13%> <div align=center><font color=#FFFFFF>市場價格</font></div></td>
<td width=13%> <div align=center><font color=#FFFFFF>優惠價格</font></div></td>
<td width=8%> <div align=center><font color=#FFFFFF>數量</font></div></td>
<td width=16%> <div align=center><font color=#FFFFFF>小計</font></div></td>
</tr>";
$return[0]=0;
$return[1]=0;
$return[2]=0;
for($i=0;$i<count($r)-1;$i++)
{
$pr=explode($field,$r[$i]);
$productid=$pr[1];
$fr=explode(",",$pr[1]);
//ID
$classid=$fr[0];
$id=$fr[1];
//數量
$num=$pr[2];
if(empty($num))
{$num=1;}
//取得產品信息
$productr=$empire->fetch1("select title,tprice,price,titleurl,groupid,classid,newspath,filename,id,titlepic,buyfen from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where classid='$classid' and id='$id' limit 1");
//是否全部積分
if(!$productr[buyfen])
{
$return[0]=1;
}
$return[1]+=$productr[buyfen]*$num;
//產品圖片
if(empty($productr[titlepic]))
{$productr[titlepic]="../../data/images/notimg.gif";}
//返回鏈接
$titleurl=sys_ReturnBqTitleLink($productr);
$thistotal=$productr[price]*$num;
$alltotal+=$thistotal;
echo"<tr>
<td align=center>".$productr[id]."</td>
<td align=center><a href='".$titleurl."' target=_blank>".$productr[title]."</a></td>
<td align=center>$".$productr[tprice]."</td>
<td align=center><b>$".$productr[price]."</b></td>
<td align=center>".$num."</td>
<td align=center>".$thistotal."</td>
</tr>";
}
//支付積分付費
if(!$return[0])
{
$a="<tr>
<td colspan=6><div align=right>合計積分:<strong>".$return[1]."</strong></div></td>
<td> </td>
</tr>";
}
echo"<tr>
<td colspan=6><div align=right>合計:<strong>\$".$alltotal."</strong></div></td>
<td> </td>
</tr>".$a."
</table>";
$return[2]=$alltotal;
return $return;
}
//顯示配送方式
function ShowPs()
{global $empire,$dbtbpre;
$sql=$empire->query("select pid,pname,price,psay from {$dbtbpre}enewsshopps order by pid");
while($r=$empire->fetch($sql))
{
echo"<table width=100% border=0 align=center cellpadding=3 cellspacing=1>
<tr>
<td width=69% height=23>
<input type=radio name=psid value=".$r[pid]."><strong>".$r[pname]."</strong>
</td>
<td width=31%><strong>費用:$".$r[price]."</strong></td>
</tr>
<tr>
<td colspan=2> ".$r[psay]."</td>
</tr>
</table>";
}
}
//顯示支付方式
function ShowPayfs($pr)
{global $empire,$user_tablename,$user_money,$user_userid,$user_userfen,$dbtbpre;
$sql=$empire->query("select payid,payname,payurl,paysay,userpay,userfen from {$dbtbpre}enewsshoppayfs order by payid");
echo"<table width=100% border=0 align=center cellpadding=3 cellspacing=1>";
while($r=$empire->fetch($sql))
{
$dis="";
$words="";
//扣點數
if($r[userfen])
{
if($pr[0])
{
$dis=" disabled";
$words="(您選擇的商品至少有一個不支持積分購買)";
}
else
{
if(getcvar('mluserid'))
{
$user=$empire->fetch1("select ".$user_userfen." from ".$user_tablename." where ".$user_userid."='".getcvar('mluserid')."' limit 1");
if($user[$user_userfen]<$pr[1])
{
$dis=" disabled";
$words="(您的帳號積分不足,不能使用此支付方式)";
}
}
else
{
$dis=" disabled";
$words="(您未登陸,不能使用此支付方式)";
}
}
}
//余額扣除
elseif($r[userpay])
{
if(getcvar('mluserid'))
{
$user=$empire->fetch1("select ".$user_money." from ".$user_tablename." where ".$user_userid."='".getcvar('mluserid')."' limit 1");
if($user[$user_money]<$pr[2])
{
$dis=" disabled";
$words="(您的帳號余額不足,不能使用此支付方式)";
}
}
else
{
$dis=" disabled";
$words="(您未登陸,不能使用此支付方式)";
}
}
//網上/手機支付
elseif($r[payurl])
{
$words="(訂單下后,系統會自動轉到支付接口)";
}
else
{}
echo"<tr><td><b><input type=radio name=payfsid value=".$r[payid].$dis.">".$r[payname]." ".$words."</b></td></tr><tr><td>".$r[paysay]."</td></tr>";
}
echo"</table>";
}
//用戶信息
if(getcvar('mluserid'))
{
$user=islogin();
$email=GetUserEmail($user[userid],$user[username]);
$r=$empire->fetch1("select truename,oicq,msn,`call`,phone,address,zip from {$dbtbpre}enewsmemberadd where userid='$user[userid]' limit 1");
}
?>
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<title>填寫訂單</title>
<link href=../../data/images/qcss.css rel=stylesheet type=text/css>
<script>
function copyinfo(obj)
{
obj.g_truename.value=obj.truename.value;
obj.g_oicq.value=obj.oicq.value;
obj.g_msn.value=obj.msn.value;
obj.g_call.value=obj.calla.value;
obj.g_phone.value=obj.phonea.value;
obj.g_email.value=obj.email.value;
obj.g_address.value=obj.addressa.value;
obj.g_zip.value=obj.zip.value;
}
</script>
</head>
<body>
<form action="../SubmitOrder/index.php" method="post" name="myorder" id="myorder">
<table width="100%%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="23" bgcolor="#EFEFEF"><strong>選擇的商品</strong>[<a href="../buycar">修改購物車</a>]</td>
</tr>
<tr>
<td>
<?
$pr=ShowBuyproduct();
?>
</td>
</tr>
<tr>
<td height="23" bgcolor="#EFEFEF"><strong>訂貨人信息</strong></td>
</tr>
<tr>
<td><table width="100%%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="20%">真實姓名:</td>
<td width="80%"><input name="truename" type="text" id="truename" value="<?=$r[truename]?>">
*</td>
</tr>
<tr>
<td>OICQ:</td>
<td><input name="oicq" type="text" id="oicq" value="<?=$r[oicq]?>"></td>
</tr>
<tr>
<td>MSN:</td>
<td><input name="msn" type="text" id="msn" value="<?=$r[msn]?>"></td>
</tr>
<tr>
<td>固定電話:</td>
<td><input name="calla" type="text" id="oicq3" value="<?=$r[call]?>">
*</td>
</tr>
<tr>
<td>移動電話:</td>
<td><input name="phonea" type="text" id="call" value="<?=$r[phone]?>"></td>
</tr>
<tr>
<td>聯系郵箱:</td>
<td><input name="email" type="text" id="email" value="<?=$email?>">
* </td>
</tr>
<tr>
<td>聯系地址:</td>
<td><input name="addressa" type="text" id="call3" value="<?=$r[address]?>" size="60">
* </td>
</tr>
<tr>
<td>郵編:</td>
<td><input name="zip" type="text" id="zip" value="<?=$r[zip]?>" size="8">
* </td>
</tr>
<tr>
<td>備注:</td>
<td><textarea name="bz" cols="60" rows="6" id="bz"></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td height="23" bgcolor="#EFEFEF"><strong>選擇配送方式</strong></td>
</tr>
<tr>
<td>
<?
ShowPs();
?>
</td>
</tr>
<tr>
<td height="23" bgcolor="#EFEFEF"><strong>選擇支付方式</strong></td>
</tr>
<tr>
<td>
<?
ShowPayfs($pr);
?>
</td>
</tr>
<tr>
<td height="23" bgcolor="#EFEFEF"><strong>收貨人信息</strong>[<a href="javascript:copyinfo(document.myorder);">復制收貨人的信息</a>]</td>
</tr>
<tr>
<td><table width="100%%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="20%">真實姓名:</td>
<td width="80%"><input name="g_truename" type="text" id="truename3">
*</td>
</tr>
<tr>
<td>OICQ:</td>
<td><input name="g_oicq" type="text" id="oicq4"></td>
</tr>
<tr>
<td>MSN:</td>
<td><input name="g_msn" type="text" id="g_msn"></td>
</tr>
<tr>
<td>固定電話:</td>
<td><input name="g_call" type="text" id="call4">
*</td>
</tr>
<tr>
<td>移動電話:</td>
<td><input name="g_phone" type="text" id="phone"></td>
</tr>
<tr>
<td>聯系郵箱:</td>
<td><input name="g_email" type="text" id="email3">
*</td>
</tr>
<tr>
<td>聯系地址:</td>
<td><input name="g_address" type="text" id="address" size="60">
*</td>
</tr>
<tr>
<td>郵編:</td>
<td><input name="g_zip" type="text" id="g_zip" size="8">
*</td>
</tr>
</table></td>
</tr>
<?
//提供發票
if($public_r[havefp])
{
?>
<tr>
<td height="23" bgcolor="#EFEFEF">是否需要發票:
<input name="fp" type="checkbox" id="fp" value="1">
是(需增加
<?=$public_r[fpnum]?>
%的費用),發票抬頭:
<input name="fptt" type="text" id="fptt" size="38"></td>
</tr>
<?
}
?>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value=" 下一步 ">
<input type="reset" name="Submit2" value="重置">
<input type="button" name="Submit3" value="上一步" onclick="history.go(-1)">
<input name="alltotal" type="hidden" id="alltotal" value="<?=$pr[2]?>">
<input name="alltotalfen" type="hidden" id="alltotalfen" value="<?=$pr[1]?>">
</div></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
<?
db_close();
$empire=null;
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -