The below code represents a basic login page. I'm pulling the user ID and password from a MYSQL database. That works fine. I can get stuff to echo after authentication (on the same page). What I can't seem to do is use the 'header' to automatically pull up another page. If I move the header statement outside the <? ?> the page jumps directly to the next page with presenting the login box.
Seems pretty straight forward but ... Any suggestions? Code examples?
Thanks
Paul
paul@tanaka-ism.com
<form action="welcome.php" method="get">
<table align=center width=500 cellpadding=5 border=5><tr><td bgcolor=#ee7218 align=center>
ENTER YOUR USER ID and PASSWORD</td></tr>
<tr><td align=center>
Dealer ID: <input type="Text" size="8" name="searchvalue" maxlength="5" value="<?=$HTTP_GET_VARS['searchvalue']?>">
Password: <input type="Text" size="5" name="searchvalue2" maxlength="4" value="<?=$HTTP_GET_VARS['searchvalue2']?>"> <input type="submit" value="Go">
</td></tr></table>
</form>
<?php
$dbcnx = @mysql_connect("XXXXXXX", "XXX", "XXX");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " . "database server at this time.</P>" ); exit();
}
mysql_select_db("XXXXX", $dbcnx);
if (! @mysql_select_db("XXXXX") )
{ echo( "<P>Unable to locate the " . "database at this time.</P>" );
exit();
}
$searchterm = $HTTP_GET_VARS['searchvalue'];
$searchterm2 = $HTTP_GET_VARS['searchvalue2'];
$result = mysql_query("SELECT * FROM dealern WHERE dealerno = '$searchterm' AND password = '$searchterm2'",$dbcnx);
if ($result) {
header('Location: /loggedin.php');
exit;
}
else {
..
}
?>