日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

php中address,address.php

發(fā)布時(shí)間:2025/4/5 php 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php中address,address.php 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

require"include/common.inc.php";

header("Cache-control: private");

session_start();

require "include/cart_class.php";

?>

$cart=new usercart();

//獲取操作狀態(tài)

$action=isset($_GET['action'])?html(trim($_GET['action'])):'';

//添加在地址

if($action=='add'){

$fullname=isset($_GET['fullname'])?html(trim($_GET['fullname'])):'';//收貨人

$provinceid=isset($_GET['province'])?html(trim($_GET['province'])):''; //省

$cityid=isset($_GET['city'])?html(trim($_GET['city'])):''; //市

$districtid=isset($_GET['district'])?html(trim($_GET['district'])):''; //區(qū)

//通過省份id查詢省份的名稱

$province = $db->getQueryAllRow('select title_lm from qu_lm where id_lm='.$provinceid.'');

//通過城市的id查詢城市的名稱

$city = $db->getQueryAllRow('select title_lm from qu_lm where id_lm='.$cityid.'');

//通過地區(qū)的id查詢地區(qū)的名稱

$district = $db->getQueryAllRow('select title_lm from qu_lm where id_lm='.$districtid.'');

//詳細(xì)的地址信息

$address=isset($_GET['address'])?html(trim($_GET['address'])):'';

//獲取郵箱

$email=isset($_GET['email'])?html(trim($_GET['email'])):'';

//獲取郵編

$post=isset($_GET['post'])?html(trim($_GET['post'])):'';

//獲取手機(jī)號(hào)碼

$phone=isset($_GET['phone'])?html(trim($_GET['phone'])):'';

//獲取固定電話

$tel=isset($_GET['tel'])?html(trim($_GET['tel'])):'';

if($fullname=='' || $province=='' || $city=='' || $district=='' || $address=='' || $phone==''){

exit();

}

//插入用戶收貨地址表

$db->execute('insert into person_addr(username,fullname,province,city,district,address,email,post,phone,tel,wtime) values("'.$_SESSION['usernames'].'","'.$fullname.'","'.$province.'","'.$city.'","'.$district.'","'.$address.'","'.$email.'","'.$post.'","'.$phone.'","'.$tel.'",'.time().')');

//通過用戶名查詢用戶的收貨地址

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" order by id desc';

$result=$db->query($sql);

//獲取所有的收貨地址并且返回

while(!!$row = $db->getRow($result)){

?>

type="radio" name="mId" value="<?php echo $row['id']?>" />收貨人:<?php echo $row['fullname']?> ?? 地址:<?php echo $row['province']?><?php echo $row['city']?><?php echo $row['district']?><?php echo $row['address']?> ?? 郵編:<?php echo $row['post']?> ?? 郵箱:<?php echo $row['email']?>

?? 電話:<?php echo $row['phone']?> <?php echo $row['tel']?> ??? [ 刪除 ]

}

$db->freeResult($result);

}elseif($action=='del'){//刪除地址

//獲取地址id

$id=isset($_GET['id'])?html(trim($_GET['id'])):'';

//檢查合法性

if($id=='' || !checknum($id)){

exit();

}

//通過地址id和用戶名查詢用戶地址信息

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" and id='.$id.'';

$result=$db->query($sql);

//判斷訂單是不存在

if(!!$row = $db->getRow($result)){

$db->execute('delete from person_addr where username="'.$_SESSION['usernames'].'" and id='.$id.'');

}

$db->freeResult($result);

//

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" order by id desc';

$result=$db->query($sql);

while(!!$row = $db->getRow($result)){

?>

type="radio" name="mId" value="<?php echo $row['id']?>" />收貨人:<?php echo $row['fullname']?> ?? 地址:<?php echo $row['province']?><?php echo $row['city']?><?php echo $row['district']?><?php echo $row['address']?> ?? 郵編:<?php echo $row['post']?> ?? 郵箱:<?php echo $row['email']?>

?? 電話:<?php echo $row['phone']?> <?php echo $row['tel']?> ??? [ 刪除 ]

}

$db->freeResult($result);

}elseif($action=='save'){//保存地址

//通過用戶名查詢用戶地址

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" order by id desc';

$result=$db->query($sql);

//獲取所有的用戶地址

while(!!$row = $db->getRow($result)){

$db->execute('update person_addr set ok=0 where username="'.$_SESSION['usernames'].'"');

}

$db->freeResult($result);

//獲取地址id

$id=isset($_GET['id'])?html(trim($_GET['id'])):'';

if($id=='' || !checknum($id)){

exit();

}

//通過用戶名和地址id查詢地址信息

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" and id='.$id.'';

$result=$db->query($sql);

if(!!$row = $db->getRow($result)){

$db->execute('update person_addr set ok=1 where id='.$id.'');

}

$db->freeResult($result);

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" order by id desc';

$result=$db->query($sql);

while(!!$row = $db->getRow($result)){

?>

type="radio" name="mId" value="<?php echo $row['id']?>" />收貨人:<?php echo $row['fullname']?> ?? 地址:<?php echo $row['province']?><?php echo $row['city']?><?php echo $row['district']?><?php echo $row['address']?> ?? 郵編:<?php echo $row['post']?> ?? 電話:<?php echo $row['phone']?> <?php echo $row['tel']?> ??? [ 刪除 ]

}

$db->freeResult($result);

}elseif($action=='look'){

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" and ok=1 order by id desc limit 1';

$result=$db->query($sql);

if(!!$row = $db->getRow($result)){

?>

*收貨人:<?php echo $row['fullname']?>
*收貨地區(qū):<?php echo $row['province']?><?php echo $row['city']?><?php echo $row['district']?>
*詳細(xì)地址: <?php echo $row['address']?>
郵政編碼:<?php echo $row['post']?>
*手機(jī)號(hào)碼:<?php echo $row['phone']?> ?

固定電話:

}

$db->freeResult($result);

}elseif($action=='again'){

$sql='select * from person_addr where username="'.$_SESSION['usernames'].'" order by id desc';

$result=$db->query($sql);

while(!!$row = $db->getRow($result)){

?>

type="radio" name="mId" value="<?php echo $row['id']?>" />收貨人:<?php echo $row['fullname']?> ?? 地址:<?php echo $row['province']?><?php echo $row['city']?><?php echo $row['district']?><?php echo $row['address']?> ?? 郵編:<?php echo $row['post']?> ?? 電話:<?php echo $row['phone']?> <?php echo $row['tel']?> ??? [ 刪除 ]

}

$db->freeResult($result);

}

?>

一鍵復(fù)制

編輯

Web IDE

原始數(shù)據(jù)

按行查看

歷史

總結(jié)

以上是生活随笔為你收集整理的php中address,address.php的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。