Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

user authentication problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

user authentication problem

Postby ken-doh » Wed Jan 08, 2003 4:51 am

I am trying to use the PHP authentication to verify a user

here is the code:

<?php

if(!isset ($PHP_AUTH_USER)) :
header('WWW-Authenticate: Basic realm="user verification PHP"');
header('HTTP/1.0 401 Unauthorized');
print "you need access :P";
exit;
else:

$dbcnx = mysql_connect("192.168.1.27", "root", "");
if (!$dbcnx) {
echo( "<p>Unable to connect to the " . "database server please try again later.</p>" );
exit();
}

mysql_select_db("database1", $dbcnx);
if (! @mysql_select_db("database1") ) {
echo( "<p>Unable to locate the database1 " . "database at this time.</p>" );
exit();
}

$result = @mysql_query("SELECT first_name, last_name
FROM users
WHERE first_name='$PHP_AUTH_USER' and last_name='$PHP_AUTH_PW'");

if (mysql_numrows($result) != 1):
echo " Not verifed" ;
header('WWW-Authenticate: Basic realm="user verification PHP"');
header('HTTP/1.0 401 Unauthorized');
exit;

else:

$userid = mysql_result (user_authenticate, 0, $result);
endif;
endif;
?>
ken-doh
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Jan 08, 2003 3:27 am

Postby serg_dz » Wed Jan 08, 2003 11:32 pm

So what is your problem? Nobody want to read long lists of code. Describe what U have & what U want to have.
serg_dz
New php-forum User
New php-forum User
 
Posts: 13
Joined: Thu Oct 10, 2002 10:37 pm
Location: Ukraine

Postby ken-doh » Thu Jan 09, 2003 8:59 am

well I think that I found the answer on another site.

it appears that windows does not support isapi

validation does not work without isapi

therefore it wont work. which is a real pain tbh but never mind. i then read my install.txt to read up about how to do this but alas no joy :(
ken-doh
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Jan 08, 2003 3:27 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron