Yes, I know we're going back a version...not my deal...
The problem I am having is that I have a little script that worked fine on 4.2.2 but does not work on 4.0.6. I have moved it to another server with 4.2.2 and it works fine, so it's not the migration process.
On 4.0.6, it constantly returns the error "Error! All fields are required", even though information was submitted.
Does anyone have any ideas? (Please no laughing at the code...I make no pretenses.)
<?php
//Test to see if cookies are enabled
if (!isset($CT)and!$submit) {
setcookie("testCookie", "thinMints");
header("Location: $PHP_SELF?CT=1");
exit;
}elseif(isset($testCookie) && ($testCookie == "thinMints")){
//--If they haven't submitted the form, just display it
if(!$submit){
$includeForm="yes";
//--If they leave the username or password blank, display a message and the form
}elseif(empty($_POST['username']) or empty($_POST['password'])){
$message="<b>Error!</b> All fields are required.";
$includeForm="yes";
//--If everything appears ok at first glance
}else{
include(".config");
$username=$_POST['username'];
$password=md5($_POST['password']);
//------See if username and password are in the database
if(!($link_id = mysql_connect($Host, $User, $Pass))) die(mysql_error());
mysql_select_db($DB);
$sql = "SELECT ID,permissions FROM $memberTable WHERE username='$username' AND password='$password' LIMIT 1";
if(!($result = mysql_query($sql))) die(mysql_error());
//------If the username and password are valid, set cookies and take them to the member home
if(mysql_num_rows($result)==1){
$row=mysql_fetch_row($result);
$ID="$row[0]";
$permissions="$row[1]";
setcookie("loginUsername",$username);
header("Location: $memberHome");
//------If the username and password are not valid, display a message and the form
}else{
$message="<b>Error!</b> Your login information was incorrect.";
$includeForm="yes";
}
}
//If cookies are not enabled, display a message and the form
}else{
$message="<b>Error!</b> Cookies must be enabled to log in.";
$includeForm="yes";
}
?>