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


PHP Database::escapeString方法代码示例

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


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

示例1: update

 public function update()
 {
     $db = new Database();
     $db->connect();
     $returnValue;
     //if($this->isCreated()){
     $where = 'id=' . $this->getId();
     $updateInformation = array();
     $updateInformation["name"] = $db->escapeString($this->getName());
     $updateInformation["description"] = $db->escapeString($this->getDescription());
     $updateInformation["display"] = $db->escapeString($this->getDisplay());
     date_default_timezone_set('America/Chicago');
     $updateInformation["last_updated_timestamp"] = $db->escapeString(date('Y-m-d G:i:s'));
     $result = $db->update(static::$tableName, $updateInformation, $where);
     if ($result) {
         $returnValue = true;
     } else {
         $returnValue = false;
     }
     $db->disconnect();
     //}else{
     //	$returnValue = false;
     //}
     return $returnValue;
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:25,代码来源:item.php

示例2: update

 public function update()
 {
     $db = new Database();
     $db->connect();
     $where = 'id=' . $this->getId();
     $updateInformation = array();
     $updateInformation['name'] = $db->escapeString($this->getName());
     $updateInformation['description'] = $db->escapeString($this->getDescription());
     $updateInformation["last_updated_timestamp"] = $db->escapeString(date('Y-m-d G:i:s'));
     $result = $db->update(static::$tableName, $updateInformation, $where);
     $db->disconnect();
     if ($result) {
         $this->setId($result);
         return $result;
     } else {
         return false;
     }
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:18,代码来源:taxonomy.php

示例3: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$database = new Database();
$user = new User();
if (isset($_POST['submit'])) {
    $newPass = $database->escapeString($_POST['newPass']);
    $confPass = $database->escapeString($_POST['confPass']);
    $code = $database->escapeString($_POST['code']);
    $hash = password_hash($newPass, PASSWORD_BCRYPT);
    if ($newPass != $confPass) {
        redirect($_SERVER['HTTP_REFERER'] . "&error=equals");
    } else {
        if (strlen($newPass) < 6) {
            redirect($_SERVER['HTTP_REFERER'] . "&error=length");
        } else {
            $user->setId($code);
            $user->setPassword($hash);
            if ($user->updatePassword()) {
                $path = "../logs";
                $dateTime = strftime("%Y-%m-%d %H:%M:%S");
                $text = "Password changed for user with ID:";
                $content = $dateTime . " " . $_SESSION['USNM'] . ": " . $text;
                $user->setId($_SESSION['USID']);
                $user->storeLog($content, $path);
                redirect("../users.php?users=1&pass=succeed");
            } else {
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:changeUsersPassword.php

示例4: config

<?php

require_once 'db/config.php';
$con = new config(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db = new Database($con);
$db->openConnection();
$postdata = file_get_contents("php://input");
$jsonHandle = new jsonHandler();
$requestData = $jsonHandle->decode($postdata);
$data = array();
$page = $db->escapeString($requestData->page);
$innerPage = $db->escapeString($requestData->innerPage);
if ($page == "dashboard") {
    $query = $db->query("SELECT * FROM tbl_hashtag");
    /*Overview Page*/
    if ($innerPage == "overview") {
        /*Check whether it contains tha hashtag data or not*/
        if ($db->hasRows($query)) {
            $data['hashtagArray'] = array();
            $i = 0;
            while ($row = $db->fetchAssoc($query)) {
                $hashtagName = $row['hashtagName'];
                /*Total Tweet Count*/
                $totTweetsQuery = $db->query("SELECT COUNT(DISTINCT tweet_id) FROM tweet_tags WHERE tag = '{$hashtagName}'");
                $totalTweets = $db->fetchArray($totTweetsQuery);
                $data['hashtagArray'][$i]['hashtagName'] = $hashtagName;
                $data['hashtagArray'][$i]['tweets'] = array();
                //$tweetQuery = "SELECT * FROM tweet_tags LEFT JOIN"
                $data['hashtagArray'][$i]['totalTweets'] = $totalTweets[0];
                $data['hashtagArray'][$i]['totalImpressions'] = $i + 2000;
                $data['hashtagArray'][$i]['profileVisits'] = 3000;
开发者ID:sesn,项目名称:TwitterApp,代码行数:31,代码来源:dashboard.php

示例5: array

        echo $d['id'];
        ?>
" class="btn btn-primary btn-xs">Tindak</a></td>
		</tr>
		<?php 
    }
    ?>
	</tbody>
</table>

<div class="alert alert-info" role="alert">Klik pada nama siswa atau NIS untuk melihat daftar peringatan.</div>

<?php 
} else {
    if (isset($_POST['idtindak'])) {
        $idtindak = $db->escapeString($_POST['idtindak']);
        $status = $db->escapeString($_POST['status']);
        $db->update('tindak', array('tindak' => $status, 'ubah' => wkt(), 'idguru' => $_SESSION['userid']), "id='{$idtindak}'");
        echo "Processing...";
        eksyen('Data berhasil diubah', '?hal=penindakan');
    }
    $id = mysql_real_escape_string($_GET['detail']);
    $db->select('tindak', '*', null, "id='{$id}'");
    $res = $db->getResult();
    foreach ($res as $d) {
        ?>

<div class="col-lg-12">
    <h1 class="page-header">Detail Tindakan <small>| <a href="?hal=penindakan">Kembali</a></small></h1>
</div>
<form action="" method="post">
开发者ID:teknomatika,项目名称:monitor,代码行数:31,代码来源:penindakan.php

示例6: eksyen

            if (isset($_GET['id'])) {
                echo '<h1 class="page-header">Ubah Data Sanksi <small>| <a href="?hal=sanksi">Kembali</a></small></h1>';
                $id = $_GET['id'];
                $db->select('sanksi', '*', NULL, "id='{$id}'", null);
                // Table name, Column Names, JOIN, WHERE conditions, ORDER BY conditions
                $jum = $db->numRows();
                if ($jum < 1) {
                    eksyen('Data tidak ditemukan', '?hal=sanksi');
                }
                $d = $db->getResult();
            } else {
                echo '<h1 class="page-header">Tambah Data Sanksi <small>| <a href="?hal=sanksi">Kembali</a></small></h1>';
            }
            if (isset($_POST['nama'])) {
                echo "Processing...";
                $nama = $db->escapeString($_POST['nama']);
                $minimal = $db->escapeString($_POST['minimal']);
                $maksimal = $db->escapeString($_POST['maksimal']);
                if (isset($_POST['id'])) {
                    $id = mysql_real_escape_string($_POST['id']);
                    $db->update('sanksi', array('nama' => $nama, 'minimal' => $minimal, 'maksimal' => $maksimal, 'ubah' => wkt()), 'id="' . $id . '"');
                    eksyen('Data berhasil diubah', '?hal=sanksi');
                } else {
                    $db->insert('sanksi', array('nama' => $nama, 'minimal' => $minimal, 'maksimal' => $maksimal, 'ubah' => wkt()));
                    $res = $db->getResult();
                    eksyen('Data berhasil diinput', '?hal=sanksi');
                }
            }
            ?>
			<form action="" method="POST" class="form-horizontal" role="form">
				<?php 
开发者ID:teknomatika,项目名称:monitor,代码行数:31,代码来源:sanksi.php

示例7: Database

<?php

include 'class/mysql_crud.php';
$db = new Database();
$db->connect();
$data = $db->escapeString("name5@email.com");
// Escape any input before insert
$db->insert('CRUDClass', array('name' => 'Name 5', 'email' => $data));
// Table name, column names and respective values
$res = $db->getResult();
print_r($res);
开发者ID:surencarter,项目名称:MySQL-CRUD-PHP-OOP,代码行数:11,代码来源:insert.php

示例8: config

<?php

//header('Access-Control-Allow-Origin: *');
//header('Content-Type: application/json; charset = UTF-8');
//session_start();
require_once 'db/config.php';
$con = new config(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db = new Database($con);
$db->openConnection();
$postdata = file_get_contents("php://input");
$jsonHandle = new jsonHandler();
$requestdata = $jsonHandle->decode($postdata);
//$requestdata = json_decode($postdata);
$userName = $db->escapeString($requestdata->userName);
$userPass = $db->escapeString($requestdata->userPass);
$data = array();
if (!empty($userName) && !empty($userPass)) {
    $query = $db->query("SELECT * FROM tbl_admin WHERE admin_user= '{$userName}' AND admin_pass = '{$userPass}'");
    if ($db->hasRows($query) > 0) {
        while ($row = $db->fetchAssoc($query)) {
            if ($row['admin_status'] == 1) {
                $_SESSION['user'] = $row['admin_user'];
                $_SESSION['loggedIn'] = true;
                $data['adminUser'] = $row['admin_user'];
                $data['adminType'] = $row['admin_type'];
                $data['adminMail'] = $row['admin_mail'];
                $data['adminContactMail'] = $row['admin_contactmail'];
                $data['loggedIn'] = true;
                /*Super admin*/
                if ($row['admin_type'] == "sadmin") {
                    $data['message'] = "You have successfully connected and too have full access over the data";
开发者ID:sesn,项目名称:TwitterApp,代码行数:31,代码来源:login-check.php

示例9: escapeString

 /**
  * Wrapper for the db.
  *
  * @param string $string
  * @return string
  */
 public function escapeString($string)
 {
     return $this->db->escapeString($string);
 }
开发者ID:enyo,项目名称:rincewind,代码行数:10,代码来源:SqlDaoBase.php

示例10: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$database = new Database();
$user = new User();
$menu = new Menu();
$links = new Links();
$pages = new Page();
if (isset($_POST['addMenuBtn'])) {
    $menuName = $database->escapeString($_POST['menuName']);
    $description = $database->escapeString($_POST['description']);
    // check if parent is set
    if (isset($_POST['parent']) && $_POST['parent'] != "" && $_POST['parent'] != null) {
        $parentLinkId = $database->escapeString($_POST['parent']);
        $links->setLinkId($parentLinkId);
        $language = $links->getSubMenusLangId($database);
    } else {
        $language = $database->escapeString($_POST['language']);
        $parentLinkId = 0;
    }
    // set values
    $menu->setLangId($language);
    $menu->setIsMain(0);
    $menu->setDescription($description);
    $menu->setParentLinkId($parentLinkId);
    $menu->setTitle($menuName);
    // do not allove a link to have two sub menus
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:addMenu.php

示例11: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$database = new Database();
$user = new User();
$hotel = new Hotel();
$location = new Location();
$media = new Media();
if (isset($_POST['submit'])) {
    $name = $database->escapeString($_POST['name']);
    $address = $database->escapeString($_POST['address']);
    $stars = $database->escapeString($_POST['stars']);
    $destination = $database->escapeString($_POST['location']);
    $description = $database->escapeString($_POST['description']);
    $hotel->setHotelName($name);
    $hotel->setAddress($address);
    $hotel->setStars($stars);
    $hotel->setDescription($description);
    $hotel->setCityId($destination);
    if (isset($_POST['hotelId'])) {
        $hotelId = $database->escapeString($_POST['hotelId']);
        $hotel->setHotelId($hotelId);
        $hotel->update($database);
    } else {
        $hotelId = $hotel->create($database);
    }
    if (count($_FILES) != 0) {
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:31,代码来源:createAndEditHotel.php

示例12: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$user = new User();
$database = new Database();
$pageLayout = new PageLayout();
if (isset($_POST['pageLayoutList']) && $_POST['pageLayoutList'] != null) {
    foreach ($_POST['pageLayoutList'] as $pageLayoutId) {
        $pageLayout->setPageLayoutId($database->escapeString($pageLayoutId));
        $pageLayout->getById($database);
        unlink("../" . $pageLayout->getImage());
        $pageLayout->delete($database);
        $path = "../logs";
        $dateTime = strftime("%Y-%m-%d %H:%M:%S");
        $text = "Deleted page layout with id:" . $pageLayoutId . " and name: " . $pageLayout->getName();
        $content = $dateTime . " " . $_SESSION['USNM'] . ": " . $text;
        $user->setId($_SESSION['USID']);
        $user->storeLog($content, $path);
        echo "true";
    }
} else {
    echo "false";
}
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:27,代码来源:deletePageLayout.php

示例13: foreach

}
$db->select('tipoarticulo', 'idtipoart, descripcion');
// Table name, Column Names, WHERE conditions, ORDER BY conditions
$res = $db->getResult();
$ltipoart = '';
foreach ($res as $key => $value) {
    $ltipoart .= '<option value="' . $value['idtipoart'] . '">' . $value['descripcion'] . '</option>';
}
if (isset($_POST['btnguardar'])) {
    $db->select('articulo', 'max(idarticulo) as id');
    // Table name, Column Names, WHERE conditions, ORDER BY conditions
    $res = $db->getResult();
    foreach ($res as $key => $value) {
        $id = $value['id'] + 1;
    }
    $vcodint = $db->escapeString("{$_POST['txtcodint']}");
    // Escape any input before insert
    $vmodelo = $db->escapeString("{$_POST['txtmodelo']}");
    $vdescripcion = $db->escapeString("{$_POST['txtdescripcion']}");
    $vdesetiqueta = $db->escapeString("{$_POST['txtdesetiqueta']}");
    $vdesticket = $db->escapeString("{$_POST['txtdesticket']}");
    $vdeslarga = $db->escapeString("{$_POST['txtdeslarga']}");
    $vidfotoart = $db->escapeString("{$_POST['txtidfotoart']}");
    $vcodbarra = $db->escapeString("{$_POST['txtcodbarra']}");
    $vidimpuestos = $db->escapeString("{$_POST['idimpuestos']}");
    $vidproveedor = $db->escapeString("{$_POST['txtidproveedor']}");
    $vidmarca = $db->escapeString("{$_POST['txtidmarca']}");
    $vpreciocosto = $db->escapeString("{$_POST['txtpreciocosto']}");
    $vpvp = $db->escapeString("{$_POST['txtpvp']}");
    $vmpcosto = $db->escapeString("{$_POST['txtmpcosto']}");
    $vfechact = $db->escapeString("{$_POST['txtfechact']}");
开发者ID:ramikat,项目名称:ERPSIS,代码行数:31,代码来源:articulo_c.php

示例14: Session

<?php

require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
    redirect("../login.php");
}
$user = new User();
$database = new Database();
if (isset($_GET['user']) && isset($_GET['active']) && $_GET['user'] != null && $_GET['active'] != null) {
    $id = $database->escapeString($_GET['user']);
    $active = $database->escapeString($_GET['active']);
    $user->setId($id);
    $user->setActive($active);
    if ($user->changeActive($database)) {
        $path = "../logs";
        $dateTime = strftime("%Y-%m-%d %H:%M:%S");
        $text = "Enabled/Disabled user with id :" . $id;
        $content = $dateTime . " " . $_SESSION['USNM'] . ": " . $text;
        $user->setId($_SESSION['USID']);
        $user->storeLog($content, $path);
        redirect("../users.php");
    } else {
    }
} else {
    echo "User not set";
}
开发者ID:jetmirhaxhisefa,项目名称:rezervime,代码行数:27,代码来源:enableDisableUser.php

示例15: eksyen

            if (isset($_GET['id'])) {
                echo '<h1 class="page-header">Ubah Data Tata Tertib <small>| <a href="?hal=tatatertib">Kembali</a></small></h1>';
                $id = $_GET['id'];
                $db->select('tata_tertib', '*', NULL, "id='{$id}'", null);
                // Table name, Column Names, JOIN, WHERE conditions, ORDER BY conditions
                $jum = $db->numRows();
                if ($jum < 1) {
                    eksyen('Data tidak ditemukan', '?hal=tatatertib');
                }
                $d = $db->getResult();
            } else {
                echo '<h1 class="page-header">Tambah Data Tata Tertib <small>| <a href="?hal=tatatertib">Kembali</a></small></h1>';
            }
            if (isset($_POST['nama'])) {
                echo "Processing...";
                $nama = $db->escapeString($_POST['nama']);
                $poin = $db->escapeString($_POST['poin']);
                $jenis = $db->escapeString($_POST['jenis']);
                if (isset($_POST['id'])) {
                    $id = mysql_real_escape_string($_POST['id']);
                    $db->update('tata_tertib', array('nama' => $nama, 'poin' => $poin, 'jenis' => $jenis, 'ubah' => wkt()), 'id="' . $id . '"');
                    eksyen('Data berhasil diubah', '?hal=tatatertib');
                } else {
                    $db->insert('tata_tertib', array('nama' => $nama, 'poin' => $poin, 'jenis' => $jenis, 'ubah' => wkt()));
                    $res = $db->getResult();
                    eksyen('Data berhasil diinput', '?hal=tatatertib');
                }
            }
            ?>
			<form action="" method="POST" class="form-horizontal" role="form">
				<?php 
开发者ID:teknomatika,项目名称:monitor,代码行数:31,代码来源:tatatertib.php


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