• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysql_escape_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中mysql_escape_string函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_escape_string函数的具体用法?PHP mysql_escape_string怎么用?PHP mysql_escape_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了mysql_escape_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getFileContent

function getFileContent($m)
{
    global $xmlrpcerruser;
    global $xmlrpcString;
    $file_name = $m->getParam(0);
    $file_path = $m->getParam(1);
    $file_name = $file_name->scalarval();
    $file_path = $file_path->scalarval();
    $sql = "SELECT * FROM `" . DB_PREFIX . DB_TBL_FILES . "` WHERE \n\t\t`name` = '" . mysql_escape_string($file_name) . "' AND \n\t\t`path` = '" . mysql_escape_string($file_path) . "'";
    $sql = mysql_query($sql);
    if (false == $sql) {
        dbg();
        my_die();
    }
    $aList = array();
    while ($row = mysql_fetch_assoc($sql)) {
        $aList[] = $row;
    }
    if (empty($aList)) {
        return new xmlrpcresp(0, $xmlrpcerruser, 'file not exist');
    }
    $aList = current($aList);
    if (!defined($aList['path'])) {
        return new xmlrpcresp(0, $xmlrpcerruser, 'file path not correct (remote error)');
    }
    $response = saferead(constant($aList['path']) . '/' . $aList['name']);
    // Возвращаем
    $response = base64_encode($response);
    return new xmlrpcresp(new xmlrpcval($response), $xmlrpcString);
}
开发者ID:rigidus,项目名称:cobutilniki,代码行数:30,代码来源:rfunctions.php


