OK a bit complicated so I will try.
I have a login page (shown below)
<?php
session_start();
/* Hide this information from the browser
<!--
'********************************************************
'* Author: William B Wood
'* Dated: 29 Jun 2009
'* Program Name: login.php
'* Program Description: login for Databases by Bill
'* stored path: /login
'* Called by: /welcome.php
'* Modifications: First Draft.
'*
'********************************************************
--> */
// session_destroy();
include('../functions/dbb_fns.php');
if ($_REQUEST['usrname'] == ""
{
draw_title("Login Page for Databases by Bill. ",50);
echo "<html>
<LINK href=\"../css/dbb_style.css\" type=\"text/css\" rel=\"stylesheet\">
<FORM name=\"frmlogin\" method=\"POST\" action=\"loginprocess.php\">
<body bgcolor=\"#COCOCO\" onLoad=\"frmlogin.usrname.focus();\"
<TABLE cellspacing=0 cellpadding=4 width=\"50%\" border=0 align=\"center\">
<TR>
<TD align=\"center\"><center><img src=\"[
localhost]\"></center></TD>
</TR>
<TR>
<TD> </td>
</TR>
</table>
<TABLE align=\"center\" cellspacing=0 cellpadding=4 width=\"50%\" border=0>
<TR>
<TD valign=top><table width=\"100%\" border=0></td>
</tr>
<tr>
<td align=\"right\">User Name: </p></td>
<td align=\"left\"><input name=\"usrname\" type=\"text\" value=\"$usrname\" size=14 maxlength=25></td>
</tr>
<tr>
<td align=\"right\">Password: </p></td>
<td align=\"left\"><input name=\"userpwd\" type=\"password\" size=14 maxlength=25></td>
</tr>
<tr>
<td colspan=2> </td>
</tr>
<tr>
<TD align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Submit\">
<TD align=\"left\"><input type=\"button\" value=\"Cancel\" onClick=\"window.location='/dbb/welcome.php?usrname=';\">
</tr>
</table>
</body>
</FORM>
</html>";
} else {
header("Location: [
localhost][usrname]"
;
exit;
}
?>
All I am trying to do is pass the login name and password to the loginprocess. If there is a variable then I will check it to see if the person is authorized and resume work from there. If not then I send them back to the beginning. Next page is the Loginprocess.
<?php
session_start();
/* Hide this information from the browser
<!--
'********************************************************
'* Author: William B Wood
'* Dated: 29 Jun 2009
'* Program Name: login.php
'* Program Description: login for the renters to establish usernames
'* stored path: /login
'* Called by: /welcome.php
'* Modifications: First Draft.
'*
'********************************************************
--> */
//session_destroy();
include('../functions/dbb_fns.php');
$msg = "<br>";
echo "User name = ".$_REQUEST['usrname'].$msg;
echo 'User pwd = '$_REQUEST['userpwd'].$msg;
$err = "false";
if ($_REQUEST['usrname'] == ""
{
$err = "true";
$msg .= "Must provide usrname, 6 chars min<br>";
}
if ($_REQUEST['userpwd'] == ""
{
$err = "true";
$msg .= "Must provide user password, 6 Chars min<br>";
}
if ($err == 'true') {
draw_title("Login Page for Databases by Bill. ",50);
echo "<html>
<LINK href=\"../css/dbb_style.css\" type=\"text/css\" rel=\"stylesheet\">
<FORM name=\"frmlogin\" method=\"post\" action=\"$_SERVER[PHP_SELF]\">
<body bgcolor=\"#COCOCO\" onLoad=\"frmlogin.usrname.focus();\"
<TABLE cellspacing=0 cellpadding=4 width=\"50%\" border=0 align=\"center\">
<TR>
<TD align=\"center\"><center><img src=\"[
localhost]\"></center></TD>
</TR>
<TR>
<TD> </td>
</TR>
</table>
<TABLE align=\"center\" cellspacing=0 cellpadding=4 width=\"50%\" border=0>
<TR>
<TD valign=top><table width=\"100%\" border=0></td>
</tr>
<tr>
<td align=\"right\">User Name: </p></td>
<td align=\"left\"><input name=\"usrname\" type=\"text\" value=\"$usrname\" size=14 maxlength=25></td>
</tr>
<tr>
<td align=\"right\">Password: </p></td>
<td align=\"left\"><input name=\"userpwd\" type=\"password\" size=14 maxlength=25></td>
</tr>
<tr>
<td colspan=2> </td>
</tr>
<tr>
<TD align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Submit\">
<TD align=\"left\"><input type=\"button\" value=\"Cancel\" onClick=\"window.location='http://localhost/dbb/welcome.php';\">
</tr>
</table>
</body>
</FORM>
</html>";
draw_ending("Please make corrections listed below".$msg,50);
} else {
echo "you are here!";
global $conn;
dbsetup();
// connect to database
// get first, last names for display/tests validity
$sql = "SELECT * FROM databill.users WHERE user_name = '$_REQUEST[usrname]' AND user_pass = '$_REQUEST[userpwd]';";
$results = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($results) == 1) {
$usrname = mysql_result($results,0,'user_name');
$fname = mysql_result($results,0,'fname');
$lname = mysql_result($results,0,'lname');
if ($lname == "" || $fname == ""
{
header("Location: dbb/authenticated/register/register.php?usrname=$_POST[usrname]&userpwd=$_POST[userpwd]"
;
exit;
} else {
header("Location: dbb/welcome.php?usrname=$_POST[usrname]"
;
exit;
}
} else {
header("Location: [
localhost][usrname]&userpwd=$_POST[userpwd]"
;
exit;
}
}
?>
Code is a bit long but it has to be to insure that someone can use the system. I only use this to store personal information etc. Once the person is authorized I have other code that sets his / her menus up to use the system. have been using this for many years on the internet with this exact code and after installing it on WampServer it has not worked. Thanks in advance for any and all help.