note 121986 added to mysqli.prepare

From: Date: Wed, 06 Dec 2017 10:49:59 +0000
Subject: note 121986 added to mysqli.prepare
Groups: php.notes 
Request: Send a blank email to php-notes+get-209321@lists.php.net to get a copy of this message
This Is A Secure Way To Use mysqli::prepare -------------------------------------------------------- <?php function secured_signup($username,$password) { $connection = new mysqli($dbhost,$dbusername,$dbpassword,$dbname); if ($connection->connect_error) die("Secured"); $prepared = $connection->prepare("INSERT INTO users ( username , password ) VALUES ( ? , ? ) ; "); if($prepared==false) die("Secured"); $result=$prepared->bind_param("ss",$username,$password); if($result==false) die("Secured"); $result=$prepared->execute(); if($result==false) die("Secured"); $prepared->close(); $connection->close(); } /* $dbhost ---> DataBase IP Address $dbusername ---> DataBase Username $dbpassword ---> DataBase Password $dbname ---> DataBase Name */ ?> ---- Server IP: 208.43.231.9 Probable Submitter: 128.199.193.75 ---- Manual Page -- http://php.net/manual/en/mysqli.prepare.php Edit -- https://master.php.net/note/edit/121986 Del: integrated -- https://master.php.net/note/delete/121986/integrated Del: useless -- https://master.php.net/note/delete/121986/useless Del: bad code -- https://master.php.net/note/delete/121986/bad+code Del: spam -- https://master.php.net/note/delete/121986/spam Del: non-english -- https://master.php.net/note/delete/121986/non-english Del: in docs -- https://master.php.net/note/delete/121986/in+docs Del: other reasons-- https://master.php.net/note/delete/121986 Reject -- https://master.php.net/note/reject/121986 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209321) next »