I'm interested as to what functions you are referring to. I call them because that is how I call them in the HTML code below. The above script is just the php backed. In the script below i call it as so:
Updated entire Index.php file
This is so that the login and such all takes place in the index.php page. I tried setting the refresh string to a variable, the printing that, but it wouldn't print.
~Brett
EDIT
I edited the entire index.php file to this, and still the same problem:
Index.php
<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'].'/review/scripts/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/review/scripts/login.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<title>the Ridge Swim Club :: Mount Airy, MD</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="title" content="the Ridge Swim Club" />
<meta name="author" content="Brett Patterson" />
<meta name="subject" content="Fun in the Sun with the family" />
<meta name="language" content="en" />
<?
switch($renum){
case 0:
echo'';
break;
case 1:
echo'<meta http-equiv="refresh" content="2; [url]http://www.ridgeswimclub.org/review/main.php[/url]" />'."\n";
break;
}
?>
<link rel="stylesheet" type="text/css" href="styles/rsc.css" />
</head>
<body>
<div id="wrap">
<div id="floatstop">
<div id="login">
<?
switch($errno){
case 0:
echo'<form name="login" method="POST">'.
'<input type="hidden" name="f" value="login" />'.
'Username: <input type="text" name="user" size="25" /><br />'.
'Password: <input type="password" name="pass" size="25" /><br />'.
'Your Name: <input type="text" name="voter" size="20" /><br /><font style="font-size: 0.9em; font-weight: normal;">All Fields Required</font><br />'.
'<input type="submit" value="Login">'.
'</form>';
break;
case 1:
echo'Username not found!!<br />'.
'<form name="login" method="POST">'.
'<input type="hidden" name="f" value="login" />'.
'<font style="color: #f00; font-weight: bold;">Username:</font> <input type="text" name="user" size="25" /><br />'.
'Password: <input type="password" name="pass" size="25" /><br />'.
'Your Name: <input type="text" name="voter" size="20" /><br /><font style="font-size: 0.9em; font-weight: normal;">All Fields Required</font><br />'.
'<input type="submit" value="Login">'.
'</form>';
break;
case 2:
echo'Invalid Password!!<br />'.
'<form name="login" method="POST">'.
'<input type="hidden" name="f" value="login" />'.
'Username: <input type="text" name="user" size="25" /><br />'.
'<font style="color: #f00; font-weight: bold;">Password:</font> <input type="password" name="pass" size="25" /><br />'.
'Your Name: <input type="text" name="voter" size="20" /><br /><font style="font-size: 0.9em; font-weight: normal;">All Fields Required</font><br />'.
'<input type="submit" value="Login">'.
'</form>';
break;
case 3:
echo'Name field is Required!!<br />'.
'<form name="login" method="POST">'.
'<input type="hidden" name="f" value="login" />'.
'Username: <input type="text" name="user" size="25" /><br />'.
'Password: <input type="password" name="pass" size="25" /><br />'.
'<font style="color: #f00; font-weight: bold;">Your Name:</font> <input type="text" name="voter" size="20" /><br /><font style="font-size: 0.9em; font-weight: normal;">All Fields Required</font><br />'.
'<input type="submit" value="Login">'.
'</form>';
break;
case 4:
echo'<br />Successfully logged in.<br />You will be redirected in 2 seconds.<br />';
echo("\n".$_SEESION['user'].' || '.$_SESSION['login']."\n");
break;
}
?>
</div>
</div>
</div>
</body>
</html>
Login.php
<?php
if($_REQUEST['f'] != "login"){
$errno = '0';
$renum = '0';
}
else{
if(!isset($_REQUEST['voter']) || $_REQUEST['voter'] == '' || $_REQUEST['voter'] == ' '){
$errno = '3';
$renum = '0';
}
else{
$puser = $_REQUEST['user'];
$ppass = $_REQUEST['pass'];
$sql = "SELECT * FROM `Users` WHERE username='$puser' LIMIT 1";
$result = mysql_query($sql);
if(mysql_num_rows($result) == 0){
$errno = '1';
$renum = '0';
}
else{
$item = mysql_fetch_array($result);
$dbpass = $item['password'];
if($dbpass != md5($ppass)){
$errno = '2';
$renum = '0';
}
else if($dbpass == md5($ppass)){
session_start();
$_SESSION['user'] = $_SERVER['REMOTE_ADDR'].'_'.$_REQUEST['voter'];
$_SESSION['login'] = 'true';
$errno = '4';
$renum = '1';
}
}
}
}
?>
The session variables are not being set. Well, actually, the $SESSION['login'] is being set, and returning as I expected. The $SESSION['user'] is not being set for some odd reason. I would figure that it would be considering that it's running at the same time as the other one.
Any ideas would be greatly appreciated.
~Brett