i m working with sessions..
i have problem with sessions
here is my coding
"
<?php
session_register("admin_id");
if($_SESSION["admin_id"]=="")
{
header("location: login.php");
}

?>
"
i want to register a session

but when i use session_register function i got error ""Deprecated: Function session_register() is deprecated in C:\xampp\htdocs\xampp\c\admin\session_check.php on line 2""

help me..how can i register session without this error...

First of all you need to put session_start(); statement just after opening the php tags, on top of everything on that page.

Secondly, to assign values to Session variables please use the following statement:

[B]$_SESSION['admin_id'] = "something";[/B]

to check session data Following is fine:

if($_SESSION["admin_id"]=="")
{
header("location: login.php"); 
}

If it worked for you then please mark the thread as solved (link beneath the edit box)

Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.