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
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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