Jump to content

Website Server was upgraded to PHP 5.4.30 and now doesn't work


Learning

Recommended Posts

I am a newbie to this forum and a real beginner on PHP

 

After the website went down after the server upgrade to 5.4.30, parts came back but in other places got 2 error messages.

 

1. Home page - Login by members

Fatal Error: call to undefined function session_is_registered() in member_auth_fns.php on line 28

 

2. Admin - Login by me

Parse error: syntax error, unexpected '$_SESSION' (T_VARIABLE), expecting '(' in contacts/user_auth_fns.php line 28

 

I appreciate that the old php was based on session_start (), session_register, session_is_registered, session_unregister, but these were all deprecated in 5.4.30.

 

So to put it bluntly, after trying to interpret the help manuals etc I found a backup I had taken before this and in respect of the Home page login and the admin login what I think was the previous relevant code was before the event

 

<?

function login ($member_name, $password)

// check member and password with db

// if yes, return true

//else return false

{

// connect to db

$conn = db_connect();

 

if (!$conn) return 0;

 $result = MySQL_query(select * from people

                                                     where username='$member_name'

                                                      and password = '$password' ");

if (!$result) return 0;

if (MySQL_num_rows($result)>0)

   return 1;

else

    return;

}

 

function check_auth_member

Some text here

global $auth_member;

if ( (session_is_registered("auth_member")) && (isset($auth_member)) )

return true;

else

return false

}

?>

 

 

Anyone who can give me the revised code for this it would be greatly appreciated

 

Learner

 

Link to comment
Share on other sites

That code is in some serious need of being thrown out.

 

The session_is_registered function is deprecated.

The mysql_* extension is deprecated

Short tags have long been disabled by default.

 

And in general it's just poor code. Moving forward, you might want the code maintained.

  • Like 1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.