Jump to content

Recommended Posts

I have some code that runs fine on one web site and I'm using the same code on another one.

 

Example:

if (!$error) {

    $_SESSION['number_drivers'] = $_POST['number_drivers']; 

    $_SESSION['number_vehicles'] = $_POST['number_vehicles']; 

    $_SESSION['current_insurance'] = $_POST['current_insurance']; 

    $_SESSION['current_company'] = $_POST['current_company']; 

    $_SESSION['refferal'] = $_POST['refferal'];

    session_write_close();

    // go to step two

    header('Location: http://www.mywebsite.com/auto_quote2.php');

    exit;

  }

 

The sites are hosted by different companies. 

On site #1 everything runs just fine but on site #2 the saved session variables get lost.

 

I notice when I ran phpinfo() on both of them that on site #1 the session.save_path is set at no value while on site #2 it is set as C:\WINDOWS\Temp

 

Is this the reason I can't find the session variables on site #2 and if so how can I retrieve them?

 

Any help will be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/244807-session-variables-lost/
Share on other sites

On both the page you posted the partial code for and the page you are redirecting too, add the following three lines of code immediately after the first opening <?php tag and tell us if there are any php errors reported when you try your code -

 

ini_set("display_startup_errors", "1");
ini_set("display_errors", "1");
error_reporting(-1);

 

Also, is there any chance that you are redirecting back and forth between pages that have and don't have the www. on the URL?

For the first repy

 

I made the changes an here is the only error I got

Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-7.0/DST' instead in C:\Inetpub\vhosts\myinsuranceagency.com\httpdocs\my_copywrite.php on line 6

1966-2011 My Insurance Agency. All Rights Reserved

 

For the second reply

I might not have been clear, the pages auto_quote1.php and auto_quote2.php  reside on two different domains running through different Hosting companes running identical code.  I'm not trying to send from one domain to the other.  It's just that it works fine on one but not the other

 

auto_quote2.php uses session variables created in auto_quote1.php

 

If you didn't get any session_start related php errors, it is likely that the session is being started, assuming your session_start statement(s) are being executed in your code.

 

Any chance you are using short open tags in some included files so that part of your php code is not being seen as being php code?

 

Are you getting the PHPSESSID cookie in your browser?

 

What about this question that was asked -

Also, is there any chance that you are redirecting back and forth between pages that have and don't have the www. on the URL?

 

Also, any chance that the path to the page with the code you posted is different than the path to the auto_quote2.php page you are redirecting to?

No one here asked what the session.name is set to.

 

However, someone has been asking you specific questions, twice for one of them, that would pin down what could be causing the problem. Without specific feedback from you to let us know what you are doing (urls/paths) and what part might be working (such as getting the session id cookie in your browser), no one here can help you.

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.