Server : Apache System : Linux iZ2vcgyutqttsd1p850kl8Z 3.10.0-1160.92.1.el7.x86_64 #1 SMP Tue Jun 20 11:48:01 UTC 2023 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/wwwroot/saimikebio.com/wechat/ |
<?php define('IN_ECS', true); require(dirname(__FILE__) . '/../includes/init.php'); $_REQUEST['act'] = trim($_REQUEST['act']); date_default_timezone_set('PRC'); $act = $_REQUEST['act']; $time = time(); if($act == 'egg') { if($_POST) { $wxid = $_POST['wxid']; $_SESSION['wxid'] = $wxid; $prize_name = $_POST['prize']; $paid = $_POST['paid']; $yn = $_POST['yn']; $prize_id = $_POST['pid']; $prize_value = $_POST['prize_value']; $sn = $time.$wxid; $prize_sn = md5($sn); $nickname = $_POST['nickname']; $fun = $_POST['pzfun']; $query_sql = "SELECT `count` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"; $prize_count = $db->getOne($query_sql); $num = $db->getOne("SELECT `num` FROM ". $GLOBALS['ecs']->table('weixin_prize') ." WHERE `pid` = '$prize_id' "); if(( $prize_count > $num)) { $res['msg'] = 2; $res['prize'] = '您抽奖的机会用完了'; echo json_encode($res); exit; } if(!empty($wxid)) { if($yn == 'yes') { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 0 , '$yn' ,$time);"; } else { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 1 , '$yn' ,$time);"; } $db->query($sql); } if(!empty($wxid) and !empty($prize_id)) { $temp_pid = $db->getOne("SELECT `wxid` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"); if(empty($temp_pid)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_count')." (`pid`, `wxid`, `num`, `count`, `lasttime`, `dateline`) VALUES ('$prize_id', '$wxid', '1','1','$time','$time');"; $db->query($insert_sql); } else { $update_sql = "UPDATE " . $ecs->table('weixin_prize_count')." SET `num` = `num`+1,`count` = `count`+1,`lasttime` = '$time' WHERE `wxid`='$wxid' AND `pid` = '$prize_id';"; $db->query($update_sql); } } $ck_cnum = $db->getOne("SELECT `paid` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid' "); if (empty($ck_cnum)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_cnum')." (`paid`, `pid`, `prize_name`, `prize_value` , `user_count`) VALUES ('$paid', '$prize_id', '$prize_name', '$prize_value' ,'1');"; } else { $ck_prize_num = $db->getOne("SELECT `user_count` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid'"); if ($ck_prize_num >= $prize_value) { $insert_sql = ""; } else { $t_prize_value = $db->getOne("SELECT `prize_value` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` ='$paid'"); if($t_prize_value) { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `prize_value` = `prize_value` - 1,`user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } else { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } } } } if ($insert_sql) { $db->query($insert_sql); } } elseif($act == 'dzp') { if($_POST) { $wxid = $_POST['wxid']; $_SESSION['wxid'] = $wxid; $prize_name = $_POST['prize']; $paid = $_POST['paid']; $yn = $_POST['yn']; $prize_id = $_POST['pid']; $prize_value = $_POST['prize_value']; $sn = $time.$wxid; $prize_sn = md5($sn); $nickname = $_POST['nickname']; $fun = $_POST['pzfun']; $query_sql = "SELECT `count` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"; $prize_count = $db->getOne($query_sql); $num = $db->getOne("SELECT `num` FROM ". $GLOBALS['ecs']->table('weixin_prize') ." WHERE `pid` = '$prize_id' "); if(( $prize_count >= $num)) { $res['msg'] = 2; $res['prize'] = '您抽奖的机会用完了'; echo json_encode($res); exit; } if(!empty($wxid)) { if($yn == 'yes') { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 0 , '$yn' ,$time);"; } else { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 1 , '$yn' ,$time);"; } $db->query($sql); } if(!empty($wxid) and !empty($prize_id)) { $temp_pid = $db->getOne("SELECT `wxid` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"); if(empty($temp_pid)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_count')." (`pid`, `wxid`, `num`, `count`, `lasttime`, `dateline`) VALUES ('$prize_id', '$wxid', '1','1','$time','$time');"; $db->query($insert_sql); } else { $update_sql = "UPDATE " . $ecs->table('weixin_prize_count')." SET `num` = `num`+1,`count` = `count`+1,`lasttime` = '$time' WHERE `wxid`='$wxid' AND `pid` = '$prize_id';"; $db->query($update_sql); } } $ck_cnum = $db->getOne("SELECT `paid` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid' "); if (empty($ck_cnum)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_cnum')." (`paid`, `pid`, `prize_name`, `prize_value` , `user_count`) VALUES ('$paid', '$prize_id', '$prize_name', '$prize_value' ,'1');"; } else { $ck_prize_num = $db->getOne("SELECT `user_count` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid'"); if ($ck_prize_num >= $prize_value) { $insert_sql = ""; } else { $t_prize_value = $db->getOne("SELECT `prize_value` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` ='$paid'"); if($t_prize_value) { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `prize_value` = `prize_value` - 1,`user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } else { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } } } } if ($insert_sql) { $db->query($insert_sql); } } elseif($act == 'ggk') { if($_POST) { $wxid = $_POST['wxid']; $_SESSION['wxid'] = $wxid; $prize_name = $_POST['prize']; $paid = $_POST['paid']; $yn = $_POST['yn']; $prize_id = $_POST['pid']; $prize_value = $_POST['prize_value']; $time = time(); $sn = $time.$wxid; $prize_sn = md5($sn); $nickname = $_POST['nickname']; $fun = $_POST['pzfun']; $query_sql = "SELECT `count` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"; $prize_count = $db->getOne($query_sql); $num = $db->getOne("SELECT `num` FROM ". $GLOBALS['ecs']->table('weixin_prize') ." WHERE `pid` = '$prize_id' "); if(( $prize_count >= $num)) { $res['msg'] = 2; $res['prize'] = '您抽奖的机会用完了'; echo json_encode($res); exit; } if(!empty($wxid)) { if($yn == 'yes') { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 0 , '$yn' ,$time);"; } else { $sql = "INSERT INTO " . $ecs->table('weixin_prize_users')." (`wxid`, `nickname`, `fun`, `prize_id`, `prize_name`, `prize_sn`, `status`, `yn`, `dateline`) VALUES ('$wxid','$nickname','$fun','$prize_id','$prize_name', '$prize_sn', 1 , '$yn' ,$time);"; } $db->query($sql); } if(!empty($wxid) and !empty($prize_id)) { $temp_pid = $db->getOne("SELECT `wxid` FROM " . $ecs->table('weixin_prize_count')." WHERE `wxid` = '$wxid' AND `pid` = '$prize_id'"); if(empty($temp_pid)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_count')." (`pid`, `wxid`, `num`, `count`, `lasttime`, `dateline`) VALUES ('$prize_id', '$wxid', '1','1','$time','$time');"; $db->query($insert_sql); } else { $update_sql = "UPDATE " . $ecs->table('weixin_prize_count')." SET `num` = `num`+1,`count` = `count`+1,`lasttime` = '$time' WHERE `wxid`='$wxid' AND `pid` = '$prize_id';"; $db->query($update_sql); } } $ck_cnum = $db->getOne("SELECT `paid` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid' "); if (empty($ck_cnum)) { $insert_sql = "INSERT INTO " . $ecs->table('weixin_prize_cnum')." (`paid`, `pid`, `prize_name`, `prize_value` , `user_count`) VALUES ('$paid', '$prize_id', '$prize_name', '$prize_value' ,'1');"; } else { $ck_prize_num = $db->getOne("SELECT `user_count` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` = '$paid'"); if ($ck_prize_num >= $prize_value) { $insert_sql = ""; } else { $t_prize_value = $db->getOne("SELECT `prize_value` FROM " . $ecs->table('weixin_prize_cnum')." WHERE `paid` ='$paid'"); if($t_prize_value) { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `prize_value` = `prize_value` - 1,`user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } else { $insert_sql = "UPDATE " . $ecs->table('weixin_prize_cnum')." SET `user_count` = `user_count` +1 WHERE `paid` ='$paid';"; } } } } if ($insert_sql) { $db->query($insert_sql); } } ; ?>