escape() 공개 메소드

Escape harmful characters which might affect a query.
public escape ( string $str ) : string
$str string The string to escape.
리턴 string The escaped string.
예제 #1
0
파일: add.php 프로젝트: ananay/seedup
 * @Last Modified by:   ananayarora
 * @Last Modified time: 2016-01-14 20:15:12
 */
session_start();
if (!isset($_SESSION['loggedin'])) {
    header("Location: signin.php?next=add.php");
}
if (isset($_POST['submit'])) {
    require 'conf.php';
    require 'sql.php';
    $c = new Conf();
    $o = new MysqliDb($c->host, $c->username, $c->password, $c->db);
    $insArr = array();
    foreach ($_POST as $key => $value) {
        if ($key == "valuation" || $key == "currentfunding") {
            $insArr[$key] = str_replace(",", "", $o->escape($value));
        } else {
            $insArr[$key] = $o->escape($value);
        }
    }
    $insArr['timeadded'] = time();
    $insArr['imageurl'] = 'data:image/png;base64,' . base64_encode(file_get_contents($_FILES['imageurl']['tmp_name']));
    unset($insArr['submit']);
    $o->insert("startups", $insArr);
    // header("Location: index.php");
}
require 'header.php';
?>
	<script src="http://clouddelivery.textbox.io/1/getEditor?apiKey=838eacr76gusx262p3cs4fwkjk104wsqun1nyelzulvy6okw"></script>
	<style type="text/css">
	textarea {
예제 #2
0
/**
 * @Author: ananayarora
 * @Date:   2016-01-14 20:08:08
 * @Last Modified by:   ananayarora
 * @Last Modified time: 2016-01-14 23:41:31
 */
if (!isset($_GET['id'])) {
    header("Location: index.php");
}
require 'header.php';
require 'conf.php';
require 'sql.php';
$c = new Conf();
$o = new MysqliDb($c->host, $c->username, $c->password, $c->db);
$o->where("id", $o->escape($_GET['id']));
$k = $o->get("startups");
?>
<center>
	<div class="main_startup">
		<div style='background-image:url("<?php 
echo $k[0]['imageurl'];
?>
");' class="startup_photo"></div>
		<div class="startup_details">
			<h3 class="startup_name"><?php 
echo $k[0]['name'];
?>
</h3>
			<p class="oneliner"><?php 
echo $k[0]['oneliner'];
예제 #3
0
파일: signup.php 프로젝트: ananay/seedup
/**
 * @Author: ananayarora
 * @Date:   2016-01-14 22:34:55
 * @Last Modified by:   ananayarora
 * @Last Modified time: 2016-01-15 00:51:24
 */
require 'header.php';
if (isset($_POST['submit'])) {
    require 'conf.php';
    require 'sql.php';
    $c = new Conf();
    $o = new MysqliDb($c->host, $c->username, $c->password, $c->db);
    $insArr = array();
    foreach ($_POST as $key => $value) {
        $insArr[$key] = $o->escape($value);
    }
    unset($insArr['submit']);
    $o->insert("users", $insArr);
    header("Location: signin.php");
}
?>
	<center>
		<h2>Signup</h2>
	<form method="POST">
			<div class="mdl-textfield mdl-js-textfield">
				<input class="mdl-textfield__input" id="username" name="username" required/>
				<label class="mdl-textfield__label" for="username">Username</label>
			</div><br />
			<div class="mdl-textfield mdl-js-textfield">
				<input class="mdl-textfield__input" type="password" id="password" name="password" required/>