duanliao3826 2015-05-23 17:47
浏览 131

session_register和session_is_registered以及PHP 5.4+的问题

I am an unexperienced programmer that haven't been up to speed with PHP & SQL in a long time as I've been working with designing the last 5-6 years, however I recently discovered that the admin pages of a few websites I am hosting stopped working after PHP updated to 5.4+. I searched around and found a number of posts on the topic but haven't managed to solve the issue in my case. Again I haven't been working with PHP in a long time so consider me a complete beginner :)

I would be forever grateful if someone could clarify what I need to do in order to get this up and running again. Also, I know there are better ways to re-code the whole thing but I am not interested in this, all I want is an easy fix to make it work again (if there is one, that is).

Here's the initial error message I get:

Fatal error: Call to undefined function session_is_registered() in XXX on line 41

And here's the code (as a picture, as I didn't manage to paste it properly):

http://www.voidfaith.net/test.jpg

After this we have all the adminpage-code and at the end we have below:

http://www.voidfaith.net/test2.jpg

Any help with how I must replace session_register and session_is_registered on row 25 and 33 would be really appreciated.

  • 写回答

1条回答 默认 最新

  • dragonlew9876 2015-05-23 18:23
    关注

    The documentation of session_is_registered() states very clear, on a reddish background:

    Warning This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

    The same for the session_register() and session_unregister().

    Use the super-global $_SESSION[] to store and get the session values.

    $_SESSION['name'] = 'John Doe';
    // instead of:
    //    $name = 'John Doe';
    //    session_register('name');
    
    unset($_SESSION['name']);
    // instead of:
    //    session_unregister('name');
    
    isset($_SESSION['name'])
    // instead of:
    //    session_is_registered('name');
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?