Question

[Solved] Fatal error: Call to undefined function session_register()

session_register("username"); // session checker for pages
$_SESSION['username']= $username; // storing username in session

i am doing a php login system but when i click login system i go this error

Fatal error: Call to undefined function session_register() in C:xampphtdocsloginscriptauth_check.php on line 24

i am using php5.3 how can i solve this problems

Enquirer: brianc

||

Solution #1:

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

Ref: http://www.php.net/manual/en/function.session-register.php

Dont use session_register(), session_is_registered() and session_unregister()

You can use $_SESSION[] instead of that

Like as mentioned below:

$_SESSION['username']= "Your value";
Respondent: Krish R

Solution #2:

Do not use session_register("myusername"); instead use

$_SESSION['username']= "username"; // storing username in session

session_register function has been deprecated since PHP5.3

Respondent: Noor

Solution #3:

Use isset($_SESSION['username']) for check session Like as:

if(!isset($_SESSION['username'])){
   // go to login page code here.
    // in login page, store data into session, use following:
    $_SESSION['username']="username";
}
else{
   $username=$_SESSION['username'];// get previous session and go your project page
}

session_register() function has been deprecated since PHP5.3

Respondent: Ahosan Karim Asik

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy