PHP 5.6中的PHP代码

How can I for the best change this PHP code:

<?php
session_register("loginusername"); 
?>

and

<?php session_start(); 
$loginusername = $_SESSION['username']; 
$loginpassword = $_SESSION['password']; 
if(!session_is_registered(loginusername)) { 
header("location:fanion.php"); 
}
 ?>

to become no errors in PHP 5.6.

change ...
session_register("loginusername");
... to ...
$_SESSION['loginusername'] = $username;

... and change ...
if(!session_is_registered(loginusername))
... to ...
if (empty($_SESSION['loginusername']))

session_registered()

method is deprecated instated of you can use Global variable

 $_SESSION["USER_SESSION_NAME"]=session value;

you can check session is started or not by using

empty ( ) / isset ( )

method

if(isset($_SESSION[""USER_SESSION_NAME"]))
{
           //YOUR CODE
}