Login Stopped Working After Server Migration php 5.2 to 5.3


Hi. Servage just did a big server migration just before Christmas and they also no longer use php 5.2. It now has to be 5.3 or higher. My site must be on 5.2 as I keep getting the errors “Deprecated: Function session_register() is deprecated in /storage/content/81/1006481/angelsgatemovies.com/public_html/movies/UserValidateOld.php on line 19”, etc. I have no idea how to fix this. I’ve done a bunch of checking and have tried and tried to fix the file, but to no avail. I could really use the help as I can’t get into my website and neither can my members. Here is my original php file.

if (session_id() == "") session_start();
// Cancel check
if (isset($_POST['cancel'])){         // If cancel button clicked
echo "<script type='text/javascript'>document.location.href='../Pages/CancelledLogin.htm'</script>\n";
// End of cancel check

// Login check
if (isset($_POST['login'])){          // If OK button clicked
$UserIp = $_SERVER['REMOTE_ADDR'];    // Get the ip number
$UserName = $_POST["User"];           // Get the username
$UserPass = $_POST["Pass"];           // Get the password
//$EncryptedPassword = md5($UserPass);  // Encrypt password
$Loggedon = strtotime("now");         // Get the current time
$Views = 0;                           // Start counting the views
session_register('UserName');         // Register the username for use on any page
session_register('UserPass');         // Register the password for use on any page
//session_register('EncryptedPassword');// Register the encrypted password for use on any page
session_register('UserIp');           // Register i number
session_register('Loggedon');         // Register the logon time for use on any page
session_register('Views');            // Register the views counter
$_SESSION[username] = $UserName;      // Set session id to username
$_SESSION[password] = $UserPass;      // Set session id to password
//$_SESSION[encryptedpassword] = $EncryptedPassword;
$_SESSION[userip] = $UserIp;          // Ip Number
$_SESSION[loggedon] = $Loggedon;      // Time user logged on
$_SESSION[views] = $Views;            // Number of views
// End of login check

// Empty username check
echo "<Script Language='JavaScript'>";
echo "alert('                       Invalid Name!')";
echo "</script>";
echo "<script type='text/javascript'>document.location.href='movies.php'</script>\n";
// End of empty username check

// Empty password check
echo "<Script Language='JavaScript'>";
echo "alert('                     Invalid Password!')";
echo "</script>";
echo "<script type='text/javascript'>document.location.href='movies.php'</script>\n";
// End of empty password check

$Pas = "";
$ValidUser = 0;
$ValidPass = 0;

// Check if username exists
$UserList = fopen("../AdminPhp/DatFiles/MasterList.dat","r") or exit("Unable to open Temp file");
while (!feof($UserList)){
$Usr = fgets($UserList);
$UName = strtok($Usr,",");
$UPas = strtok(",");
if (trim($UName) == trim($UserName) && trim($UPas) == trim($UserPass)){    // Check if users name is in the list
// Add to log
$Logger = $UserName . "," . $UserPass . "," . $UserIp;
$File = fopen("../AdminPhp/DatFiles/UsersList.dat","a") or exit("Unable to open Temp file");
$b = fwrite($File,$Logger."\r\n");
// End of add to log
// Username check
if (!isset($UserName)){    // Check if its set
echo "<script type='text/javascript'>document.location.href='movies.php'</script>\n";
//if (strpos($UserIp,"125.27.") > 0){    // Check ip
//echo "<script type='text/javascript'>document.location.href='movies.php'</script>\n";
if ($ValidUser > 0){        // If users name and password are valid
$Visited = " ".trim($UserName).",".substr(date("hour"),12,(strlen($hour)-6)).",".$UserIp."\r\n";
$Frite = fopen("../AdminPhp/DatFiles/VisitorsLog.dat","a");
if (!empty($UserName)){
$a = fwrite($Frite,$Visited);
$TodaysVisitors = " ".trim($UserName).",".date("d").",".$UserIp."\n";
$pop = fopen("../AdminPhp/DatFiles/TodaysVisitorsLog.dat","a");
$b = fwrite($pop,$TodaysVisitors);
$TCount = 0;
$TFile = fopen("../AdminPhp/DatFiles/TodaysVisitorsLog.dat","r") or exit("Unable to open TodaysVisitorsLog file");
while (!feof($TFile)){
$Tshit[$TCount] = fgets($TFile);
$VisitorName = strtok($Tshit[$TCount],",");
$VisitorDay = strtok(",");
$VisitorIp = strtok(",");
$Vname[$TCount] = $VisitorName;
$Vday[$TCount] = $VisitorDay;
$Vip[$TCount] = $VisitorIp;
$TCount ++ ;
$Yesterday = date("d")-1;
for ($Ti1=0;$Ti1<=$TCount;$Ti1++){
if (strtolower($Vday[$Ti1]) == strtolower($Yesterday)){
// Remove yesterdays visitors
$TFound = 1;
// Check if a duplicate has been removed
if ($TFound == 1){
// Count removed duplicated
$TRemoved ++ ;
$TFound = 0;
// Remove Blank lines from the list
$Tshit= array_values($Tshit);
$TFile = fopen("../AdminPhp/DatFiles/TodaysVisitorsLog.dat","w") or exit("Unable to open TodaysVisitorsLog file");
// Write the cleaned sorted list to a new TodaysVisitorsLog.dat file
for ($Ti1=0;$Ti1<=$TCount;$Ti1++){
$Ta = fwrite($TFile,$Tshit[$Ti1]);
// Check for old session files
chdir("../tmpy");                         // Set the path containing the session files
foreach(glob("sess_*",GLOB_NOSORT) as $file) {        // Get each file
$count++;                                 // Count them
if ($count>0){
$files = glob("*");                       // Set the pattern (all files) in the directory
$deleted = 0;
$LoggedOn = 0;
for ($i2=0;$i2<=$count;$i2++){            // For each file
$files1 = $files[$i2];
if (file_exists($files1)>0){
$File = fopen($files[$i2],"r");
$aline = fgets($File);
$aline = str_replace(";",":",$aline);
$aline = str_replace("|s","",$aline);
$aline = str_replace("\"","",$aline);
$a = explode(":",$aline,14);
if (trim(strtolower($UserName)) == trim(strtolower($a[2]))){
$TimeNow = strtotime("now");
$LoggedOn = $a[10];
$Logofftime = $LoggedOn+3;
if($TimeNow > $Logofftime){                        // 1200 = 20 mins
// End of check for old session file

//Start of User log file, add user and number of days logged on
$UserLoggedOn = trim(strtolower($UserName));         // Set username to lowercase
$LogonLog = fopen("../AdminPhp/DatFiles/LoggedOn.dat","r");   // Open log file
while (!feof($LogonLog)){
$aline = fgets($LogonLog);
if (strlen($aline)>4){
$LoggedOnName[] = strtok($aline,",");                // Get logon name
$LoggedOnDate[] = strtok(",");                       // Get logon date
$LoggedOnCount[] = strtok(",");                      // Get logon count
fclose ($LogonLog);
$OldUser = 0;
// Check the array for the user who logged on and the days date
for ($Loggy=0;$Loggy<=$LogonCount;$Loggy++){
$LCName = trim(strtolower($LoggedOnName[$Loggy]));
if ($LCName == $UserLoggedOn && $LoggedOnDate[$Loggy] <> date("d-m-Y")){
$aa = $LoggedOnCount[$Loggy]+1;     // If the user has not logged on today increment the count
$LoggedOnCount[$Loggy] = $aa;
// Write the log file back with the new count added
$LogonLog1 = fopen("../AdminPhp/DatFiles/LoggedOn.dat","w");
for ($Loggy1=0;$Loggy1<=$LogonCount-1;$Loggy1++){
$Line = $LoggedOnName[$Loggy1].",".$LoggedOnDate[$Loggy1].",".$LoggedOnCount[$Loggy1] . "\r\n";
$b = fwrite($LogonLog1,$Line);
fclose ($LogonLog1);
// If the users name is not in the log file add it and start the count at 1
if ($OldUser == 0){
$LogonLog2 = fopen("../AdminPhp/DatFiles/LoggedOn.dat","a");
$Line1 = " " . $UserName . "," . date("d-m-Y") . ",1" . "\r\n";
$c = fwrite($LogonLog2,$Line1);
fclose ($LogonLog2);
// End of User log file

// Send to main page
echo "<script type='text/javascript'>document.location.href='../movies/Main.php'</script>\n";
session_destroy(); header("Location: ../movies/movies.php");   // send to login page



Just comment out the lines that start with session_register. You already have the Session variables correctly in place.

If your host is just now going to Php 5.3 its time ot get a new host. Even that is hundreds and hundreds of releases behind.

Since you are using MD5 hashing for passwords, expect that all the logins are already compromised.


Ok. I took away all the session_register words, but I don’t think I did it right. It just keeps bringing me back to the login screen. Could you please show me an example. Thank you.


See what your error log says. Commenting out the session_register code was just the minimum you needed to do.


I have tons and tons of lines that say: Function session_register() is deprecated


Sounds like you have some work to do then. They ALL need to go. Just make sure whatever you comment out has the session set like $_SESSION[‘someValue’]

You can actually just delete the session_register code. Of course before you do anything make a backup zip of all your files.

If you are not already doing so, set up a local development environment to do you work off. Do not work off the live server. I suggest you install Laragon and work from that.

You really need to put your app on a server with a current version of Php which is 7.3


Hi. I’ve tried a lot of things and changed things in the lines to try and make the site work. Nothing is working. Is there anyone here that could go into my control panel, check out my files and actually help to rewrite them? I have a little bit of money that I could pay up front, but not much. Or I could even make some payment arrangements after that. Anything. Please. I really need some help. Thanks.


PM me a zip file and I will take a look at it. If you cannot PM it here, put it on dropbox or some other file sharing site and send me the link.


I’m not sure which file or files you need. Could you let me know on that. And thanks benanamen.


I want ALL of it. Everything needed to run it.