How to replace session_register() for PHP 5.4+
out of the blue I was getting the following error when logging in to one
of my sites:
Call to undefined function session_register()
After some research I saw that session_register() is deprecated after PHP
5.4. I checked in my hosting control panel, and sure enough it says
current version I'm running is PHP 5.4.19. I assume they just forced an
upgrade which is why this problem seemed to occur out of the blue.
I looked through several Stack Overflow posts and reviewed links to PHP
documentation. From what I gather, session_register() is deprecated and
should be replaced with $_SESSION instead.
Problem is, both of those already appear in my code. Here is the code in
my index.php file:
53 <? if ($username) {
54 session_register("ADMIN");
55 $_SESSION['ADMIN'] = $username;
56 ?>
So I hoped just by removing line 54 (the deprecated piece) then it should
work, however that is not the case. It broke the code when I did that.
Based on other posts I read HERE and HERE they seem to be saying that the
code I see in line 55 above should by itself do the trick. So I'm a bit
confused why it didn't work. If anyone can tell me what code I should use
I would sincerely appreciate it. The developer of the script is not really
offering support.
No comments:
Post a Comment