Jump to content

$_SESSIONS JUST NOT WORKING


etnastyles

Recommended Posts

ahh ripping my hair out here, so now wondering if anyone else has had this issue..

 

I have just moved a site from a dev box to a live box.

 

the problem im having is with sessions - the login page sets 5 session values and the second page checks to see if these have been set and acts accordingly - for some reason the season values which i now are being set before i do a header(location change) are just not sent to the second page.  I have tried doing a basic test with to demo pages to see if the session values pass from one page to another. so i created a demo page that passed the session value "test sessions" to the other page - this worked...

 

so i went back to my original pages and tried again - now the second page still didnt see any of the 5 values that i was trying to set but for some reason picked up the "test session" value from the test pages...

 

this is the php.ini form the dev box

----------------------------------------------

session

Session Support enabled

Registered save handlers files user sqlite

Registered serializer handlers php php_binary wddx

Directive Local Value Master Value

session.auto_start Off Off

session.bug_compat_42 Off Off

session.bug_compat_warn On On

session.cache_expire 180 180

session.cache_limiter nocache nocache

session.cookie_domain no value no value

session.cookie_httponly Off Off

session.cookie_lifetime 0 0

session.cookie_path / /

session.cookie_secure Off Off

session.entropy_file no value no value

session.entropy_length 0 0

session.gc_divisor 1000 1000

session.gc_maxlifetime 1440 1440

session.gc_probability 1 1

session.hash_bits_per_character 5 5

session.hash_function 0 0

session.name PHPSESSID PHPSESSID

session.referer_check no value no value

session.save_handler files files

session.save_path no value no value

session.serialize_handler php php

session.use_cookies On On

session.use_only_cookies Off Off

session.use_trans_sid 0 0

 

and this is the live box

-----------------------------------------------

session

Session Support enabled

Registered save handlers files user sqlite

Registered serializer handlers php php_binary wddx

 

Directive Local Value Master Value

session.auto_start Off Off

session.bug_compat_42 Off Off

session.bug_compat_warn On On

session.cache_expire 180 180

session.cache_limiter nocache nocache

session.cookie_domain no value no value

session.cookie_httponly Off Off

session.cookie_lifetime 0 0

session.cookie_path / /

session.cookie_secure Off Off

session.entropy_file no value no value

session.entropy_length 0 0

session.gc_divisor 1000 1000

session.gc_maxlifetime 1440 1440

session.gc_probability 1 1

session.hash_bits_per_character 5 5

session.hash_function 0 0

session.name PHPSESSID PHPSESSID

session.referer_check no value no value

session.save_handler files files

session.save_path C:\WINDOWS\Temp C:\WINDOWS\Temp

session.serialize_handler php php

session.use_cookies On On

session.use_only_cookies Off Off

session.use_trans_sid 0 0

 

 

they look the same - just cant figure this one out -

Link to comment
Share on other sites

yes 100% sure - the sites worked on the dev box which looks the same as the live box

 

the login page does a few things - it destroys any sessions that are created - and then starts a new session_start - before logged this user in a setting the session values..

 

the second page does a session _start then test the passed sessions

Link to comment
Share on other sites

1st page is setting the following when i do a print

Array ( ) Array ( [loggedinAccountID] => 2 [loggedinClientID] => 1 [loggedinProvider] => Contender [admin] => 0 [user] => 1 )

 

second page is displaying the following when i do a dump

array(0) { } array(0) { }

:confused: :confused: :confused: :confused: :confused: :confused:

 

Link to comment
Share on other sites

page 1

if (isset($_SESSION)) { session_destroy(); }

/* set the cache limiter to 'private' */

 

 

session_start();

 

unset($_SESSION['admin']);

unset($_SESSION['user']);

unset($_SESSION['loggedinAccountID']);

unset($_SESSION['loggedinClientID']);

unset($_SESSION['loggedinProvider']);

unset($_SESSION['itunesID']);

unset($_SESSION['media_type']);

 

 

/*****************************************************************************/

/* Load all external page definistions and functions.*/

/*****************************************************************************/

require_once('scripts/debug.php');

require_once('scripts/defs.php');

require_once('scripts/routines.php');

require_once('scripts/database.php');

unregister_globals();

 

$errors = NULL;

 

$date = date("Y-m-d");

$time = date("H:i:s"); 

 

echo "print out all sessions now:::<br/>";

print_r($_SESSION);

 

 

/*****************************************************************************/

/*****************************************************************************/

if(isset($_REQUEST['username'])) { $username = $_REQUEST['username']; }

