Exemplo n.º 1
0
<?php

header("Content-Type:application/json;charset=UTF-8");
$code = $_GET['code'];
$poc = array("poc_1" => 1, "poc_2" => 2, "poc_3" => 3, "poc_4" => 4, "poc_5" => 5, "poc_6" => 6, "poc_7" => 7, "poc_8" => 8, "poc_9" => 9, "poc_10" => 10);
//参数 code验证
if (strpos($code, "||") == false) {
    echo json_encode(array("status" => false, "msg" => "error code!"));
    exit;
}
list($key, $value) = explode("||", $code);
if ($value != strtoupper(substr(md5("hongcha" . $key . "android"), 1, -1))) {
    echo json_encode(array("status" => false, "msg" => "error code!"));
    exit;
}
$mysql = new SaeMysql();
$sql = "select * from result where code ='" . $mysql->escape($code) . "'";
$data = $mysql->getData($sql);
$result = array();
if ($data) {
    $tmpdata = $data[0];
    foreach ($tmpdata as $key => $value) {
        if ($key != "code" && $key != "id" && $key != "token" && $key != "ua") {
            $result[$key] = intval($value);
        }
    }
    echo json_encode(array("status" => true, "msg" => $result));
} else {
    echo json_encode(array("status" => false, "msg" => "query empty!"));
}
$mysql->closeDb();
Exemplo n.º 2
0
    echo json_encode(array("status" => false, "msg" => "error suc!"));
    exit;
}
//参数 code验证
if (strpos($code, "||") == false) {
    echo json_encode(array("status" => false, "msg" => "error code!"));
    exit;
}
list($key, $value) = explode("||", $code);
if ($value != strtoupper(substr(md5("hongcha" . $key . "android"), 1, -1))) {
    echo json_encode(array("status" => false, "msg" => "error code!"));
    exit;
}
$id = 0;
$mysql = new SaeMysql();
$sql = "select id from result where code ='" . $mysql->escape($code) . "'";
$data = $mysql->getData($sql);
if (!$data) {
    //   	$insert_sql = "insert into result (`code`, `ua`) values ('" .$mysql->escape($code) . "','". $mysql->escape($ua)  ."')";
    //$mysql->runSql($insert_sql);
    //if ($mysql->errno() != 0){
    //		echo json_encode(array("status" => false, "msg" => "mysql error!"));
    //		exit();
    //}
    //$id = $mysql->lastId();
    echo json_encode(array("status" => false, "msg" => "请刷新后重试!"));
    exit;
} else {
    $id = intval($data[0]["id"]);
}
$update_sql = "update result set {$poc[$poc_suc]} = 1 where id = {$id} and code ='" . $mysql->escape($code) . "'";
Exemplo n.º 3
0
<?php

header("Content-Type:application/json;charset=UTF-8");
$token = $_GET['token'];
$ua = $_SERVER['HTTP_USER_AGENT'];
if (empty($token) || strlen($token) < 10) {
    echo json_encode(array("status" => false, "msg" => "token不正确"));
    exit;
}
$mysql = new SaeMysql();
$sql = "select id,code from result where token ='" . $mysql->escape($token) . "'";
$data = $mysql->getData($sql);
if (!$data) {
    $code = date("YmdHis") . "||" . strtoupper(substr(md5("hongcha" . date("YmdHis") . "android"), 1, -1));
    $insert_sql = "insert into result (`code`,`token`, `ua`) values ('" . $mysql->escape($code) . "','" . $mysql->escape($token) . "','" . $mysql->escape($ua) . "')";
    $mysql->runSql($insert_sql);
    if ($mysql->errno() != 0) {
        echo json_encode(array("status" => false, "msg" => "mysql error!"));
        exit;
    }
} else {
    $code = $data[0]['code'];
}
$mysql->closeDb();
//$code = date("YmdHis")."||".strtoupper(substr(md5("hongcha".date("YmdHis")."android"),1,-1));
echo json_encode(array("status" => true, "code" => $code));
Exemplo n.º 4
0
include_once 'config.php';
include_once 'saetv2.ex.class.php';
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $_SESSION['token']['access_token']);
$uid_get = $c->get_uid();
$uid = $uid_get['uid'];
//$user_message = $c->show_user_by_id( $uid);//根据ID获取用户等基本信息
$mysql = new SaeMysql();
//$name = strip_tags( $_REQUEST['pyn'] );
//$name = strip_tags( $_POST['pyn'] );
$textall = "";
$name = $_REQUEST['pyn'];
foreach ($name as $k => $v) {
    if ($k == 0) {
        $textall .= $v;
    } else {
        $textall .= "," . $v;
    }
}
echo "You have selected:=" . $textall;
//$age = intval( $_REQUEST['age'] );
//$sql = "INSERT  INTO `users` ( `weiboid` , `weiboname`,`pynames` ) VALUES ( '','','"  . $mysql->escape( $textall ) . "'  ) ";
$sql = "UPDATE `users` SET `pynames` = '" . $mysql->escape($textall) . "' WHERE `users`.`weiboid` = '" . $uid . "' ";
$mysql->runSql($sql);
if ($mysql->errno() != 0) {
    die("Error:" . $mysql->errmsg());
}
$mysql->closeDb();
$url = "css8.php";
echo "<script language='javascript' type='text/javascript'>";
echo "window.location.href='{$url}'";
echo "</script>";
Exemplo n.º 5
0
 public function saveping($source, $destination, $min, $avg, $max, $loss)
 {
     $mysql = new SaeMysql();
     $sql = "INSERT INTO `ping` (`source`, `destination`, `min`, `avg`, `max`, `loss`, `time`)" . " VALUES ('" . $mysql->escape($source) . "', '" . $mysql->escape($destination) . "', " . $min . ", " . $avg . ", " . $max . ", " . $loss . ", NOW())";
     $mysql->runSql($sql);
     if ($mysql->errno() != 0) {
         log_message('error', "MySQL Error: " . $mysql->errmsg());
         //die( "Error: " . $mysql->errmsg() );
         die($sql);
     }
     $mysql->closeDb();
 }
Exemplo n.º 6
0
function Watch($url)
{
    $datetime = new DateTime();
    $date = $datetime->format('Ymd');
    
    // fetch urls
    $web_content = RetrieveContent($url);
    if (NULL === $web_content)
        return NULL;
    
    $mysql = new SaeMysql();
    // store web content(plain text)
    $sql = "INSERT INTO `web_content` ( `url` , `date` , `content` ) VALUES ( '"  . $mysql->escape($url) . "' , '" . $date . "' , '" . $web_content . "')";
    if (!$mysql->runSql( $sql ))
        echo "Error : " . $sql;
    else
        echo "Sql is executed successfully.";
        
    $mysql->closeDb();
    
    return $web_content;
}