Jump to content

using the filter functions


joeizang

Recommended Posts

Hi guys,

 

I am just stretching out with php and I am hoping to start making way. I have been following tutorials on phpro.org and I just finish one on the filter functions and I thought I should try it out. i wrote this code as a test to process my loginpage but nothing happens. Can anyone look at this code and tell me what's wrong? and finally how do you filter passwords if the password field can have any set of characters, I thought of using preg_match() to test the passwords. Thanks for your help guys

 

<?php

 

if(isset($_POST['login'])){

 

//$uname = filter_input($_POST['mgt_username'], FILTER_SANITIZE_SPECIAL_CHARS);

//$passwd = filter_input($_POST['mgt_password']);

 

$filters = array(

"mgt_username" =>FILTER_SANITIZE_SPECIAL_CHARS,

"mgt_password" =>FILTER_SANITIZE_SPECIAL_CHARS

);

 

$cleanpost = filter_input_array(INPUT_POST, $filters);

 

$username = $cleanpost['mgt_username'];

$password = sha1($cleanpost['mgt_password']);

 

echo($cleanpost['mgt_password']);

 

 

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/138677-using-the-filter-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.