PDA

View Full Version : php mysql table viewing restricted access



bberry91
09 May 2011, 05:22 PM
i am using this code to protect my page so that only people who know the simple username/password can login to see the database entries. but i feel like this is not good enough. in my table, i have names, addresses, e-mails, but no security cards/very personal information like that. is there a better way to protect this page to further protect it?


<?php



// Define your username and password

$username = "admin";

$password = "123";



if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {



?>



<h1>Login</h1>



<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<p><label for="txtUsername">Username:</label>

<br /><input type="text" title="Enter your Username" name="txtUsername" /></p>



<p><label for="txtpassword">Password:</label>

<br /><input type="password" title="Enter your password" name="txtPassword" /></p>



<p><input type="submit" name="Submit" value="Login" /></p>



</form>



<?php



}

else {



?>



<p>This is the protected page.</p>



<?php



}



?>