Jump to content

php login system: depreciation error


mcrackin

Recommended Posts

This is the error:

 

Deprecated: Function session_is_registered() is deprecated in login_success.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at login_success.php:3) in login_success.php on line 4
 

 

This is the code I am using:

 

<?php
session_start();
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>
 
<html>
<body>
Login Successful
</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/279013-php-login-system-depreciation-error/
Share on other sites

Well the purpose of session_is_registered() was to see if that session var was set.  Use this:

if(!isset($_SESSION['myusername'])){
   header("location:main_login.php");
}

 

And always exit after a header redirect.

if(!isset($_SESSION['myusername'])){
   header("location:main_login.php");
   exit();
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.