Jump to content

Please Help!! Login in database with client provided usernames and passwords


hypgraphix

Recommended Posts

My client wants a splash page for his initial index page and doesn't not want people to be able to go any further into the website with a username and password he will provide for them directly. On that splash page he wants a place for them to login with the username and password he provided. How to I create a database for this? I am total lost! Please help me. I am brand new to this stuff.

Thanks so much to anyone who will help me!

This doesn't seem to be a PHP question. When one of the moderators moves it to "SQL / Database Forums" you'll have better luck. However, if you're new to this, you may want to consult a tutorial on databases

 

http://www.kirupa.com/developer/php/relational_db_design.htm

 

You'll have to do some small requirements gathering based on what the client actually needs from each user that he supplies a username and password so.

Example : First Name, Last Name, Birthdate, Address, City, State, Zip, Access Level (limits what a person actually has access to on the site), etc...

You just need to create a simple form with a username and password field, then pass these 2 fields into a page that you will use to execute your sql query from to compare the username and password submitted to...it will look something like this....

 

index.php

 

<form name="login" method="post" action="auth.php">

<table border="1">

<tr>

<td>

Enter Login:

</td>

<td>

<input type="text" name="username">

</td>

</tr>

<tr>

<td>

Enter Password:

</td>

<td>

<input type="password" name="pass">

</td>

</tr>

<tr>

<td>

</td>

<td>

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

</td>

</tr>

</table>

</form>

 

 

 

 

auth.php

 

$password=md5($_POST[pass]);

 

 

$select=mysql_query("SELECT * FROM users WHERE username=$_POST[username] AND password=$password") or die(mysql_error());

 

$sql=mysql_num_rows($select);

 

If ($sql){

 

echo "Login Sucessfully!";

 

}Else{

 

echo "Login Failed!!";

 

}

 

 

 

 

You just need to have a table called users with a field called username and a password field with md5 encryption...

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.