Jump to content

very basic login system


m00nz00mer

Recommended Posts

hey, i was wondering if anyone could assist me in any way, in creating a very basic login system in php, basically i had this in mind... index.php will include a username and password form, if it is entered correcly, it will go to homepage.php else go to passwordError.php page.

 

is this the way to do it?

Link to comment
https://forums.phpfreaks.com/topic/96962-very-basic-login-system/
Share on other sites

Yes, that sounds like a good way to do it.

 

You should start coding and ask specific questions about your code when you get stuck. If you are completely lost to how to even start, I recommend reading basic tutorials.

www.tizag.com

www.w3schools.com

thanks, ive actually been trying this...

 

<?

$username = "user";

$password = "password";

 

 

if ($_POST['loginUserName']!= $username ¦¦ $_POST['loginPassword']!= $password) {

?>

 

<h4>Login Below:</h4>

 

<div class="detailTextGrey">

 

<!-- Login Form -->

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

User Name: <input type="text" name="loginUserName"> <br />

Password: <input type="password" name="loginPassword"> <br /><br />

 

<input type="hidden" name="submitted" value="1" />

<input type="submit" value="Submit">

</form>

 

<?

}

else {

?>

 

but im getting an error...

Parse error: parse error, unexpected T_STRING in line 29

 

use sessions. set a session with the username and password and make it verify that the info stored in the session is the same as the stored username and password. then if (session-is-the-same) { "show-the-super-protected-top-secret-documents" } :D

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.