?? blcar_stop.php
字號:
<?php
/*
http://www.biihu.com
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if($uid){
$query = $db -> query("select username,extcredits{$bl_credits} from {$tablepre}members where uid='$uid'");
$stop_members = $db -> fetch_array($query);
}
if($taction==""){
$query = $db -> query("select count(*) from bl_mycar where uid='$discuz_uid'");
$blcarcount = $db -> result($query,0);
if($blcarcount==0){
showmessage("您還沒有車,沒法停呀,走!購車去!",$blcartmpurl."&action=10");
}
$ppp=6;
$page = $page?$page:1;
$pagestart = ($page-1)*$ppp;
$query = $db -> query("select a.blmid,a.blid,a.bl_last_pose,b.bl_car_name,b.bl_car_money,b.bl_car_img from bl_mycar as a,bl_carlist as b where a.uid='$discuz_uid' and b.blid = a.blid order by blmid asc limit $pagestart,$ppp");
$i=1;
while($row = $db -> fetch_array($query)){
$posee = explode('|',$row[bl_last_pose]);
$row[pose_uid] = $posee[0];
$row[pose_id] = $posee[1];
$row[pose_user] = $posee[2];
$row[i] = $i;
$blcar_car_list[] = $row;
$i++;
}
$blcar_car_list_count = count($blcar_car_list);
unset($i,$query,$row);
$multi = multi($blcarcount,$ppp,$page,"$blcarurl&taction=$taction&pose=$pose&uid=$uid");
}elseif($taction==1){
$query = $db -> query("select * from bl_mypose where uid='$uid' limit 1");
$stoppose = $db -> fetch_array($query);
if(empty($stoppose[uid])){
showmessage("對不起此用戶并沒有創建車位,他是不是沒來過這呢?",$blcartmpurl);
}
if($stoppose["bl_pose_uid_".$pose]){//檢查停車位是否被占用
showmessage("對不起,該車位已被占用,現在返回首頁!",$blcartmpurl.'&uid='.$uid);
}
$carquery = $db -> query("select a.bl_last_pose,a.bl_last_time,a.bl_action,b.bl_car_name from bl_mycar as a,bl_carlist as b where a.blmid='$blmid' and b.blid=a.blid limit 1");
$carstring = $db -> fetch_array($carquery);
if(empty($carstring)){
showmessage("對不起,沒有找到此車,請重試!",$blcartmpurl.'&uid='.$uid);
}
$carlastpose = explode('|',$carstring[bl_last_pose]);//uid|pose
if($carlastpose[0]==$uid){ //判斷是否兩次都是停在同一個人的車位
showmessage("對不起,不能連續兩次停在同一個人的車位!",$blcartmpurl.'&uid='.$uid);
}
$between = ($timestamp-$carstring[bl_last_time])/60;
if($carstring[bl_action]!=1){//在路上
$post_money = getmoney($carstring[bl_last_time],$bl_onroad);
if(($bl_mymoney-$post_money)<0){//檢查扣完錢后是否會出現負情況,出現則為零
$post_money = $bl_mymoney;
}
//檢查是不是新車
if($bl_mycar_love[bl_buy_time]==$bl_mycar_love[bl_last_time]){
$bl_content1 = "我的 ".$carstring[bl_car_name]." 終于要開動啦!";
}else{
$db -> query("update {$tablepre}members set extcredits{$bl_credits} = (extcredits{$bl_credits} - $post_money) where uid='$discuz_uid'");
$bl_content1 = "我的 ".$carstring[bl_car_name]." 在路上游蕩了".intval($between)."分鐘交養路費".$post_money.$bl_credit_unit;
}
}else{//在停車位
//查找上個車位所使用的道具
//找到這輛車所在車位的增長值
$magquery = $db -> query("select b.bl_magic_url from bl_mymagic as a,bl_magic as b where bl_mymagic_check=1 and uid='".$row[bl_last_uid]."' and b.bl_magic_id=a.bl_magic_id order by bl_mymagic_usetime desc");
while($row1 = $db -> fetch_array($magquery)){
include "magic/".$row1[bl_magic_url];
}
$get_money = getmoney($carstring[bl_last_time],$bl_stop);
$a = $db -> query("update {$tablepre}members set extcredits{$bl_credits} = (extcredits{$bl_credits} + $get_money) where uid='$discuz_uid'");
$bl_content1 = "我的 ".$carstring[bl_car_name]." 在 ".$carlastpose[2]." 的私有車位上停了".intval($between)."分鐘賺了".$get_money.$bl_credit_unit;
}
//寫入LOG
log_add($discuz_uid,2,$bl_content1);
//清空上次停車數據
if($carlastpose[0]){
$db -> query("update bl_mypose set bl_pose_uid_{$carlastpose[1]}='',bl_pose_user_{$carlastpose[1]}='',bl_pose_blmid_{$carlastpose[1]}='',bl_pose_blid_{$carlastpose[1]}='' where uid='$carlastpose[0]'");
}
//更新我的車停的位置
$db -> query("update bl_mypose set bl_pose_uid_{$pose}='$discuz_uid',bl_pose_user_{$pose}='$discuz_user',bl_pose_blmid_{$pose}='$blmid',bl_pose_blid_{$pose}='$blid' where uid='$uid'");
//更新我的車狀況
$db -> query("update bl_mycar set bl_last_pose='".$uid."|".$pose."|".$stop_members[username]."',bl_last_time='$timestamp',bl_action='1' where blmid='$blmid'");
//寫入log
$bl_content1 = "我于 ".date('Y-m-d h:i:s',$timestamp)." 把 ".$carstring[bl_car_name]." 停在了 ".$stop_members[username]." 的第 $pose 私有車位上!";
log_add($discuz_uid,1,$bl_content1);
if($post_money){
if($bl_mycar_love[bl_buy_time]==$bl_mycar_love[bl_last_time]){
showmessage("新車終于要出發啦~~恭喜你呀~~",$blcartmpurl.'&uid='.$uid);
}else{
showmessage("停車成功,在路上游蕩了".intval($between)."分鐘,交養路費".$post_money.$bl_credit_unit."返回到首頁!",$blcartmpurl.'&uid='.$uid);
}
}else{
showmessage("停車成功,您一共停車".intval($between)."分鐘,賺到".$get_money.$bl_credit_unit."返回到首頁!",$blcartmpurl.'&uid='.$uid);
}
}elseif($taction==2){//貼條
$query = $db -> query("select * from bl_mypose where uid = '$discuz_uid' limit 1");
$poseresult = $db -> fetch_array($query);
if(!$poseresult){
showmessage("小樣,貼啥貼,沒這車呀!",$blcarurl);
}
$pose_blmid = $poseresult["bl_pose_blmid_".$pose];
unset($query);
$query = $db -> query("select uid,blid,bl_last_pose,bl_last_time from bl_mycar where blmid = '$pose_blmid'");//得到此車共賺多少,收入口袋
$post_mycar = $db -> fetch_array($query);
if(!$post_mycar){
showmessage("這破系統咋出錯了呢?",$blcarurl);
}
//檢查是否可以貼條
if(($timestamp-$post_mycar[bl_last_time])<($bl_pose_max*60)&&$bl_pose_max){
showmessage("車還沒停穩{$bl_pose_max}分你就想貼牌了呀?不讓貼!",$blcartmpurl);
}
$post_money = getmoney($post_mycar[bl_last_time],$bl_stop);
//清空停車位
$db -> query("update bl_mypose set bl_pose_uid_{$pose}='',bl_pose_user_{$pose}='',bl_pose_blmid_{$pose}='',bl_pose_blid_{$pose}='' where uid='$discuz_uid'");
//更新被貼牌車狀態
$db -> query("update bl_mycar set bl_last_pose='',bl_last_time='$timestamp',bl_action='0' where blmid='$pose_blmid'");//設置為在路上開
//錢收入口袋
$db -> query("update {$tablepre}members set extcredits{$bl_credits} = (extcredits{$bl_credits} + $post_money) where uid='$discuz_uid'");
//寫入LOG
$query = $db -> query("select bl_car_name from bl_carlist where blid='$post_mycar[blid]'");
$log_car = $db -> fetch_array($query);
if($log_car){
$bl_content1 = "我把 ".$poseresult["bl_pose_user_".$pose]." 的 ".$log_car[bl_car_name]." 狠狠的貼了一下,賺了".$post_money.$bl_credit_unit;
$bl_content2 = "我的 ".$log_car[bl_car_name]." 被 ".$poseresult["bl_pose_user_".$pose]." 狠狠的貼了一下,損失了".$post_money.$bl_credit_unit;
log_add($discuz_uid,2,$bl_content1);
log_add($post_mycar[uid],2,$bl_content2);
}
showmessage("貼條成功!您收入".$post_money.$bl_credit_unit,$blcartmpurl);
}elseif($taction==3){//舉報
//查找被舉報車位的車是誰的。
$query = $db -> query("select uid,bl_pose_uid_{$pose},bl_pose_user_{$pose},bl_pose_blmid_{$pose},bl_pose_blid_{$pose} from bl_mypose where uid='$uid' limit 1");
$myposelist = $db -> fetch_array($query);
//查找車位主人
$query = $db -> query("select username from {$tablepre}members where uid='$uid' limit 1");
$rmember = $db -> fetch_array($query);
if(!$rmember){
showmessage("這車位是憑空來的嗎?怎么沒主人的呢?",$blcarurl);
}
if($myposelist){
$bl_pose_uid = $myposelist["bl_pose_uid_".$pose];
$bl_pose_user = $myposelist["bl_pose_user_".$pose];
$bl_pose_blmid = $myposelist["bl_pose_blmid_".$pose];
$bl_pose_blid = $myposelist["bl_pose_blid_".$pose];
//查找車型
$query = $db -> query("select bl_car_name from bl_carlist where blid = '$bl_pose_blid'");
$mycar = $db -> fetch_array($query);
if(!$mycar){
showmessage("這車是天上來的嗎?怎么找不著型號呢?",$blcarurl);
}
//舉報花費
$db -> query("update {$tablepre}members set extcredits{$bl_credits} = (extcredits{$bl_credits} - $bl_police_post) where uid='$discuz_uid'");
$db -> query("insert into bl_report (`myposeuid`,`myposeid`,`bl_report_uid`,`bl_report_user`,`bl_report_to_uid`,`bl_report_to_user`,`bl_report_to_blmid`,`bl_report_time`)values
('$uid','$pose','$discuz_uid','$discuz_user','$bl_pose_uid','$bl_pose_user','$blmid','$timestamp')");
//寫入日志
$log_content = "我于".date('Y-m-d h:i:s',$timestamp)."舉報了{$bl_pose_user}停在{$rmember[username]}第{$pose}車位上的{$mycar[bl_car_name]},花費了".$bl_police_post.$bl_credit_unit;
log_add($discuz_uid,2,$log_content);
showmessage("舉報成功,您花費了".$bl_police_post.$bl_credit_unit.",如果要匿名舉報,趕快去買匿名舉報卡哦!",$blcartmpurl."&uid=".$uid);
}else{
showmessage("出錯啦。沒有找到此車位!",$blcartmpurl."&uid=".$uid);
}
}
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -