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

PHP mysql_fix_string函数代码示例

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

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



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

示例1: setVariable

function setVariable($string, $myQuery)
{
    (string) ($variable = "");
    $newString = "'" . $string . "'";
    if (isset($_POST[$string])) {
        $variable = mysql_fix_string($_POST[$string]);
    } else {
        return $myQuery;
    }
    $myQuery = $myQuery . ',' . $string . "='" . $variable . "'";
    return $myQuery;
}
开发者ID:billyham,项目名称:NWFF_Portal,代码行数:12,代码来源:submit_template.php


示例2: user_is_admin

function user_is_admin($conn, $username)
{
    $username = mysql_fix_string($conn, $username);
    $query = "select usertype from users where username='{$username}'";
    $result = $conn->query($query);
    if (!$result) {
        die($conn->error);
    }
    $result->data_seek(0);
    $row = $result->fetch_array(MYSQLI_ASSOC);
    if ($row['usertype'] == 'admin') {
        return true;
    } else {
        return false;
    }
    return true;
}
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:17,代码来源:sql_functions.php


示例3: mysql_select_db

}
mysql_select_db($db_database) or die("Unable to select database; " . mysql_error());
require_once 'submit_template.php';
//
//if (isset($_POST['key_id'])) {
//    $key_id = $_POST['key_id'];
//} else {
//    $key_id = "";
//}
if (isset($_POST['applicant_email'])) {
    $email = mysql_fix_string($_POST['applicant_email']);
} else {
    $email = "(undefined)";
}
if (isset($_POST['title'])) {
    $title = mysql_fix_string($_POST['title']);
} else {
    $title = "(undefined)";
}
//Enter into Database
$query = "insert into billyx_portal.fiscal(\n\t\tapplicant_email,\n                title\n        )\n\tvalues(\n\t\t'{$email}',\n                '{$title}'\n        )";
$result = mysql_query($query);
//look up item applicant key_id and assign to a variable.
$key_id = mysql_insert_id();
//       echo 'line id is'.$lineid;
if (!$result) {
    die("Database access failed: " . mysql_error());
}
mysql_close($db_server);
session_start();
$_SESSION['key_id'] = $key_id;
开发者ID:billyham,项目名称:NWFF_Portal,代码行数:31,代码来源:fiscalsponsorshipappbeginsubmit.php


示例4: mysql_fix_string

<?php

//sanitise.php
//How to safely access MySQL with user input.
$user = mysql_fix_string($_POST['user']);
$pass = mysql_fix_string($_POST['pass']);
$query = "SELECT * FROM users WHERE user='{$user}' AND pass='{$pass}'";
function mysql_fix_string($string)
{
    if (get_magic_quotes_gpc()) {
        $string = stripslashes($string);
    }
    return mysql_real_escape_string($string);
}
开发者ID:robinrob,项目名称:php,代码行数:14,代码来源:sanitise.php


示例5: delete_single_question

function delete_single_question($examID, $questionID, $questionType)
{
    $userID = (int) $_SESSION['userID'];
    $questionID = (int) $questionID;
    $conn = get_conn();
    $userID = mysql_fix_string($conn, $userID);
    $questionID = mysql_fix_string($conn, $questionID);
    $questionType = mysql_fix_string($conn, $questionType);
    $query = "DELETE FROM {$questionType} WHERE questionID={$questionID}";
    if (!$conn->query($query)) {
        die(__LINE__ . " " . $conn->error);
    }
    $query = "DELETE FROM questions WHERE userID={$userID} AND questionID={$questionID}";
    if (!$conn->query($query)) {
        die(__LINE__ . " " . $conn->error);
    }
    $conn->close();
}
开发者ID:alexanderpugh,项目名称:exam-simulator,代码行数:18,代码来源:sql_functions.php


示例6: session_start

<?php

