php help needed for login

Reply

Join Date: Aug 2004
Posts: 1
Reputation: browny87us is an unknown quantity at this point 
Solved Threads: 0
browny87us browny87us is offline Offline
Newbie Poster

php help needed for login

 
0
  #1
Aug 9th, 2004
i cant get a login script to work so imma take the easy way out and ask if ne1 will give me one plzplzplzplzplz

:cry:
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 94
Reputation: Ragnarok is an unknown quantity at this point 
Solved Threads: 0
Ragnarok Ragnarok is offline Offline
Junior Poster in Training

Re: php help needed for login

 
0
  #2
Aug 9th, 2004
tell us what the problem is and post some code and we can probably help
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 22
Reputation: pcarlow is an unknown quantity at this point 
Solved Threads: 0
pcarlow pcarlow is offline Offline
Newbie Poster

Re: php help needed for login

 
0
  #3
Aug 12th, 2004
I highly recommend the free version of Cookie Password Protection. I use it on my site to protect certain database interfaces I don't want people getting into.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 3
Reputation: dragonkingamn is an unknown quantity at this point 
Solved Threads: 0
dragonkingamn dragonkingamn is offline Offline
Newbie Poster

Re: php help needed for login

 
0
  #4
Aug 12th, 2004
hey, if u find someone that knows how to do login php script, email me. my friend is setting up an rpg. having a login screen would be kool where he would not have to put u in himself. when putting in the login name, i would like to go straight to my member stats kinda like yahoo for the mail accont.

ill post the site when i talk to him next.

if anyone else can help me and him out, email me and ill give him ur email address and he'll email u about his site.
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 12
Reputation: AK47 is an unknown quantity at this point 
Solved Threads: 0
AK47 AK47 is offline Offline
Newbie Poster

Re: php help needed for login

 
0
  #5
Aug 13th, 2004
How about using PHP sessions like this:
<?php

if (!isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW)) {
//If the PHP session variables aren't set, ask for name and password
header('WWW-Authenticate: Basic realm="Authorized Users Only"');
header('HTTP/1.0 401 Unauthorized');
exit;

} else if (isset($PHP_AUTH_USER) && isset($PHP_AUTH_PW)) {

//If the variables are set, check the username and password against a //database.

$conn = pg_Connect("host=localhost dbname=[dbname] port=[portnumber]");

$result = pg_Exec($conn,
"SELECT *
FROM [table]
WHERE username='$PHP_AUTH_USER' AND
password='$PHP_AUTH_PW';");

$num = pg_NumRows($result);
$i = 0;

//If the user is authenticated against the database, echo the html code for //the page you want them to see

if ($num != 0) {
echo "<HTML> ...... </HTML>"
}
}
?>

Use this configuration for any web page on your site that should have restricted access, then rename those files with a .php extension. In this example the connection is to a PostgreSQL database on my linux server, you may need a different connection string/method for your needs, but this works great otherwise. Once a user provides their login information they can immediately access any of the pages with the php code. Their login wont be lost until they close their browser, or you could give them a logout option that would reset the user and password variables. I found the original tutorial on this at this address: http://webmonkey.wired.com/webmonkey...tw=programming

Hope this helps!
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 193
Reputation: YoungCoder is an unknown quantity at this point 
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Re: php help needed for login

 
0
  #6
Aug 15th, 2004
Originally Posted by browny87us
i cant get a login script to work so imma take the easy way out and ask if ne1 will give me one plzplzplzplzplz

:cry:
For starters you need to give more information...do you have mysql databases, do you even have php?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC