当前位置: 首页>>代码示例>>PHP>>正文


PHP DB_CONNECT::mysql_prep方法代码示例

本文整理汇总了PHP中DB_CONNECT::mysql_prep方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_CONNECT::mysql_prep方法的具体用法?PHP DB_CONNECT::mysql_prep怎么用?PHP DB_CONNECT::mysql_prep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB_CONNECT的用法示例。


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

示例1:

<?php

require_once "../includes/db_connect.php";
require_once "../includes/functions.php";
require_once "../includes/session.php";
require_once "utils/question.php";
require_once "utils/user.php";
confirm_logged_in();
if (isset($_POST["submit"])) {
    $db = new DB_CONNECT();
    // get username from the session
    $username = get_username();
    if (check_is_set($_POST)) {
        if (check_empty($_POST)) {
            $test_name = $db->mysql_prep($_POST["test_name"]);
            $start_time = make_sql_date_time($_POST["start_time"], "/");
            $end_time = make_sql_date_time($_POST["end_time"], "/");
            $event_date = $db->mysql_prep($_POST["event_date"]);
            $duration = $db->mysql_prep($_POST["duration"]);
            $query = "UPDATE test SET test_name='{$test_name}', username='{$username}',start_time='{$start_time}',\n                 end_time='{$end_time}',event_date='{$event_date}',duration='{$duration}' WHERE test_name='{$test_name}' ";
            $result = $db->query_database($query);
            if (is_null($result)) {
                // query failed
                echo "query failed";
            } else {
                redirect_to("question_list.php?test_name=" . get_test_name());
            }
        } else {
            echo "empty fields";
        }
    } else {
开发者ID:abhik-setia,项目名称:MCQTECHNO,代码行数:31,代码来源:edit_test_details.php

示例2: trim

<?php

require_once "/includes/session.php";
require_once "/includes/db_connect.php";
require_once "/includes/functions.php";
$db = new DB_CONNECT();
$message = "";
// check and submit the user request for the access of the page
if (isset($_POST["submit"])) {
    $user_id = trim($db->mysql_prep($_POST["username"]));
    $password = trim($db->mysql_prep($_POST["password"]));
    $hashed_password = sha1($password);
    // for the hashing of the password
    $queryString = "SELECT * FROM adminUser WHERE username='{$user_id}' && password='{$hashed_password}' ";
    $result = $db->query_db($queryString);
    if ($db->number_of_rows($result) > 0) {
        $_SESSION["username"] = $user_id;
        redirect_to("firstpage.php");
    } else {
        $message = "Passowrd and Username combination is wrong";
    }
}
?>
<html lang="en" class="no-js">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>DISASTER SAFETY</title>
  <link rel="stylesheet" type="text/css" href="stylesheets/demo.css">
  <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
  <link rel="stylesheet" type="text/css" href="stylesheets/animate-custom.css">
</head>
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:31,代码来源:index.php

示例3: array

<?php

// including the some files
require_once "includes/db_connect.php";
require_once "includes/functions.php";
// making the object of DB
// response array for the JSON
$response = array();
$db = new DB_CONNECT();
if (isset($_POST["member_id"]) && isset($_POST["famliy_id"])) {
    // removing extra space and sql injections
    $member_id = trim($db->mysql_prep($_POST["member_id"]));
    $family_id = trim($db->mysql_prep($_POST["family_id"]));
    if (is_present($family_id)) {
        $query_string = "INSERT INTO people (member_id , family_id) VAlUES('{$member_id}' , '{$family_id}')";
        $result = $db->query_db($query_string);
        if ($result) {
            $response["success"] = 1;
            $response["message"] = "The family member is added in the list.";
        } else {
            $response["success"] = 0;
            $response["message"] = "The family member is not added in the database ";
        }
    } else {
        $response["success"] = 0;
        $response["message"] = "The family member is not registered...";
    }
} else {
    $response["success"] = 0;
    $response["message"] = "The contact number and the name is not set";
}
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:31,代码来源:people.php

示例4: trim

<?php

require_once "/includes/session.php";
require_once "/includes/db_connect.php";
require_once "/includes/functions.php";
confirm_logged_in();
$db = new DB_CONNECT();
if (isset($_POST["calamity"]) && isset($_POST["before_cal"]) && isset($_POST["after_cal"]) && isset($_POST["during_cal"])) {
    $calamity = trim($db->mysql_prep($_POST["calamity"]));
    $before_cal = trim($db->mysql_prep($_POST["before_cal"]));
    $after_cal = trim($db->mysql_prep($_POST["after_cal"]));
    $during_cal = trim($db->mysql_prep($_POST["during_cal"]));
    if (strlen($calamity) != 0 && strlen($before_cal) && strlen($after_cal) && strlen($during_cal)) {
        $queryString = "INSERT INTO guidelines ( calamity , during_cal, after_cal , before_cal ) VALUES( '{$calamity}','{$during_cal}','{$after_cal}' ,'{$before_cal}') ";
        echo $queryString;
        $result = $db->query_db($queryString);
        if ($result) {
            //$_POST["message"] = "Inserted to the database";
            redirect_to("guidelines.php?message=Inserted to the database");
        } else {
            echo "Cannot be inserted";
        }
    } else {
        redirect_to("guidelines.php?message=Cannot be inserted. Some Values are Missing");
    }
} else {
    echo "Problem in the post request";
}
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:28,代码来源:guidelinesToDataBase.php

示例5: trim

<?php

require_once "/includes/db_connect.php";
require_once "/includes/functions.php";
require_once "/includes/session.php";
confirm_logged_in();
$db = new DB_CONNECT();
if (isset($_POST["info"]) && isset($_POST["notification"]) && isset($_POST["date"])) {
    $info = trim($db->mysql_prep($_POST["info"]));
    $notification = trim($db->mysql_prep($_POST["notification"]));
    $date = trim($db->mysql_prep($_POST["info"]));
    $queryString = "INSERT INTO news ( info , date , notification ) VALUES( '{$info}','{$date}' , '{$notification}') ";
    $result = $db->query_db($queryString);
    if ($result) {
        //$_POST["message"] = "Inserted to the database";
        redirect_to("newsupdate.php?message=Inserted to the database");
    } else {
        echo "Cannot be inserted";
    }
} else {
    echo "Problem in the post request";
}
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:22,代码来源:newsUpdateToDataBase.php

示例6: array

<?php

// including the some files
require_once "includes/db_connect.php";
require_once "GCM.php";
// making the object of DB
// response array for the JSON
$response = array();
$db = new DB_CONNECT();
$gcm = new GCM();
if (isset($_POST["id"]) && isset($_POST["name"]) && isset($_POST["regId"])) {
    // removing the sql injections and extra space after the text
    $id = trim($db->mysql_prep($_POST["id"]));
    $name = trim($db->mysql_prep($_POST["name"]));
    $regId = trim($db->mysql_prep($_POST["regId"]));
    // Check if the contact is already there or not
    // We can reduce two queries to DB but to make it simple i have used 2 queries
    $query_string = "SELECT * from login where id='{$id}'";
    $result = $db->query_db($query_string);
    if (!($db->number_of_rows($result) > 0)) {
        // insertion is successfully
        $query_string = "INSERT INTO login (id,name,gcm_regId) VALUES('{$id}','{$name}','{$regId}')";
        $result = $db->query_db($query_string);
        $response["success"] = 1;
        $response["message"] = "The user is successfully registered";
        $response["status"] = 1;
        // now do the work of the GCM
        /*$registatoin_ids = array($regId);
        		$message = array("message" => "You are registered with Disaster Saftey app");
        		$result = $gcm->send_notification($registatoin_ids, $message);*/
        //echo json_encode($response);
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:31,代码来源:login.php

示例7: array

<?php

require_once "../includes/db_connect.php";
require_once "../includes/functions.php";
require_once "../includes/session.php";
confirm_logged_in();
//var_dump(get_test_name());
if (isset($_GET["message"])) {
    $message = "The question has been added";
}
if (isset($_POST["submit"])) {
    $db = new DB_CONNECT();
    $keys = array("question", "option1", "option2", "option3", "option4", "radio", "marks", "negative_marks");
    if (!array_diff($keys, array_keys($_POST)) && check_is_set($_POST)) {
        $question = $db->mysql_prep($_POST["question"]);
        $option1 = $db->mysql_prep($_POST["option1"]);
        $option2 = $db->mysql_prep($_POST["option2"]);
        $option3 = $db->mysql_prep($_POST["option3"]);
        $option4 = $db->mysql_prep($_POST["option4"]);
        $correct_ans = $db->mysql_prep($_POST["radio"]);
        $marks = $db->mysql_prep($_POST["marks"]);
        $negative_marks = $db->mysql_prep($_POST["negative_marks"]);
        $table_name = get_test_name() . "_questions";
        $query = "Insert into " . $table_name . " (`question`, `option1`, `option2`, `option3`, `option4`, `correct_ans`, `marks`, `negative_marks`) \n       VALUES('{$question}','{$option1}','{$option2}', '{$option3}', '{$option4}', '{$correct_ans}', '{$marks}', '{$negative_marks}')";
        if (!is_null($db->query_database($query))) {
            redirect_to("add_question.php?message=true");
        } else {
            echo "Question cannot be added";
        }
    } else {
        $message = "Someting was not set";
开发者ID:abhik-setia,项目名称:MCQTECHNO,代码行数:31,代码来源:add_question.php

示例8: trim

<?php

require_once "/includes/session.php";
require_once "/includes/db_connect.php";
require_once "/includes/functions.php";
confirm_logged_in();
$db = new DB_CONNECT();
if (isset($_POST["latitude"]) && isset($_POST["longitude"]) && isset($_POST["type_of_help"])) {
    $latitude = trim($db->mysql_prep($_POST["latitude"]));
    $longitude = trim($db->mysql_prep($_POST["longitude"]));
    $type_of_help = trim($db->mysql_prep($_POST["type_of_help"]));
    $queryString = "INSERT INTO help ( longitude , latitude , type_of_help ) VALUES( '{$longitude}','{$latitude}' , '{$type_of_help}') ";
    $result = $db->query_db($queryString);
    if ($result) {
        //$_POST["message"] = "Inserted to the database";
        redirect_to("addcoordinates.php?message=Inserted to the database");
    } else {
        echo "Cannot be inserted .Query Failed";
    }
} else {
    echo "Problem in the post request";
}
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:22,代码来源:addcoordinatesToDataBase.php

示例9:

<?php

require_once "../includes/db_connect.php";
require_once "../includes/functions.php";
require_once "../includes/session.php";
require_once "utils/question.php";
require_once "utils/user.php";
confirm_logged_in();
if (isset($_POST["submit"])) {
    $db = new DB_CONNECT();
    var_dump($_POST);
    // get username from the session
    $username = get_username();
    if (check_is_set($_POST)) {
        if (check_empty($_POST)) {
            $test_name = $db->mysql_prep($_POST["test_name"]);
            $start_time = make_sql_date_time($_POST["start_time"], "/");
            $end_time = make_sql_date_time($_POST["end_time"], "/");
            $event_date = $_POST["event_date"];
            $duration = $db->mysql_prep($_POST["duration"]);
            $query = "Insert into " . TESTS_TABLE . " (username, test_name, start_time, end_time, event_date, duration) " . "values('{$username}', '{$test_name}', '{$start_time}', '{$end_time}','{$event_date}','{$duration}')";
            $result = $db->query_database($query);
            if (is_null($result)) {
                // query failed
                echo "query failed";
            } else {
                if (!is_null(Question::create_table($test_name))) {
                    if (!is_null(User::create_table($test_name))) {
                        // create the test folder
                        if (!mkdir("../tests/" . $test_name)) {
                            echo "Unable to create the directory";
开发者ID:abhik-setia,项目名称:MCQTECHNO,代码行数:31,代码来源:test_details.php


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