if(isset($_REQUEST['password'])) { $password = $_REQUEST['password']; }

 

if(isset($_POST['devsubmit']))

{

if( empty($username) && empty($password) )

{

$errors['error_user_pass'] = "username and password";

}

else if ( empty($username) && !empty($password) )

{

$errors['error_user'] = "username";

}

else if ( !empty($username) && empty($password) )

{

$errors['error_pass'] = "password";

}

}

   

/*****************************************************************************/

/*****************************************************************************/   

if(isset($_POST['devsubmit']) && $errors == NULL)

    {

    if (($connection = getAccountsConnection()) != NULL)

        {

        if(!$login_results = getLoginDetails(mysql_escape_string(trim($username)), mysql_escape_string(trim($password)), $connection))

            {

            debug("error:::no login results returned....what so ever..");

            header("location: login.php");

            }

        else

            {

            $login_details = getLoginDeatilsByLoginID($login_results[TABLE_ACCOUNT__LOGIN_ID], $connection);

            /*****************************************************************************/

            /*****************************************************************************/

            if ($login_results[TABLE_ACCOUNT__ADMINISTRATOR_ID] == 1)

                {

                $_SESSION['loggedinAccountID']  = $login_results[TABLE_ACCOUNT__ACCOUNT_ID];

                $_SESSION['admin']  = 1;

                $_SESSION['user']  = 0;

                updateClientLastLoginDetails($login_results[TABLE_ACCOUNT__ACCOUNT_ID], $login_results[TABLE_ACCOUNT__LOGIN_ID], $date, $time, $connection);

                header("location: aselection.php");

                }

           

            /*****************************************************************************/

            /*****************************************************************************/

            if ($login_results[TABLE_ACCOUNT__ADMINISTRATOR_ID] == 0)

                {

                $_SESSION['loggedinAccountID']  = $login_results[TABLE_ACCOUNT__ACCOUNT_ID];

                $_SESSION['loggedinClientID']  = $login_results[TABLE_ACCOUNT__CLIENT_ID];

                $_SESSION['loggedinProvider']  = $login_details[TABLE_LOGIN__PROVIDER];

                $_SESSION['admin']  = 0;

                $_SESSION['user']  = 1;

                updateClientLastLoginDetails($login_results[TABLE_ACCOUNT__ACCOUNT_ID], $login_results[TABLE_ACCOUNT__LOGIN_ID], $date, $time, $connection);

               

                //print_r($_SESSION);

               

                //sleep(10);

               

                header("location: selection.php");                                                               

                //var_dump($HTTP_SESSION_VARS);

 

                }               

            }

        }

    }

 

 

page 2

 

 

session_start(); 

if (empty($_SESSION['user']))

{

header("location: login.php");     

}

 

 

Link to comment
Share on other sites

yeah thanks for your reply - i saw that too just trying something - i think i might have found the issue.. when looking at the phpinfo docs of the different servers i noticed that the new windows environment is running session_save_path @ c:\windows\temp or something like that and it should be c:/windows/temp

 

path. For example, ‘/tmp’ will be ‘C:/tmp’ in Windows. It’s also recommended to use forward slash (/) in the path to the folder instead of usual backslash (\).

 

 

http://www.mydigitallife.info/2007/11/29/fix-session-save-path-red-unwritable-when-installing-joomla/

Link to comment
Share on other sites

this has not fixed anything super :confused: :confused:

 

here are the two php.ini docs

live

session.auto_start Off Off

session.bug_compat_42 Off Off

session.bug_compat_warn On On

session.cache_expire 180 180

session.cache_limiter nocache nocache

session.cookie_domain no value no value

session.cookie_httponly Off Off

session.cookie_lifetime 0 0

session.cookie_path / /

session.cookie_secure Off Off

session.entropy_file no value no value

session.entropy_length 0 0

session.gc_divisor 1000 1000

session.gc_maxlifetime 1440 1440

session.gc_probability 1 1

session.hash_bits_per_character 5 5

session.hash_function 0 0

session.name PHPSESSID PHPSESSID

session.referer_check no value no value

session.save_handler files files

session.save_path C:\WINDOWS\Temp C:\WINDOWS\Temp

session.serialize_handler php php

session.use_cookies On On

session.use_only_cookies Off Off

session.use_trans_sid 0 0

 

 

local

session.auto_start Off Off

session.bug_compat_42 On On

session.bug_compat_warn On On

session.cache_expire 180 180

session.cache_limiter nocache nocache

session.cookie_domain no value no value

session.cookie_httponly Off Off

