本文整理汇总了PHP中SaeMysql::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::escape方法的具体用法?PHP SaeMysql::escape怎么用?PHP SaeMysql::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeMysql
的用法示例。
在下文中一共展示了SaeMysql::escape方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?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();
示例2: explode
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) . "'";
示例3: json_encode
<?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));
示例4: SaeMysql
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>";
示例5: saveping
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();
}
示例6: Watch
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;
}