Jump to content

Recommended Posts

<?php
$connect= new mysqli('localhost','user','pass','db'); //connecting to MYSQLI
function clean($text){
$text=strip_tags(trim(mysql_real_escape_string($text)));//weeding out XSS/SQL injection
$text.=html_entities($text,ENT_QUOTES); //escaping XSS injection from executing

}
//sanitizing variables for XSS/SQL injection
$Job_Title= clean($_POST['Job_Title']);
$Work_Phone= clean($_POST['Work_Phone']);
$Work_Fax= clean($_POST['Work_Fax']);
$Website= clean($_POST['Website']);
$update= clean($_POST['update']);
$sql= $connect ->prepare("INSERT INTO table VALUES (?,?,?,?,?)"); //preparing MYSQLI statement
$sql ->bind_param
('sssss',$Job_Title,$Work_Phone,$Work_Fax,$Website,$update); //binding MYSQL values to statement
$sql ->execute(); //execute prepared MYSQLI statement
?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.