After logging in successfully, i start an infinite loop between index.php 
and login.php,  what's up?  Please help.
<?
// 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;
      }
?>
<HTML>
<HEAD>
  <TITLE>e-DBapps.com: Home</TITLE>
</head>
<body bgcolor="#ffffff">
<font face="Palatino Linotype" size="2">
<table border="0" cellpadding="0" cellspacing="0" width="750">
  <tr><!-- row 1 -->
    <td colspan="2"><img  src="img/development.jpg" name="development3" 
width="750" height="100" border="0"></td>
  </tr>
  <tr>
    **stuff**
  </tr>
</table>
</font>
</BODY>

CHECKLOGIN.php

<?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/index.php";);
                        exit();
                   }
                else
                   {
                        $status = 0;
                        header("Location: 
http://dev.e-dbapps.com/customscripts/error.php?e=$status";);
                        exit();
                   }
           }
?>
</HTML>

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to