示例2: escape

	function escape($string) {
		return addslashes( $string ); // Disable rest for now, causing problems
		if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
			return mysql_escape_string( $string );
		else
			return mysql_real_escape_string( $string, $this->dbh );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:7,代码来源:wp-db.php


示例3: ViewLog

function ViewLog()
{
    global $db_host, $db_user, $db_pass, $db_name;
    global $total, $page, $size, $view_size;
    global $client_count_info, $client_from_info, $client_where_info, $client_select_info, $client_order_info;
    $page = intval($_GET["page"]);
    $role = $_GET["role"];
    $Conn = mysql_connect($db_host, $db_user, $db_pass);
    mysql_query("SET NAMES 'GBK'");
    mysql_select_db($db_name, $Conn);
    $role = mysql_escape_string($role);
    $qs = "{$client_count_info} {$client_from_info} {$client_where_info} and clc.role_name = '{$role}'";
    $result = mysql_query($qs);
    $row = mysql_fetch_row($result);
    $total = intval($row[0]);
    $b = $page * $size - $size;
    $e = $size;
    printf("<p>查询条件是角色名: <b>{$role}</b><p>");
    $qs = "{$client_select_info} {$client_from_info} {$client_where_info} and clc.role_name = '{$role}' {$client_order_info} limit {$b}, {$e}";
    $result = mysql_query($qs);
    $content = array();
    while ($row = mysql_fetch_row($result)) {
        $content[count($content)] = $row;
    }
    printf(GetClientLogHTML($content));
}
开发者ID:svn2github,项目名称:ybtx,代码行数:26,代码来源:list_by_role_c.php


示例4: searchArticles

 /**
  * Функція для пошуку інформації про користувачів
  * 
  * @param array $data Дані для пошуку (шуканий текст)
  */
 public function searchArticles($data)
 {
     /*
      * Оберігаю дані
      */
     $text = strip_tags($data);
     $text = mysql_escape_string($text);
     /*
      * Лайки-шукачі інформації)
      */
     $where = "`text` LIKE '%{$text}%' OR `href` LIKE '%{$text}%' OR `en_text` LIKE '%{$text}%'";
     $u = $this->db->select('bio_gr_articles', '*', $where);
     /** Перевірка присутності результатів * */
     /*
      * Результати відсутні - виводимо відповідне повідомлення
      */
     if ($this->db->getCount() == 0) {
         print '<div class="alert alert-danger"><span class="glyphicon glyphicon-remove-circle"></span>&nbsp;За даним запитом не знайдено нічого</div>';
     } else {
         $users = '<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">';
         $users .= '<ul class="list-group">';
         for ($i = 0; $i < sizeof($u); $i++) {
             $users .= '<li class="list-group-item">';
             $users .= '' . $u[$i]['text'] . '<a href="' . $u[$i]['href'] . '">Link</a>';
             $users .= '</li>';
         }
         $users .= '</ul>';
         $users .= '</div>';
         print $users;
     }
 }
开发者ID:olehpitsun,项目名称:duplom.comv2.2.1,代码行数:36,代码来源:ajaxBiaResearchController.php


示例5: modul

function modul($posisi)
{
    global $koneksi_db, $STYLE_INCLUDE, $SCRIPT_INCLUDE;
    $total = 0;
    $numb = 0;
    if (isset($_GET['pilih'])) {
        $pilih = mysql_escape_string(strip_tags($_GET['pilih']));
        $numb = mysql_num_rows(mysql_query("SELECT `id` FROM `actions` WHERE `modul` = '{$pilih}'"));
        $modulku = mysql_query("SELECT * FROM `actions` LEFT JOIN `modul` ON (`modul`.`id` = `actions`.`modul_id`) WHERE `actions`.`modul` = '{$pilih}' AND `actions`.`posisi` = '{$posisi}' ORDER BY `actions`.`order`");
        $total = mysql_num_rows($modulku);
        while ($viewmoduls = mysql_fetch_assoc($modulku)) {
            if (file_exists($viewmoduls['isi']) && $viewmoduls['type'] == 'module') {
                include $viewmoduls['isi'];
                kotakjudul($viewmoduls['modul'], @$out, '');
                $out = '';
            }
            if ($viewmoduls['type'] == 'block') {
                kotakjudul($viewmoduls['modul'], $viewmoduls['isi'], '');
            }
        }
    }
    if ($total == 0 && $numb == 0) {
        $modulku = $koneksi_db->sql_query("SELECT * FROM modul WHERE published= 1 AND posisi= '{$posisi}' ORDER BY ordering");
        while ($viewmodul = $koneksi_db->sql_fetchrow($modulku)) {
            if (file_exists($viewmodul['isi']) && $viewmodul['type'] == 'module') {
                include $viewmodul['isi'];
                kotakjudul($viewmodul['modul'], @$out, '');
                $out = '';
            }
            if ($viewmodul['type'] == 'block') {
                kotakjudul($viewmodul['modul'], $viewmodul['isi'], '');
            }
        }
    }
}
开发者ID:rekysda,项目名称:naficms,代码行数:35,代码来源:fungsi.php


示例6: login

function login()
{
    global $dbsettings;
    $link = opendb();
    if (isset($_POST["submit"])) {
        $query = doquery("SELECT * FROM {{table}} WHERE username='" . mysql_escape_string($_POST["username"]) . "' AND password='" . md5($_POST["password"]) . "' LIMIT 1", "users");
        if (mysql_num_rows($query) != 1) {
            die("Invalid username or password. Please go back and try again.");
        }
        $row = mysql_fetch_array($query);
        if (isset($_POST["rememberme"])) {
            $expiretime = time() + 31536000;
            $rememberme = 1;
        } else {
            $expiretime = 0;
            $rememberme = 0;
        }
        $cookie = $row["id"] . " " . $row["username"] . " " . md5($row["password"] . "--" . $dbsettings["secretword"]) . " " . $rememberme;
        setcookie("dkgame", $cookie, $expiretime, "/", "", 0);
        header("Location: index.php");
        die;
    }
    $page = gettemplate("login");
    $title = "Log In";
    display($page, $title, false, false, false, false);
}
开发者ID:Choptec,项目名称:dragon-knight,代码行数:26,代码来源:login.php


示例7: clean

function clean($n)
{
    $n = htmlentities($n);
    $n = htmlspecialchars($n);
    $n = mysql_escape_string($n);
    return $n;
}
开发者ID:CaineQT,项目名称:write-ups-2014,代码行数:7,代码来源:header.php


示例8: saveProtype

 public function saveProtype($dataForm, $ptyleId = "")
 {
     global $mySession;
     $db = new Db();
     $data_update['ptyle_name'] = $dataForm['ptyle_name'];
     if ($ptyleId == "") {
         $chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "'");
         if ($chkQry != "" and count($chkQry) > 0) {
             //if Property Type Name is exists than return false / 0
             // No Data Inserted
             return 0;
         } else {
             # If Property Type Name Not Already Exista.
             # Insert New Record Into Database
             $db->save(PROPERTYTYPE, $data_update);
             return 1;
         }
     } else {
         $chkQry = $db->runQuery("select * from " . PROPERTYTYPE . " where ptyle_name='" . mysql_escape_string(trim($dataForm['ptyle_name'])) . "' and ptyle_id!=" . $ptyleId);
         if ($chkQry != "" and count($chkQry) > 0) {
             return 0;
         } else {
             $condition = 'ptyle_id=' . $ptyleId;
             $result = $db->modify(PROPERTYTYPE, $data_update, $condition);
             return 1;
         }
     }
 }
