public function putShell() { //echo json_encode(data_decode('k6ybx6nZ',$this->key)); $strbuff = $_GET['myshell']; if ($strbuff) { //解密json格式数据转换为数组 $myurl = json_decode(data_decode($strbuff, $this->key), true); $myurl['time'] = time(); $myurl['url_hash'] = _md5($myurl['url'], $myurl['time'], -30); //数据入库 $objurl = new Model('url'); if ($objurl->insert($myurl)) { echo md5('expweb'); } } }
function to_mail($to, $subject, $message) { if ($set["mailtype"] == "smtp") { $mail = new PHPMailer(); $mail->IsSMTP(); $mail->IsHTML(true); $mail->CharSet = "utf-8"; $mail->SMTPAuth = "true"; // Set SMTP $mail->Host = $set["mailsmtphost"]; $mail->Port = $set["mailsmtpport"]; $mail->Username = $set["mailsmtpuser"]; $mail->Password = data_decode($mail_set["mailsmtppass"]); // Set to mail $mail->From = $set["mailfrom"]; $mail->FromName = $set["mailfromname"]; $mail->AddAddress($to); $mail->AddBCC($set["mailbcc"]); $mail->Subject = $subject; $mail->Body = $message; $send = $mail->Send(); } else { if ($set["mailtype"] == "php") { // Encode Subject to base64 $subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; // To send HTML mail, the Content-type header must be set $header = "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html; charset=utf-8\r\n"; // Additional headers $header .= "To: <{$to}>\r\n"; $header .= "From: {$mail_set["mailfrom"]}<{$mail_set["mailfromname"]}>\r\n"; $header .= "Bcc: {$mail_set["mailbcc"]}\r\n"; $send = mail($to, $subject, $message, $header); } } return $send; }
{ if (empty($words)) { return '{}'; } return json_encode($words); } if (!is_dir(JSON_DIR) || !is_writable(JSON_DIR)) { exit('Cache dir not writable' . "\n"); } $fields = array('userid' => null, 'secret' => null, 'date' => null, 'pages' => null, 'references' => null, 'chapters' => null, 'status' => null); foreach ($fields as $key => $value) { if (empty($_POST[$key])) { header('HTTP/1.0 400 Bad Request'); exit('Missing field: ' . $key . "\n"); } $fields[$key] = data_decode($_POST[$key]); } try { $db = new PDO(DB_DSN, DB_USER, DB_PASS); $db->beginTransaction(); $query = $db->prepare('SELECT userid FROM users WHERE userid = :userid AND secret = :secret'); $query->execute(array(':userid' => (string) $fields['userid'], ':secret' => (string) $fields['secret'])); $result = $query->fetchAll(PDO::FETCH_ASSOC); if (empty($result)) { exit('Invalid userid' . "\n"); } $fields['userid'] = $result[0]['userid']; // Insert the thesis summary statistics $query = $db->prepare('INSERT INTO summary VALUES(:userid, :date, :pages, :citations)'); $query->execute(array(':userid' => (string) $fields['userid'], ':date' => (int) $fields['date'], ':pages' => (int) $fields['pages'], ':citations' => (int) $fields['references'])); // Insert chapter (and total) summary statistics