Urghh... Why does my script run on PHP Version 5.0.4 but not PHP Version 5.2.15

I’m a PHP newbie so treat me nice but this one is driving me nuts :o

I have the exact same login.php file running on two different servers and they have slightly different versions of PHP installed as follows:

  1. PHP Version 5.0.4 - version http://www.trafficpaymaster.com/tpm/phpversion.php
  2. PHP Version 5.2.15 - version http://www.dentistsinflorida.org/tpm/phpversion.php

The login works fine on the first server from here:
http://www.trafficpaymaster.com/tpm/login.php

Email: [email protected]
Pwd: test

But try it on the second server here:
http://www.dentistsinflorida.org/tpm/login.php

Correctly using the same email and password and it just loops round. Not the same as entering the wrong details in which case it throws up the correct message. It just loops.

Question: Why?
What have I got wrong for that later version of PHP?

Many thanks guys.

Naturally it would be sensible if I showed you the code, right here…


<?php
include "utils.php";

if (file_exists("password.php")) {
   include("password.php");
} else {
   header("Location: install.php");
   exit();
}

if ($_GET['step']=='remind') {
   $mes = "Hi there,
Thanks for requesting a password reminder.

----------------------------
Login: {$conf['script_url']}
Email: $username
Your password: $password
----------------------------

";
      $res = mail($username, "TPM Password Reminder ", $mes, "From: admin@{$conf['server_domain']}");
   if (! $res) {
      $res = mail($username, "TPM Password Reminder ", $mes, "admin@{$conf['server_domain']}");
   }
   AddMessage("Password emailed  to $username.");
}
if ($_REQUEST['login']) {
   if (! (
         $_POST['username']
         &&
         $_POST['password']
   )) {
      AddError("Please enter email and password.");
   } else {
      if (
            isset($_POST['username'])
            &&
            isset($_POST['password'])
            &&
            ($_POST['username']==$username)
            &&
            ($_POST['password']==$password)
         )
      {
         setcookie ("admin", 1);
         header('Location: index.php');
      } else {
         AddError("Login Incorrect.");
      }
   }
   sleep(2);
}


	$title='Admin Login';
	include('header.php');

	echo "
	<table border='0' width='100%' height='100%'>
	<tr><td width='100%' align='center' valign='middle'>
	<p align='center'>


      <font color=red>{$strs['errmes']}</font>{$strs['infomes']}

   <form method='post' action=\"login.php\"
    onSubmit=\"return CheckFieldsForm(this, new Array('username', 'password'));\"
   >
      Email<br>
      <input name='username' size='35'><br>
      Password<br>
      <input type='password' name='password' size='35'><br><br>
      <input class='button' name='login' type='Submit' value='Login'>
	</form>

   <br/>
   <a href=\"login.php?step=remind\">Remind Password</a>

   </p>


	</td></tr>
	</table>";



?>
Sponsor our Newsletter | Privacy Policy | Terms of Service