The forms action= is set to $_SERVER[PHP_SELF], and when incorrect information is input, the error information is displayed, so the code is working, but if you put in the correct information it just refreshes the page!
I have posted the code at the top of the web page below. I am using PHP5.
Code: Select all
<?php
include("includes/dbconn.inc");
include("includes/funclib.inc");
$message_header ="<span class='style16'><b><BR><BR>We were unable to complete your login due to the following error(s):<b><BR></span>";
if (array_key_exists('actionflag',$_POST))
{
$actionflag=$_POST['actionflag'];
$login=$_POST['login'];
$password=$_POST['password'];
$password2=$_POST['password2'];
}
if(isset($actionflag))
{
if(!$login || !$password || !$password2)
$message = "<font size=1 color='#CC0000'>You must fill in all fields before applying<BR></font> \n";
if($password!=$password2)
$message .= "<font size=1 color='#CC0000'>Your passwords did not match<BR></font> \n";
if(strlen($password) >
$message .= "<font size=1 color='#CC0000'>Your password must be less than 8 characters<BR></font> \n";
if (!preg_match('/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/',$login))
$message .= "<font size=1 color='#CC0000'>Please enter a valid email address</font>" ;
if(getRow("user_details","username", $login))
$message .= "<font size=1 color='#CC0000'>The email address " .$login. " has already been used. Please contact us if you wish to make another application<BR></font> \n";
if(!$message)
{
$id = newUser($login, $password);
cleanMemberSession($id, $login, $password);
if ($_GET["button"] == 1)
{
header("Location:page1.php".SID);
exit();
}
if ($_GET["button"] == 2)
{
header("Location:page2.php".SID);
exit();
}
if ($_GET["button"] == 3)
{
header("Location:page3.php".SID);
exit();
}
if ($_GET["button"] == 4)
{
header("Location:page4.php".SID);
exit();
}
if ($_GET["button"] == 5)
{
header("Location:page5.php".SID);
exit();
}
if ($_GET["button"] == 6)
{
header("Location:page6.php".SID);
exit();
}
}
?>Hope someone can help.