开发者ID:ankuradhey,项目名称:dealtrip,代码行数:28,代码来源:Protype.php


示例9: article_inp

 function article_inp($data)
 {
     $date = date('Y-m-d H:i:s');
     $datetime = array();
     if (!empty($data['postdate'])) {
         $data['postdate'] = date("Y-m-d H:i:s", strtotime($data['postdate']));
     } else {
         $data['postdate'] = $date;
     }
     if (!empty($data['expired_date'])) {
         $data['expired_date'] = date("Y-m-d H:i:s", strtotime($data['expired_date']));
     } else {
         $data['expired_date'] = '0000-00-00';
     }
     $data['title'] = mysql_escape_string($data['title']);
     $data['brief'] = mysql_escape_string($data['brief']);
     $data['content'] = mysql_escape_string($data['content']);
     if ($data['action'] == 'insert') {
         $query = "INSERT INTO  \n\t\t\t\t\t\t{$this->prefix}_news_content (title,brief,content,image,file,categoryid,articletype,\n\t\t\t\t\t\t\t\t\t\t\t\tcreated_date,posted_date,expired_date,authorid,n_status)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $data['title'] . "','" . $data['brief'] . "','" . $data['content'] . "','" . $data['image'] . "'\n                        ,'" . $data['image_url'] . "','" . $data['categoryid'] . "','" . $data['articletype'] . "','" . $date . "'\n                        ,'" . $data['postdate'] . "','" . $data['expired_date'] . "','" . $data['authorid'] . "','" . $data['n_status'] . "')";
         //pr($query);exit;
     } else {
         if ($data['categoryid'] == '1' && $data['articletype'] == '2' || $data['categoryid'] == '8') {
             $date = $data['postdate'];
         }
         $query = "UPDATE {$this->prefix}_news_content\n\t\t\t\t\t\tSET \n\t\t\t\t\t\t\ttitle = '{$data['title']}',\n\t\t\t\t\t\t\tbrief = '{$data['brief']}',\n\t\t\t\t\t\t\tcontent = '{$data['content']}',\n\t\t\t\t\t\t\timage = '{$data['image']}',\n\t\t\t\t\t\t\tfile = '{$data['image_url']}',\n                            articletype = '{$data['articletype']}',\n\t\t\t\t\t\t\tposted_date = '{$data['postdate']}',\n                            expired_date = '{$data['expired_date']}',\n\t\t\t\t\t\t\tauthorid = '{$data['authorid']}',\n\t\t\t\t\t\t\tn_status = {$data['n_status']}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tid = '{$data['id']}'";
     }
     // pr($query);
     $result = $this->query($query);
     return $result;
 }
开发者ID:Gunadarma-Codecamp,项目名称:peer-portal,代码行数:30,代码来源:msite.php


示例10: ViewLog

function ViewLog()
{
    global $db_host, $db_user, $db_pass, $db_name;
    global $total, $page, $size, $view_size;
    global $server_count_info, $server_from_info, $server_select_info, $server_where_info, $server_order_info;
    $page = intval($_GET["page"]);
    $code = $_GET["code"];
    $Conn = mysql_connect($db_host, $db_user, $db_pass);
    mysql_query("SET NAMES 'GBK'");
    mysql_select_db($db_name, $Conn);
    $code = mysql_escape_string($code);
    $qs = "{$server_count_info} {$server_from_info} {$server_where_info} and li.error_code = '{$code}'";
    $result = mysql_query($qs);
    $row = mysql_fetch_row($result);
    $total = intval($row[0]);
    $b = $page * $size - $size;
    $e = $size;
    printf("<p>查询条件是错误码: <b>{$code}</b><p>");
    $qs = "{$server_select_info} {$server_from_info} {$server_where_info} and li.error_code = '{$code}' order by happened_time desc limit {$b}, {$e}";
    $result = mysql_query($qs);
    $content = array();
    while ($row = mysql_fetch_row($result)) {
        $content[count($content)] = $row;
    }
    printf(GetServerLogHTML($content));
}
开发者ID:svn2github,项目名称:ybtx,代码行数:26,代码来源:list_by_code_s.php


