⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blcar_stop.php

📁 uch争车位,适合大家的使用 可以实验
💻 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 + -