is there any problem replacing this way
Posted: Wed Sep 24, 2008 6:13 am
ok just for the moment forgeting session hijacking factor....
suppose i do like this to check if user is logged in every page
if (!isset($_SESSION['name']) && !isset($_SESSION['level'])) {
do task in normal page give for to edit/delete if it is thier page using id on session
}
else
{
}
now rather writing code in each page if i replace it with function in fuctions.php
and do
function checklogin()
{
if (!isset($_SESSION['id']) && !isset($_SESSION['level'])) {
$var=1;
}
else
{
$var=0
}
return $var;
and now if i do
include functions
$logging=0;
$logging=checklogin();
if ($logging==1)
{
do task
}
else
{
donot do
}
so are there any problems?
how secure is it..?
any suggestion and modification.....
if global registers are on what can be problems..in this...
suppose i do like this to check if user is logged in every page
if (!isset($_SESSION['name']) && !isset($_SESSION['level'])) {
do task in normal page give for to edit/delete if it is thier page using id on session
}
else
{
}
now rather writing code in each page if i replace it with function in fuctions.php
and do
function checklogin()
{
if (!isset($_SESSION['id']) && !isset($_SESSION['level'])) {
$var=1;
}
else
{
$var=0
}
return $var;
and now if i do
include functions
$logging=0;
$logging=checklogin();
if ($logging==1)
{
do task
}
else
{
donot do
}
so are there any problems?
how secure is it..?
any suggestion and modification.....
if global registers are on what can be problems..in this...