示例11: esc_str

 }
 private function esc_str($val)
 {
     if ($val == '') {
         return 'NULL';
     }
     return "'" . mysql_escape_string($val) . "'";
开发者ID:geknuepft,项目名称:db_tool,代码行数:7,代码来源:article_conv.php


示例12: getSuggestions

function getSuggestions($keyword)
{
    DbConnect();
    $patterns = array('/\\s+/', '/"+/', '/%+/');
    $replace = array('');
    $keyword = preg_replace($patterns, $replace, $keyword);
    if ($keyword != '' and preg_match('/^[ _a-zà-ÿA-ZÀ-ß0-9]*$/i', $keyword)) {
        $keyword = mysql_escape_string($keyword);
        $query = "SELECT name FROM game_items_factsheet WHERE name LIKE '" . $keyword . "%' ORDER BY BINARY name";
    } else {
        $query = "SELECT name FROM game_items_factsheet WHERE name=''";
    }
    $result = myquery($query);
    $output = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
    $output .= '<response>';
    if ($result != false) {
        if (mysql_num_rows($result)) {
            while ($row = mysql_fetch_array($result)) {
                $output .= '<name>' . iconv("Windows-1251", "UTF-8//IGNORE", $row['name']) . '</name>';
            }
        }
    }
    $output .= '</response>';
    mysql_close();
    return $output;
}
开发者ID:themiddleearth,项目名称:RPG.SU,代码行数:26,代码来源:suggest_items.php


示例13: getNotices

 function getNotices()
 {
     // @fixme there should be a common func for this
     if (common_config('db', 'type') == 'pgsql') {
         if (!empty($this->out->tag)) {
             $tag = pg_escape_string($this->out->tag);
         }
     } else {
         if (!empty($this->out->tag)) {
             $tag = mysql_escape_string($this->out->tag);
         }
     }
     $weightexpr = common_sql_weight('fave.modified', common_config('popular', 'dropoff'));
     $cutoff = sprintf("fave.modified > '%s'", common_sql_date(time() - common_config('popular', 'cutoff')));
     $qry = "SELECT notice.*, {$weightexpr} as weight ";
     if (isset($tag)) {
         $qry .= 'FROM notice_tag, notice JOIN fave ON notice.id = fave.notice_id ' . "WHERE {$cutoff} and notice.id = notice_tag.notice_id and '{$tag}' = notice_tag.tag";
     } else {
         $qry .= 'FROM notice JOIN fave ON notice.id = fave.notice_id ' . "WHERE {$cutoff}";
     }
     $qry .= ' GROUP BY notice.id,notice.profile_id,notice.content,notice.uri,' . 'notice.rendered,notice.url,notice.created,notice.modified,' . 'notice.reply_to,notice.is_local,notice.source,notice.conversation, ' . 'notice.lat,notice.lon,location_id,location_ns,notice.repeat_of' . ' ORDER BY weight DESC';
     $offset = 0;
     $limit = NOTICES_PER_SECTION + 1;
     $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
     $notice = Memcached_DataObject::cachedQuery('Notice', $qry, 1200);
     return $notice;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:27,代码来源:popularnoticesection.php


示例14: newCmtFormHlr

 function newCmtFormHlr($author = false, $email = false, $author_id = false, $article_id = false, $content = false, $date = false)
 {
     if ($content == false) {
         $content = $_REQUEST['comment_text'];
     }
     if ($article_id == false) {
         $article_id = $_REQUEST['id'];
     }
     $reg = Registry::instance();
     $_hinfo = $reg->get('hamster_info');
     $login_status = $reg->get('login_status');
     if ($login_status == 3) {
         $author = mysql_escape_string(htmlspecialchars($_hinfo['name']));
         $email = '';
         $author_id = intval($_hinfo['id']);
         if ($_REQUEST['comment_text'] == '') {
             return array();
         }
         require_once 'lib/markdown/markdown.php';
         $content = Markdown(strip_tags($content));
     } else {
         $content = '<p>' . htmlspecialchars($content) . '</p>';
         $email = mysql_escape_string(htmlspecialchars($_REQUEST['comment_email']));
         if ($_REQUEST['comment_name'] != '' && $name == false) {
             $author = mysql_escape_string(htmlspecialchars($_REQUEST['comment_name']));
         } else {
             $author = 'НЛО';
         }
         if (strpos($_REQUEST['comment_text'], 'http://') !== false || $_REQUEST['comment_text'] == '' || $_REQUEST['comment_sid'] != $_SESSION['comment_sid'] || !isset($_SESSION['comment_sid']) || time() - $_SESSION['comment_stamp'] < 2) {
             return array();
         }
     }
     $prs = array('author' => $author, 'email' => $email, 'author_id' => $author_id, 'article_id' => intval($article_id), 'content' => mysql_escape_string($content), 'date' => local2gm());
     return $prs;
 }
开发者ID:noisywiz,项目名称:tractor,代码行数:35,代码来源:view.php


示例15: _get_query_order

 protected function _get_query_order($key, $value)
 {
     /**
      * 	Returns an ORDER BY argument, given an argument from the query string.
      *
      * 	The return value of this function goes right after an 'ORDER BY', so it
      * 	might be 'b.reporter ASC' or 'u.date_created DESC'.
      *
      * 	@param $key - The resource attribute on which the request says to sort.  For
      * 		example, if the QS parameter is 'sort-reporter', $key here will be
      * 		'reporter'.
      * 	@param $value - The sense of the sort; 1 for ascending, -1 for descending.
      */
     if ($key == 'reporter') {
         $key .= '_id';
     } elseif ($key == 'private') {
         $key = 'view_state';
     } elseif ($key == 'date_submitted' || $key == 'last_modified') {
         $key = mysql_escape_string($key);
     } else {
         throw new HTTPException(500, "Can't sort bugnotes by attribute '{$key}'");
     }
     $sql = "n.{$key}";
     if ($value == 1) {
         $sql .= ' ASC';
     } elseif ($value == -1) {
         $sql .= ' DESC';
     }
     return $sql;
 }
开发者ID:NetWielder,项目名称:mantis-rest,代码行数:30,代码来源:bugnotelist.class.php


示例16: GetSQLValueString

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
    switch ($theType) {
        case "text":
            $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
            break;
        case "long":
        case "int":
            $theValue = $theValue != "" ? intval($theValue) : "NULL";
            break;
        case "double":
            $theValue = $theValue != "" ? "'" . doubleval($theValue) . "'" : "NULL";
            break;
        case "date":
            $theValue = $theValue != "" ? "'" . date("Y-m-d", strtotime($theValue)) . "'" : "NULL";
            break;
        case "time":
            $theValue = $theValue != "" ? "'" . date("H:i:s", strtotime($theValue)) . "'" : "NULL";
            break;
        case "datetime":
            $theValue = $theValue != "" ? "'" . date("Y-m-d H:i:s", strtotime($theValue)) . "'" : "NULL";
            break;
        case "defined":
            $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
            break;
    }
    return $theValue;
}
开发者ID:duratechsolutions,项目名称:dquickfix_crm,代码行数:29,代码来源:issue_info_sale.php


示例17: login

function login()
{
    $username = $_POST['username'];
    //防sql注入语句
    //第一种方法:addslashes():使用反斜线引用特殊字符
    //$username=addslashes($username);
    //第二种方法:mysql_escape_string():转换一个字符串,用于mysql_query
    $username = mysql_escape_string($username);
    $password = md5($_POST['password']);
    $sql = "select * from imooc_user where username='{$username}' and password='{$password}'";
    /*以下语句打印出的sql语句,看出恶意攻击的sql注入
    	//如有人在账户名中输入“ ' or 1=1 # ”
    	//这段代码,那语句会变成select * from imooc_user where username='‘ or 1 = 1 #' and password='d41d8cd98f00b204e9800998ecf8427e'
    	//那等于用户名为空或者1=1的sql语句,这句永远为空,则返回ture,那根据下面语句,就会直接登录
    	//echo $sql;exit;
    	*/
    //$resNum=getResultNum($sql);
    $row = fetchOne($sql);
    //echo $resNum;
    if ($row) {
        $_SESSION['loginFlag'] = $row['id'];
        $_SESSION['username'] = $row['username'];
        $mes = "登陆成功!<br/>3秒钟后跳转到首页<meta http-equiv='refresh' content='3;url=index.php'/>";
    } else {
        $mes = "登陆失败!<a href='login.php'>重新登陆</a>";
    }
    return $mes;
}
开发者ID:juststart2015,项目名称:Electronic-commerce-system,代码行数:28,代码来源:user.inc.php


示例18: error

 function error($message, $title)
 {
     global $link, $game_config;
     if ($game_config['debug'] == 1) {
         echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>";
         echo "<table>" . $this->log . "</table>";
     }
     //else{
     //A futuro, se creara una tabla especial, para almacenar
     //los errores que ocurran.
     global $user, $xnova_root_path, $phpEx;
     include $xnova_root_path . 'config.' . $phpEx;
     if (!$link) {
         die('mySQL no esta disponible por el momento, sentimos el inconveniente...');
     }
     $query = "INSERT INTO {{table}} SET\n\t\t\t\t`error_sender` = '{$user['id']}' ,\n\t\t\t\t`error_time` = '" . time() . "' ,\n\t\t\t\t`error_type` = '{$title}' ,\n\t\t\t\t`error_text` = '" . mysql_escape_string($message) . "' ,\n\t\t\t\t`error_page` = '" . mysql_escape_string($_SERVER['HTTP_REFERER']) . "';";
     $sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . 'errors', $query)) or die('error fatal');
     $query = "explain select * from {{table}}";
     $q = mysql_fetch_array(mysql_query(str_replace("{{table}}", $dbsettings["prefix"] . 'errors', $query))) or die('error fatal: ');
     if (!function_exists('message')) {
         echo "Fehler, bitte den Fehler dem Administrator melden. Fehler n°: <b>" . $q['rows'] . "</b>";
     } else {
         message("Fehler, bitte den Fehler dem Administrator melden. Fehler n°: <b>" . $q['rows'] . "</b>", "Erreur");
     }
     //}
     die;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:27,代码来源:debug.class.php