session.cookie_lifetime 0 0

session.cookie_path / /

session.cookie_secure Off Off

session.entropy_file no value no value

session.entropy_length 0 0

session.gc_divisor 1000 1000

session.gc_maxlifetime 1440 1440

session.gc_probability 1 1

session.hash_bits_per_character 5 5

session.hash_function 0 0

session.name PHPSESSID PHPSESSID

session.referer_check no value no value

session.save_handler files files

session.save_path c:/wamp/tmp c:/wamp/tmp

session.serialize_handler php php

session.use_cookies On On

session.use_only_cookies Off Off

session.use_trans_sid 0 0

 

Link to comment
Share on other sites

this problem i was having was that i had a header being loaded into the page after the <body> tag

when i removed this the sessions started to work again..wtf - never seen this issue before - can anyone shed some light on this issue...

 

 

function loginheaderer()

{

  $header = "<div id=\"masthead\">

        <div id=\"logo\">

            <a title=\"Return to the home page\" href=\"#\"/></a>

        </div>

        <ul id=\"main-nav\" class=\"clearfix\">

            <li class=\"hidden\">

                <a href=\"#accesscontent\">Skip to content</a>

            </li>

            <li id=\"masthead_whatWeDo\" class=\"whatWeDo\">

                <a href=\"#\">What we do</a>

                <div id=\"servicesSubMenu\" style=\"display: none;\">

                    <ul>

                        <li style=\"margin-right: 60px;\">

                            <h3>Digital</h3>

                            <ul>

                                <li>

                                    <a href=\"VOD-IPTV-delivery.aspx\">VOD/IPTV Delivery</a>

                                </li>

                                <li>

                                    <a href=\"digital-distribution.aspx\">Digital Distribution</a>

                                </li>

                                <li>

                                    <a href=\"digital-cinema.aspx\">Digital Cinema</a>

                                </li>

                            </ul>

                            <h3>Disc</h3>

                            <ul>

                                <li>

                                    <a href=\"blu-ray-duplication.aspx\">Blu-ray</a>

                                </li>

                                <li>

                                    <a href=\"dvd-duplication.aspx\">DVD</a>

                                </li>

                                <li>

                                    <a href=\"cd-duplication.aspx\">CD</a>

                                </li>

                                <li>

                                    <a href=\"authoring-menu-design.aspx\">Authoring and Menu Design</a>

                                </li>

                                <li>

                                    <a href=\"packaging.aspx\">Packaging Gallery</a>

                                </li>

                                <li>

                                    <a href=\"artwork.aspx\">Artwork</a>

                                </li>

                            </ul>

                            <h3>Tape</h3>

                            <ul>

                                <li>

                                    <a href=\"dubbing.aspx\">Dubbing</a>

                                </li>

                                <li>

                                    <a href=\"conversions.aspx\">Conversions</a>

                                </li>

                                <li>

                                    <a href=\"editing.aspx\">Editing</a>

                                </li>

                                <li>

                                    <a href=\"QC-QAR.aspx\">QC/QAR</a>

                                </li>

                            </ul>

                            <h3>Flash memory</h3>

                            <ul>

                                <li>

                                    <a href=\"usb-branding-duplication.aspx\">USB Branding and Duplication</a>

                                </li>

                                <li>

                                    <a href=\"usb-gallery.aspx\">USB Gallery</a>

                                </li>

                            </ul>

                        </li>

                        <li>

                    <h3>

                    <a href=\"licensing-content.aspx\">Licensing content </a>

                    </h3>

                    <h3>Accessibility</h3>

                    <ul>

                    <li>

                    <a href=\"subtitling.aspx\">Subtitling</a>

                    </li>

                    </ul>

                    <h3>Security</h3>

                    <ul>

                    <li>

                    <a href=\"copy-protection.aspx\">Copy Protection</a>

                    </li>

                    <li>

                    <a href=\"forensic-watermarking.aspx\">Forensic Watermarking</a>

                    </li>

                    </ul>

                    <h3>

                    <a href=\"secure-library-storage.aspx\">Library</a>

                    </h3>

                </li>

            </ul>

        </div>

        </li>

            <li id=\"masthead_caseStudies\">

                <a href=\"casestudyList.aspx\">Our work</a>

            </li>

            <li id=\"masthead_Blog\">

                <a href=\"/blog/\">Blog</a>

            </li>

            <li id=\"masthead_contactUs\">

                <a href=\"contact.aspx\">Contact us</a>

            </li>

        </ul>

    </div>";               

    return($header);

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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