Jump to content

[SOLVED] Help! - Session Managment?


tsilenzio

Recommended Posts

I made a similar but way more advance function php - page to manage with all the session stuff but I was wondering if i do somethign like include('includes/functions_session.php'); at the top of index.php or login.php if it will do everythign fine since its in a function. Ontop of that note will isset($_SESSION['someName']) and !(isset($_SESSION['someName'])) work with conditional things like IF statments

 

<?php
/********************************************************
* functions_session.php
*
* Deals with everything involving sessions
********************************************************/

//
// Start the session and if this is first time running then setup
// default values into what variables will later be used
//
function sessionStart()
{
    if(start_session())
    {
        if((!isset($_SESSION['Managed'])) || ($_SESSION['Manged'] === false))
        {
            //
            // Update user's cache so it will expire in one hour
            //
            cacheUpdate(60);

            //
            // Assign default values to session array
            //
            $_SESSION['LoggedIn'] = 0;
            $_SESSION['UserID'] = 1;
            $_SESSION['AuthID'] = 0;
            $_SESSION['Error'] = 'None';
            $_SESSION['Managed'] = true;
        }
    }
}

//
// Update the amount of time that the session variable will be autodeleted
// if for some reason no value is provided set a default time of 60 minutes
//
function cacheUpdate($time = 60)
{
    session_cache_expire($time);
}

?>

 

Thank you so much for your time! :)

 

  - tsilenzio

Link to comment
https://forums.phpfreaks.com/topic/62785-solved-help-session-managment/
Share on other sites

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.