Hey, what's going on?

Archive for October, 2018

Harga Benelli Motobi 200 Evo OTR Bandung

Posted by Syeilendra Pramuditya on October 19, 2018

Jalan2 ke dealer Benelli Bandung

 

Jalan2 ke dealer Benelli Bandung

 

Lets Ride!! Huhuy!!

Posted in whatever | Tagged: , , , , , | Leave a Comment »

Quite secure PHP form input with POST (and also GET) method

Posted by Syeilendra Pramuditya on October 19, 2018

<?php
print '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>PHP Form Input</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">
  <input name="text1" type="text" id="text1" size="50">
  <input name="submit" type="submit" id="submit" value="Submit">
</form>
</body>
</html>
';

function test_input($data){
  $data = trim($data);
  $data=str_replace("'","^",$data);
  $data=str_replace("`","^",$data);
  $data=str_replace('"','^',$data);
  $data=str_replace('$','^',$data);
  $data=str_replace(';','^',$data);
  $data = htmlspecialchars($data);
  $data = addslashes($data);
  return $data;
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$text1 = test_input($_POST['text1']);
print '<h1>'.$text1.'</h1>';
}
?>

Posted in programming | Leave a Comment »