View Full Version : Login

07-07-2007, 11:29 AM
I would like to create my own login... on my website...
with PHP and MySQL, I've created a database called dieknights, with a table called memb_info
and now I want to have a login on my index.php, how do I do that?
1. create link to login.php ?
2. put the login on index.php with include();
3. put the login on index.php in a frame?

now my example:
I've sepereated it:
<a href="login.php">To the Login</a>
<form action="loggedin.php" method="post">
Name: <input type="text" name="membid"><br>
Passwort:<input type="text" name="pwid"><br>
<input type="submit" value="Login">
$name = $_POST['membid'];
$pw = $_POST['pwid'];
if (isset($name) && $pw != "")
//SQL query(code):
what goes here? I think:
if $pw = pwd_id("SELECT * FROM memb_info WHERE memb_id=$name");
or something...

what do i need to put at the sql query i mean how can i make a check if the $name exists and if yes, check if the $pw is the right one....

I would be very thankful for help!

07-07-2007, 12:38 PM
nobody got a clue?

07-07-2007, 03:12 PM
enom;585328']nobody got a clue?

If I knew how I'd be glad to help but just googling pointed me to this:


Here's another really easy one:


07-07-2007, 04:06 PM
This is how i have mine, which will show the users info:



@mysql_select_db($database) or die("Unable to select database");

$query = "SELECT * FROM users";

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){

'<table border="1" width="650" bordercolor="#c0c0c0"><tr><td width="80">'.$row['id']. '</td>'.
'<td width="120">'.$row['loginname']. '</td>'.
'<td width="120">'.$row['password']. '</td>'.
'<td width="120">'.$row['createdate']. '</td>'.
'<td width="120">'.$row['name']. '</td>'.
'<td width="30">'.$row['age']. '</td>'.
'<td width="150">'.$row['email']. '</td>'.
'<td width="30">'.$row['warn']. '</td></tr></table>';

echo "";

Just change the stuff to what you need, i have a full working login /registering thing if you would like any code for that just say? BY PMING ME, I MAY NOT COME HERE AGAIN!!

07-07-2007, 04:53 PM
Here is an outline of how I do this in PHP:

1. Login.php is a link on my home page. If the user wants to login then they click on this link and it displays the login.php page.

2. User logs in with username and pw. The login.php script calls login.dispatcher.php which processes the login data at the server:
a. checks login username and pw vars to make sure they not empty (strlen() == 0)
b. open database and find username entered on login page. If not found dispatcher script calls login.usernotfound.php page.
c. open database and fetch password. Decrypt password using PHP's Mcrypt module. Compare DB pw to login pw. If no match dispatcher script calls login.badpw.php script.
d. If password matches then dispatcher sets valid user pw variable (or however you plan to determine pw is valid) and calls what ever page you want next to be displayed.

Notes: For testing, you'll have to write two stub php scripts:

These two test scripts will allow you to create a pw and store it encrypted into the DB and then read it back out, decrypt it, to make sure you can get an encrypted pw into the DB and back out again.

07-07-2007, 06:17 PM
is it secure?
antispam? antihack?

btw thanks!

i needed this for my project,
im trying to program a webborwser based game, like:
has anyone got a clue, what else i need?