Last active
January 16, 2018 14:22
-
-
Save netwons/d279ec3db94cfc8589778b6002a5b286 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function security($data){ | |
$data=trim($data); | |
$data=stripcslashes($data); | |
$data=htmlentities($data); | |
return $data; | |
} | |
$output=""; | |
function insert(){ | |
global $output; | |
global $connection; | |
$name =$lastname = ""; | |
$name=security($_POST["name"]); | |
$lastname=security($_POST["lastname"]); | |
$query= " INSERT INTO m1 ("; | |
$query .= " name, lastname"; | |
$query .= ") VALUES ("; | |
$query .= " '{$name}', '{$lastname}' "; | |
$query .= ")"; | |
if($_SERVER["REQUEST_METHOD"]=="POST"){ | |
if(empty($name) || empty($lastname)){ | |
$output .= "feids is not empty.<br>"; | |
}else{ | |
if(mysqli_query($connection,$query)){ | |
$output .= "success"; | |
} | |
else{ | |
$output .= "failds.."; | |
} | |
} | |
} | |
return $output; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function security($data){ | |
$data=trim($data); | |
$data=stripcslashes($data); | |
$data=htmlentities($data); | |
return $data; | |
} | |
function insert(){ | |
global $output; | |
global $result; | |
global $connection; | |
$name =$lastname = ""; | |
$name=security($_POST["name"]); | |
$lastname=security($_POST["lastname"]); | |
$query= " INSERT INTO m1 ("; | |
$query .= " name, lastname"; | |
$query .= ") VALUES ("; | |
$query .= " '{$name}', '{$lastname}' "; | |
$query .= ")"; | |
$result=mysqli_query($connection,$query); | |
if($_POST['submit']){ | |
if(empty($name) || empty($lastname)){ | |
$output = "feids is not empty.<br>"; | |
}else{ | |
if(isset($result)){ | |
$output .= "success"; | |
} | |
else{ | |
$output .= "failds.."; | |
} | |
} | |
return $output; | |
} | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment