After logging in, i end up in a continual loop between index.php and
checklogin.php. Can someone give me a clue as to what is up and how to fix
it? If i set the checklogin to go to a page that does not check
authentication if the user/pass combo passed, it works fine, but whe i send
it to a page that checks to see if $PHP_AUTH_USER is set, i get the infinite
loop, which is funny the first time, but really.... Thanks in advance.
*no, the comments aren't really there in the code (at least 99% of them ;) )
//index.php
//<?
// index.php - secure page
// session_start();
// if (!isset($PHP_AUTH_USER))
// {
// // If empty, send header causing dialog box to appear
// header("Location:
http://dev.e-//dbapps.com/customscripts/checklogin.php");
// exit;
// }
//?>
//<?php
// session_start();
// // File Name: checklogin.php
// // Check to see if $PHP_AUTH_USER already contains info
//// if (!isset($PHP_AUTH_USER))
// {
// // If empty, send header causing dialog box to appear
// header('WWW-Authenticate: Basic realm="Webmail Testing Area"');
// header('HTTP/1.0 401 Unauthorized');
// exit;
// }
// else if (isset($PHP_AUTH_USER))
// {
// mysql_connect("***", "***", "***") or die ("Unable to connect to
database.");
// // select database on MySQL server
// mysql_select_db("***") or die ("Unable to select database.");
// $sql = "SELECT id FROM users WHERE username='$PHP_AUTH_USER' and
password= PASSWORD('$PHP_AUTH_PW')";
// $result = mysql_query($sql);
// // Get number of rows in $result. 0 if invalid, 1 if valid.
// $num = mysql_numrows($result);
// if ($num != "0")
// {
// // redirect to protected page
// session_register($PHP_AUTH_USER);
// session_register($PHP_AUTH_PW);
// header("Location: http://dev.e-dbapps.com/index2.php");
// exit();
// }
// else
// {
// $status = 0;
// header("Location:
http://dev.e-dbapps.com/customscripts/error.php?e=$status");
// exit();
// }
// }
//?>
-Patrick Hartnett
toymaster
e-dbapps.com
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php