Session variables and IE7

Session variables and IE7

am 05.09.2007 19:46:33 von bulldog8

I have a web page set up for doctors to request vacation. All was
working well until they upgrade their home PCs to IE7, at which time
the variables lose their values when they click submit. We've allowed
cookies from this site and allowed JS to run in an attempt to fix the
issue, but no luck.

I use a javascript calendar and additional javascript to make sure the
end date > start date.

The user can still use the calendar tool to select dates and the js
still correctly ensures the end date and num of days requested fields
are populated correctly, so I am looking at my PHP code first.

Is there some error in my handling of session variables?

PHP code:


/**
* request.php
*
* Sends an email containing a vacation request and posts to database.
*
*/

session_start();

//Let's see if they want to go to another page first
if (strlen($btn) > 0) {
//save this pages info in case they come back
$rqst['Priority'] = $Priority;
$rqst['txtStartDate'] = $txtStartDate;
$rqst['txtEndDate'] = $txtEndDate;
$rqst['body'] = $body;
$rqst['txtNumReq'] = $txtNumReq;

$_SESSION['rqst'] = $rqst;

if (($btn == "recruit") || ($btn == "info")) {
}
else {
require_once('../source/validate.php');
require_once('../fn/vac_data.php');
require_once('../cfg/config.php');
require_once('../fn/page_header.php');

//If they were here before lets get their input
if (isset($_SESSION['rqst'])) {
$rqst = $_SESSION['rqst'];
$Priority = $rqst['Priority'];
$txtStartDate = $rqst['txtStartDate'];
$txtEndDate = $rqst['txtEndDate'];
$body = $rqst['body'];
$txtNumReq = $rqst['txtNumReq'];
}

$vdays = 0;
if (!isset($_SESSION['vdays'])) {
$_SESSION['vdays'] = 0;
}
else {
unset($_SESSION['vdays']);
$_SESSION['vdays'] = 0;
}


$mailbox = 'INBOX';
if (isset($btnReset)) {
//Check to make sure this person is authorized
$imapConnection = fnimap_login($username, $key,
$imapServerAddress,$imapPort, 0);
$Priority = '1';
$txtStartDate = '';
$txtEndDate = '';
$body = '';
$txtNumReq = 0;

showInputForm();
fnimap_logout($imapConnection);
}
/* Send the Request */
elseif (isset($send)) {
if (checkInput(false)) {
$chkmsg = '';
$_SESSION['chkmsg']="";
$chkmsg = fnCheckDates(); //$vdays set in the fnCheckDates
function

if ($vdays < 0) {
showInputForm();
exit();
}

$urlMailbox = urlencode (trim($mailbox));
set_my_charset();
/* Format the & send message to include dates and priority
selections */
<
$Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
$subject, $comment, $reply_id, $MDN,
$mailprio);
}
if (! $Result) {
showInputForm();
exit();
}
//Call MySQL function to save data
$Result = saveVac($txtStartDate, $txtEndDate, $Priority,
$vdays, $body);
if (! $Result) {
showInputForm();
exit();
}
Header("Location: request.php?mail_sent=yes");
} else {

checkInput(true);
showInputForm();

}
} else {
/*
* This handles the default case as well as the error case
* (they had the same code) --> if (isset($smtpErrors))
*/
$imapConnection = fnimap_login($username, $key, $imapServerAddress,
$imapPort, 0);

$newmail = true;
showInputForm();
fnimap_logout($imapConnection);
}
}
exit();

function showInputForm () {
global $send_to, $send_to_cc, $body, $subject, $org_logo,
$btn, $txtStartDate, $txtEndDate, $Priority, $txtNumReq, $chkmsg,
$reply_id, $mailbox, $User_Name, $vdays, $prefs_are_cached,
$username, $data_dir, $default_sendto, $oncall,
$oncall_cnt,
$mailprio, $default_use_mdn, $mdn_user_support,
$compose_new_win,
$mail_sent, $this_yr, $next_yr, $cur_p1, $cur_p2, $cur_p3,
$next_p1, $next_p2, $next_p3;

$btn = '';
$User_Name = getPref($data_dir, $username, 'User_Name');
$subject = 'Vacation request for ' . $User_Name;
$send_to = $default_sendto;
$send_to_cc = getPref($data_dir, $username,'CC_Reply_to', 0);

if ($Priority == '') {
$Priority = '1';
}

if ($txtStartDate == '') {
$txtStartDate = date("m/d/Y");
}

if ($txtEndDate=='') {
$txtEndDate = date("m/d/Y",strtotime("1
days",strtotime($txtStartDate)));
}
if ($txtNumReq=='') {
$txtNumReq = 0;
}
$MyName = "request";
$Cal = 1;
$Oncall = 0;
$RTE = 0;
$Title = "Vacation Request";
displaytxan_header($MyName, $User_Name, $Cal, $Title, $Oncall,
$RTE);

if ($mail_sent == 'yes') {
echo '

'. _("Your Request has been sent").' CENTER>';
}

if ($vdays < 0) {
echo '
'. $chkmsg . '
';
echo '
Check available days and resubmit
';
}

echo " width=\"100%\" height=\"16\"
bordercolorlight=\"#FFFFFF\" bordercolordark=\"#FFFFFF\">




";

if (!isset($this_yr)) {
$this_yr = date("Y");
session_register('this_yr');
$next_yr = $this_yr + 1;
session_register('next_yr');
}
$prefs_are_cached = FALSE;
cachePrefValues($data_dir, $username);
$cur_p1 = getPref($data_dir, $username,'Cur_P1', 0);
$cur_p2 = getPref($data_dir, $username,'Cur_P2', 0);
$cur_p3 = getPref($data_dir, $username,'Cur_P3', 0);
$next_p1 = getPref($data_dir, $username,'Next_P1', 0);
$next_p2 = getPref($data_dir, $username,'Next_P2', 0);
$next_p3 = getPref($data_dir, $username,'Next_P3', 0);

echo "
";

echo "


\"43\">Vacation Request

1; margin-bottom: 1\">
Start Date id=txtStartDate size=\"20\" tabindex=\"1\" value=\"" .
$txtStartDate ."\">
\"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
yyyy'); return false;\"
TITLE=\"cal5.showCalendar('anchor5'); return false;\"
NAME=\"anchor5\" ID=\"anchor5\"> width=\"16\" height=\"16\" border=\"0\" alt=\"Pick Start date\"> A>


1; margin-bottom: 1\">
End Date  id=txtEndDate size=\"20\" tabindex=\"2\" value=\"" . $txtEndDate ."\">
\"cal6.select(document.forms['request'].txtEndDate,'anchor5' ,'MM/dd/
yyyy');; return false;\"
TITLE=\"cal6.showCalendar('anchor6'); return false;\"
NAME=\"anchor6\" ID=\"anchor6\"> width=\"16\" height=\"16\" border=\"0\" alt=\"Pick End date\"> A>


Days Requested:  \"txtNumReq\" id=\"txtNumReq\" size=\"20\" value=\"" .
$txtNumReq ."\">
bordercolor=\"#000000\" rowspan=\"2\">

bottom: 1\">Vacation Days Remaining :


bottom: 1\"> 


bottom: 1\">" . $this_yr . "


bottom: 1\">Priority 1   " . $cur_p1 . "


bottom: 1\">Priority 2   " . $cur_p2 . "


bottom: 1\">Priority 3   " . $cur_p3 . "


bottom: 1\"> 


bottom: 1\">" . $next_yr . "


bottom: 1\">Priority 1   " . $next_p1 . "


bottom: 1\">Priority 2   " . $next_p2 . "


bottom: 1\">Priority 3   " . $next_p3 . "


 

 



                       
2\">
Priority
tabindex=\"3\"" .($Priority == '1'?' checked ':'') . ">" .
_("Priority 1") . "

tabindex=\"4\"" .($Priority == '2'?' checked ':''). ">" . _("Priority
2") . "


tabindex=\"5\"" .($Priority == '3'?' checked ':''). ">" . _("Priority
3") . "


";

echo "

top: 1; margin-bottom: 1\">


bottom: 1\"> 


1; margin-bottom: 1\">


1; margin-bottom: 1\">Comments


1; margin-bottom: 1\">


 

bordercolor=\"#FFFFFF\">
"\">        
Form") . "\">


htmlspecialchars($mailbox) . "\">
htmlspecialchars($send_to) . "\">
htmlspecialchars($send_to_cc) . "\">
htmlspecialchars($subject) . "\">
htmlspecialchars($btn) . "\">


\"position:absolute;visibility:hidden;background-color:white ;layer-
background-color:white;\">
";

echo "";

echo "";

echo '';

}

Re: Session variables and IE7

am 08.09.2007 00:37:30 von bulldog8

On Sep 6, 5:34 am, Erwin Moller
wrote:
> bulld...@lycos.com wrote:
>
> Hi Bulldog,
>
> > I have a web page set up for doctors to request vacation. All was
> > working well until they upgrade their home PCs to IE7, at which time
> > the variables lose their values when they click submit.
>
> 'the variables' refers to the ones in $_SESSION ?
>
> We've allowed
>
>
>
>
>
> > cookies from this site and allowed JS to run in an attempt to fix the
> > issue, but no luck.
>
> > I use a javascript calendar and additional javascript to make sure the
> > end date > start date.
>
> > The user can still use the calendar tool to select dates and the js
> > still correctly ensures the end date and num of days requested fields
> > are populated correctly, so I am looking at my PHP code first.
>
> > Is there some error in my handling of session variables?
>
> > PHP code:
>
> > >
> > /**
> > * request.php
> > *
> > * Sends an email containing a vacation request and posts to database.
> > *
> > */
>
> > session_start();
>
> > //Let's see if they want to go to another page first
> > if (strlen($btn) > 0) {
>
> ????
> Are you relying on register globals ancient wrong settings in php.ini?
> This code needs to be fixed IMHO.
>
>
>
> Bulldog, you better start with a very simple page that uses a sessions,
> and a followup page that tries to read the session.
> That will learn you what is wrong without the complications of the old
> (bad) script.
>

> Try something simple as this first, and see what happens.
>
> Regards,
> Erwin Moller
>
> PS: Please fix the register globals thingy....http://nl3.php.net/register_globals- Hide quoted text -
>
> - Show quoted text -

Erwin -

Thanks for the tips.

The site has PHP 4.3.9. The site also contains squirrelmail, so
register_globals needs to remain 'on' (I tried it turned 'off' and
the whole thing fell apart!)

I tried your samples and the results are further down.

The variables I am concerned with are in the following statement:
$Result = saveVac($txtStartDate, $txtEndDate, $Priority, $vdays,
$body);

and

function showInputForm () {
global $send_to, $send_to_cc, $body, $subject, $org_logo, $btn,
$txtStartDate, $txtEndDate, $Priority, $txtNumReq,
$chkmsg, .....etc...



Only thing I may be missing - within the HTML code, how do you assign
values to session variables? The following is PHP code that I use to
display the $txtStartDate value and allow the user to change, either
manually or via the calendar button:

Start Date \"20\" tabindex=\"1\" value=\"" . $txtStartDate ."\"> onClick=
\"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
yyyy'); return false;\"


can I use:

Start Date \"20\" tabindex=\"1\" value=\"" . $_SESSION['txtStartDate'] ."\"> HREF=\"#\" onClick=
\"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
yyyy'); return false;\"


Thanks
Jon



page1.php / page2.php results:
SESSION CONTAINS:

Array
(
[base_uri] => /dev/
[onetimepad] => T4q+GOY7
[delimiter] => /
[username] => tttttt@ttttt.com
[user_is_logged_in] => 1
[just_logged_in] => 1
[attachment_common_types] => Array
(
[image/gif] => 1
[image/x-xbitmap] => 1
[image/jpeg] => 1
[image/pjpeg] => 1
[application/x-shockwave-flash] => 1
[application/vnd.ms-excel] => 1
[application/vnd.ms-powerpoint] => 1
[application/msword] => 1
[*/*] => 1
)

[prefs_cache] => Array
(
[User_Name] => Ttttt Ttttttt
[User_Id] => 999
[CC_Reply_to] => ttttt@ttttt.com
[javascript_on] => 1
[date_format] => 4
[hour_format] => 1
[Cur_P1] => -20
[Cur_P2] => 16
[Cur_P3] => 99
[Next_P1] => 14
[Next_P2] => 15
[Next_P3] => 99
)

[prefs_are_cached] => 1
[theme_css] =>
[test] => Testing
)

------------------------------------------------------------ --------------------
POST CONTAINS:
Array
(
)

------------------------------------------------------------ --------------------
GET CONTAINS:
Array
(
)

------------------------------------------------------------ --------------------
COOKIE CONTAINS:
Array
(
[PHPSESSID] => 1c882adeebfc6de61e496381d283ac53
[key] => QoTQdp6O
)


I have to admit, my PHP skills are quite light.

Re: Session variables and IE7

am 08.09.2007 03:41:15 von Jerry Stuckle

bulldog8@lycos.com wrote:
> On Sep 6, 5:34 am, Erwin Moller
> wrote:
>> bulld...@lycos.com wrote:
>>
>> Hi Bulldog,
>>
>>> I have a web page set up for doctors to request vacation. All was
>>> working well until they upgrade their home PCs to IE7, at which time
>>> the variables lose their values when they click submit.
>> 'the variables' refers to the ones in $_SESSION ?
>>
>> We've allowed
>>
>>
>>
>>
>>
>>> cookies from this site and allowed JS to run in an attempt to fix the
>>> issue, but no luck.
>>> I use a javascript calendar and additional javascript to make sure the
>>> end date > start date.
>>> The user can still use the calendar tool to select dates and the js
>>> still correctly ensures the end date and num of days requested fields
>>> are populated correctly, so I am looking at my PHP code first.
>>> Is there some error in my handling of session variables?
>>> PHP code:
>>> >>> /**
>>> * request.php
>>> *
>>> * Sends an email containing a vacation request and posts to database.
>>> *
>>> */
>>> session_start();
>>> //Let's see if they want to go to another page first
>>> if (strlen($btn) > 0) {
>> ????
>> Are you relying on register globals ancient wrong settings in php.ini?
>> This code needs to be fixed IMHO.
>>
>>
>>
>> Bulldog, you better start with a very simple page that uses a sessions,
>> and a followup page that tries to read the session.
>> That will learn you what is wrong without the complications of the old
>> (bad) script.
>>
>
>> Try something simple as this first, and see what happens.
>>
>> Regards,
>> Erwin Moller
>>
>> PS: Please fix the register globals thingy....http://nl3.php.net/register_globals- Hide quoted text -
>>
>> - Show quoted text -
>
> Erwin -
>
> Thanks for the tips.
>
> The site has PHP 4.3.9. The site also contains squirrelmail, so
> register_globals needs to remain 'on' (I tried it turned 'off' and
> the whole thing fell apart!)
>

Then you need to upgrade your version of SquirrelMail. It must be a
very old version - SquirrelMail hasn't required register_globals to be
on for at least two years that I know of.

> I tried your samples and the results are further down.
>
> The variables I am concerned with are in the following statement:
> $Result = saveVac($txtStartDate, $txtEndDate, $Priority, $vdays,
> $body);
>
> and
>
> function showInputForm () {
> global $send_to, $send_to_cc, $body, $subject, $org_logo, $btn,
> $txtStartDate, $txtEndDate, $Priority, $txtNumReq,
> $chkmsg, .....etc...
>
>
>
> Only thing I may be missing - within the HTML code, how do you assign
> values to session variables? The following is PHP code that I use to
> display the $txtStartDate value and allow the user to change, either
> manually or via the calendar button:
>

You don't. HTML cannot set session variables. You get them from the
$_POST array and place them in the $_SESSION array.

> Start Date > \"20\" tabindex=\"1\" value=\"" . $txtStartDate ."\">
> onClick=
> \"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
> yyyy'); return false;\"
>
>
> can I use:
>
> Start Date > \"20\" tabindex=\"1\" value=\"" . $_SESSION['txtStartDate'] ."\"> > HREF=\"#\" onClick=
> \"cal5.select(document.forms['request'].txtStartDate,'anchor 5','MM/dd/
> yyyy'); return false;\"
>
>

No.

> Thanks
> Jon
>
< lots of other stuff snipped >

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================