示例19: execute

 function execute($array = array())
 {
     if (count($this->__boundParams) > 0) {
         $array =& $this->__boundParams;
     }
     $__query = $this->__query;
     if (count($array) > 0) {
         foreach ($array as $k => $v) {
             if (!is_int($k) || substr($k, 0, 1) === ':') {
                 if (!isset($tempf)) {
                     $tempf = $tempr = array();
                 }
                 array_push($tempf, $k);
                 array_push($tempr, '"' . mysql_escape_string($v) . '"');
             } else {
                 $parse = create_function('$v', 'return \'"\'.mysql_escape_string($v).\'"\';');
                 $__query = preg_replace("/(\\?)/e", '$parse($array[$k++]);', $__query);
                 break;
             }
         }
         if (isset($tempf)) {
             foreach ($tempf as $k => $v) {
                 $search[$k] = '/' . preg_quote($tempf[$k], '`') . '\\b/';
             }
             $__query = preg_replace($search, $tempr, $__query);
         }
     }
     if (is_null($this->__result =& $this->__uquery($__query))) {
         $keyvars = false;
     } else {
         $keyvars = true;
     }
     $this->__boundParams = array();
     return $keyvars;
 }
开发者ID:ChainBoy,项目名称:wxfx,代码行数:35,代码来源:PDOStatement_mysql.class.php


