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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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.