I have basic login system in php . the form on index page submits username and password to same page using POST
method .The username and password are hard coded .
Here is php code on index page that handles
if( isset ($_POST['submit']) ) {
$username='Admin';
$password='root';
if( ( $_POST['uname'] == $username ) && ( $_POST['pass'] == $password) ) {
// Redirect to admin page
}
else{
echo "Wrong credential";
}
}
I have referred to This question but unable to understand why hard coding is bad in these case .
my arguments
- This eliminates sql injection possibility
- Source code will never been seen if error reporting is off.