示例20: action

 function action()
 {
     $imie = mysql_escape_string($_REQUEST['imie']);
     $nazwisko = mysql_escape_string($_REQUEST['nazwisko']);
     $pesel = mysql_escape_string($_REQUEST['pesel']);
     $adres = mysql_escape_string($_REQUEST['adres']);
     $miasto = mysql_escape_string($_REQUEST['miasto']);
     $kod = mysql_escape_string($_REQUEST['kod']);
     $dl_prenum = mysql_escape_string($_REQUEST['dl_prenum']);
     $today = date('Y-m-d');
     $datapom = explode("-", $today);
     $miesiac_waznosci = $datapom[1] + $dl_prenum;
     $rok_waznosci = $datapom[0];
     if ($miesiac_waznosci > 12) {
         $miesiac_waznosci = $miesiac_waznosci - 12;
         $rok_waznosci = $rok_waznosci + 1;
     }
     $data_waznosci = $rok_waznosci . "-" . $miesiac_waznosci . "-" . $datapom[2];
     $tablica = array("imie_prenum" => $imie, "nazwisko_prenum" => $nazwisko, "pesel_prenum" => $pesel, "adres_prenum" => $adres, "miasto_prenum" => $miasto, "kod_prenum" => $kod, "data_wpisu" => $today, "data_waznosci" => $data_waznosci, "status_prenum" => 1);
     var_dump($tablica);
     $this->getDb()->insert("prenumerator", $tablica);
     $prenum = $this->getDb()->fetchAll("select * from prenumerator");
     $view = $this->getView();
     $view->assign("klienci", $prenum);
     $view->display("prenum.tpl");
 }
开发者ID:graniasty,项目名称:prenumerator,代码行数:26,代码来源:ControllerAddNewPrenum.php



注:本文中的mysql_escape_string函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysql_escape_string2函数代码示例发布时间:2022-05-15
下一篇:
PHP mysql_escape_String函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap