View previous topic :: View next topic |
Author |
Message |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Oct 04, 2005 1:29 am Post subject: Authentication Fails |
|
|
Ok , I know im pretty good at coding but this is rediculous. I tried adding the
same type of Password Protection to my script as Abyss Web Server's and all
that happens is for me to enter my Username and Password again. :/
Can someone please tell me whats wrong ?
Edit: This problem is now solved. Thanks anyway :-)
Sincerely , TRUSTpunk
Last edited by TRUSTAbyss on Tue Oct 04, 2005 9:24 pm; edited 1 time in total |
|
Back to top |
|
 |
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Tue Oct 04, 2005 9:12 am Post subject: |
|
|
Tbh I'd just make a database of accounts and use your own login form.
This is about of equal length. (Off the top of my head, though. (Y helo thar errors.))
Code: |
function loggedin() {
if (@mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `name` = '".addslashes($_COOKIE['name'])."' AND `password` = '".md5(addslashes($_COOKIE['password']))."'")) > 0)
return true;
else return false;
}
|
_________________
 |
|
Back to top |
 |
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Tue Oct 04, 2005 9:22 am Post subject: Re: Authentication Fails |
|
|
The code looks fine to me
apart from this line
Code: | $pass = $_SERVER['PHP_AUTH_PASS']; |
The server var for the password is actually $PHP_AUTH_PW
so that line should read
Code: | $pass = $_SERVER['PHP_AUTH_PW']; |
hope that helps _________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Tue Oct 04, 2005 9:23 am Post subject: |
|
|
Off the top of my head, why do you appear to be using NTLM authorisation when Abyss/standard is 'Basic Auth'?
Check out this topic for a working example of what you *should* be doing :)
http://www.aprelium.com/forum/viewtopic.php?t=965
Hope this helps... _________________
"Invent an idiot proof webserver and they'll invent a better idiot..." |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Oct 04, 2005 8:09 pm Post subject: |
|
|
I would have searched if I knew what I was searching for but that link really
did help me out alot , my code is a little different and it works great. LateR!
PHP Authentication
Code: |
<?php
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$realm = "You need to login lol";
if ((!isset($user)) && (!isset($pass))) {
header("WWW-Authenticate: Basic realm=\"$realm\"");
header("HTTP/1.1 401 Unauthorized");
include("includes/error401.php");
exit;
}
elseif (($user != "foo") || ($pass != "bar")) {
header("WWW-Authenticate: Basic realm=\"$realm\"");
header("HTTP/1.1 401 Unauthorized");
include("includes/error401.php");
exit;
}
?>
Send File or Send Message!
|
Thank you Roganty for warning me about that variable.
Sincerely , TRUSTpunk |
|
Back to top |
|
 |
|