// checks if the question being entered is unique
session_start();
require_once "../functions/session_functions.php";
require_once "../functions/input.php";
require_once "../functions/sql_functions.php";
if (isset($_POST['question']) && logged_in()) {
    $conn = get_conn();
    $question = mysql_fix_string($conn, $_POST['question']);
    $query = "select question from questions where question='{$question}'";
    $result = $conn->query($query);
    $rows = $result->num_rows;
    $conn->close();
    if ($rows) {
        echo "<li>The question that you created already exists. Consider rewriting the question or contributing to the question that already exists.</li>";
    } else {
        echo "";
    }
} else {
    go_home();
}
// go back to the home page
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:23,代码来源:create_handle_ajax.php


示例7: mysql_fix_string

} else {
    $last_name = "(undefined)";
}
if (isset($_POST['uetemp'])) {
    $uetemp = $_POST['uetemp'];
} else {
    $uetemp = "(undefined)";
}
if (isset($_POST['pwtemp'])) {
    $pwtemp = $_POST['pwtemp'];
} else {
    $pwtemp = "(undefined)";
}
//sanitize imported variables
$first_name = mysql_fix_string($first_name);
$last_name = mysql_fix_string($last_name);
//$uetemp = mysql_fix_string($uetemp);
//$pwtemp = mysql_fix_string($pwtemp);
require_once 'loginindex.php';
//Enter into Database
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) {
    die("Unable to connecto to MySQL: " . mysql_error());
}
mysql_select_db($db_database) or die("Unable to select database; " . mysql_error());
$query = "insert into filmfund.applicant (\n\t\tfname,\n\t\tlname,\n\t\temail,\n\t\tuserpass\n\t\t)\n\tvalues(\n\t\t'{$firstname}',\n\t\t'{$lastname}',\n\t\t'{$email}',\n\t\t'{$userpass}'\n\t)";
$result = mysql_query($query);
//look up item applicant key_id and assign to a variable. Just in case.
$app_key = mysql_insert_id();
//echo 'line id is'.$lineid;
if (!$result) {
开发者ID:billyham,项目名称:NWFF_Portal,代码行数:31,代码来源:indexretrievecreatelogin.php


示例8: mysql_entities_fix_string

/**
 * @param $connection
 * @param $var
 * @return string
 */
function mysql_entities_fix_string($connection, $var)
{
    return htmlentities(mysql_fix_string($connection, $var));
}
开发者ID:ViktorGuschin,项目名称:learn,代码行数:9,代码来源:login.php


示例9: test_input

     $emailflag = FALSE;
 } else {
     $email = test_input($_POST["email"]);
     // check if e-mail address syntax is valid
     if (!preg_match("/([\\w\\-]+\\@[\\w\\-]+\\.[\\w\\-]+)/", $email)) {
         $emailErr = "Invalid email format";
         $emailflag = FALSE;
     }
 }
 //echo $email;
 if (empty($_POST["address"])) {
     $addressErr = "Address is required";
     $addressflag = FALSE;
 } else {
     $address = test_input($_POST["address"]);
     $address = mysql_fix_string($address);
 }
 //echo $address;
 if (empty($_POST["gender"])) {
     $genderErr = "Gender is required";
     $genderflag = FALSE;
 } else {
     $gender = test_input($_POST["gender"]);
 }
 //echo $gender;
 //if($_FILES['file']['name'])
 //{
 //echo "before uploadphotos<br/>";
 //$uploadstatus=uploadphoto("photos/",$uname);
 //}
 /****************************************************/
开发者ID:vasuprada,项目名称:PHP-Repo,代码行数:31,代码来源:validate_registration.php


示例10: edit_task

function edit_task($task, $last_edit, $taskID, $userID)
{
    $conn = get_conn();
    $userID = (int) mysql_fix_string($conn, $userID);
    $task = mysql_fix_string($conn, $task);
    $last_edit = mysql_fix_string($conn, $last_edit);
    $taskID = (int) mysql_fix_string($conn, $taskID);
    $query = "UPDATE ajx_org_todo \n\t\t\t  SET task='{$task}', last_edited='{$last_edit}'\n\t\t\t  WHERE userID={$userID} AND taskID={$taskID}";
    get_result($conn, $query);
    $conn->close();
}
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:11,代码来源:sql-functions.php


示例11: mysql_connect

    }
    return $hash;
}
include 'login.php';
$submit_message = "";
if (isset($_POST['submit'])) {
    //require_once 'login.php';
    $db_server = mysql_connect($db_hostname, $db_username, $db_password);
    if (!$db_server) {
        die("Unable to connect to MySQL: " . mysql_error());
    }
    mysql_select_db($db_database) or die("Unable to select database: " . mysql_error());
    if (rpHash($_POST['defaultReal']) == $_POST['defaultRealHash']) {
        $first_name = mysql_fix_string($_POST['first']);
        $last_name = mysql_fix_string($_POST['last']);
        $testimonial = mysql_fix_string($_POST['add']);
        $query = "INSERT INTO testimonials_submission VALUES ('" . $first_name . "','" . $last_name . "','" . $testimonial . "', CURDATE() )";
        //$query = "INSERT INTO testimonials_submission VALUES ('" . $first_name . "','" .
        //		 $last_name . "','" . $testimonial . "')";
        //echo $query;
        $testimonials = mysql_query($query);
        if (!$testimonials) {
            die("Database access failed: " . mysql_error());
        }
        // the message
        $msg = "Testimonial Submission at LasColinasObGyn.com";
        // use wordwrap() if lines are longer than 70 characters
        $msg = wordwrap($msg, 70);
        // send email
        mail("[email protected]", "Testimonial", $msg);
        $submit_message = '<p style="color:blue;">Your testimonial has been submitted successfully.</p>';
开发者ID:jobw0110,项目名称:lascolinasobgyn,代码行数:31,代码来源:testimonials.php


示例12: mysql_connect

    }
    return $hash;
}
$submit_message = "";
if (isset($_POST['submit'])) {
    //print_r($_POST);
    require_once 'login.php';
    $db_server = mysql_connect($db_hostname, $db_username, $db_password);
    if (!$db_server) {
        die("Unable to connect to MySQL: " . mysql_error());
    }
    mysql_select_db($db_database) or die("Unable to select database: " . mysql_error());
    if (rpHash($_POST['defaultReal']) == $_POST['defaultRealHash']) {
        $name = mysql_fix_string($_POST['name']);
        $email = mysql_fix_string($_POST['email']);
        $message = mysql_fix_string($_POST['message']);
        $query = "INSERT INTO contact VALUES('" . $name . "','" . $email . "','" . $message . "', CURDATE() )";
        //$query = "INSERT INTO contact VALUES('" . $name . "','" . $email . "','" . $message . "')";
        //echo $query;
        $result = mysql_query($query);
        if (!$result) {
            die("Database access failed: " . mysql_error());
        }
        // the message
        //$msg = "Contact Form Submission at LasColinasObGyn.com";
        // use wordwrap() if lines are longer than 70 characters
        $msg = wordwrap($msg, 70);
        // send email
        mail("[email protected]", "Contact Form", $message);
        $submit_message = '<p style="color:blue;">Submitted Successfully</p>';
    } else {
开发者ID:jobw0110,项目名称:lascolinasobgyn,代码行数:31,代码来源:contact.php


示例13: session_start

<?php

// checks if information given is in correct format and that it matches
session_start();
require_once "../functions/session_functions.php";
require_once "../functions/input.php";
require_once "../functions/sql_functions.php";
if (isset($_POST['username']) && isset($_POST['password'])) {
    $conn = get_conn();
    $username = mysql_fix_string($conn, $_POST['username']);
    $password = mysql_fix_string($conn, $_POST['password']);
    $password = encrypt_password($password);
    $query = "select username from users where username='{$username}' and password='{$password}'";
    $result = $conn->query($query);
    $rows = $result->num_rows;
    $conn->close();
    if (!$rows) {
        echo "<li>The details that you have provided are incorrect.</li>";
    } else {
        echo "";
    }
} else {
    fail();
}
// go back to login page
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:25,代码来源:login_handle_ajax.php


示例14: session_start

<?php

session_start();
require_once '../file-includes.php';
header('Access-Control-Allow-Origin: *');
header('Content-Type: application:json; charset=UTF-8');
$conn = get_conn();
$userID = (int) get_userID_session();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$contactID = (int) mysql_fix_string($conn, $request->contact);
$result = get_result($conn, "SELECT * FROM ajx_org_address_book WHERE userID={$userID} AND contactID={$contactID}");
if ($result->num_rows) {
    $return_data = json_encode($result->fetch_array(MYSQLI_ASSOC), TRUE);
    $conn->close();
    echo $return_data;
}
开发者ID:alexanderpugh,项目名称:Ajax-Organiser,代码行数:17,代码来源:get-contact.php


示例15: set_categories

 public function set_categories($categories)
 {
     foreach ($categories as $category) {
         $this->_categories[] = mysql_fix_string($this->_conn, $category);
     }
 }
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:6,代码来源:question_insert.php


示例16: session_start

<?php

session_start();
require_once "../functions/session_functions.php";
require_once "../functions/input.php";
require_once "../functions/sql_functions.php";
if (isset($_POST['username']) && isset($_POST['email'])) {
    $conn = get_conn();
    $username = mysql_fix_string($conn, $_POST['username']);
    $email = mysql_fix_string($conn, $_POST['email']);
    // check that username is unique
    $query = "select username from users where username='{$username}'";
    $result = $conn->query($query);
    $rows = $result->num_rows;
    $message = "";
    if ($rows) {
        $message .= "<li>The username that you have chosen already exists.</li>";
    }
    // check that emailaddress is unique
    $query = "select emailaddress from users where emailaddress='{$email}'";
    $result = $conn->query($query);
    $rows = $result->num_rows;
    if ($rows) {
        $message .= "<li>The email address that you have chosen already belongs to a user.</li>";
    }
    echo $message;
} else {
    fail();
}
// go back to login page
开发者ID:alexanderpugh,项目名称:polling-questions,代码行数:30,代码来源:register_handle_ajax.php


示例17: mysql_entities_fix_string

function mysql_entities_fix_string($conn, $string)
{
    return htmlentities(mysql_fix_string($conn, $string));
}
开发者ID:Truelj,项目名称:Start_web,代码行数:4,代码来源:preventInjectionAttacks.php


示例18: sanitizeString

function sanitizeString($var)
{
    $var = stripslashes($var);
    $var = htmlentities($var);
    $var = strip_tags($var);
    return $var;
}
function mysql_fix_string($string)
{
    if (get_magic_quotes_gpc()) {
        $string = stripslashes($string);
    }
    return mysql_real_escape_string($string);
}
$uetemp = mysql_fix_string($uetemp);
$pwtemp = mysql_fix_string($pwtemp);
$userpass_check = null;
if ($pwtemp == "") {
    header("Location: loginerror.php");
}
//Check Database
require_once 'loginindex.php';
//login to mysql
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) {
    die("Unable to connecto to MySQL: " . mysql_error());
}
mysql_select_db($db_database) or die("Unable to select database; " . mysql_error());
$query = "select * from applicant where email='{$uetemp}'";
$result = mysql_query($query);
if (!$result) {
开发者ID:billyham,项目名称:NWFF_Portal,代码行数:31,代码来源:indexretrieve.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mysql_format_date函数代码示例发布时间:2022-05-15
下一篇:
PHP mysql_field_type函数代码示例发布时间: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