Forum Moderators: coopster

Message Too Old, No Replies

php session problem

         

smagdy

4:37 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



Hi, when i add php session

<?
session_start();
header("Cache-control: private"); // IE 6 Fix.
?>

I just get this error "Problems with this web page might prevent it from being displayed properly bla bla".
Of course am adding those lines just the first thing in each page b4 anything else. so am getting that error in pages that have template applied to it.

and when i delete the session lines it just back to normal. So i dont get whats the problem with the session.. there is no other way of writing it. and the session is working already properly in another project on same computer. am using php & IIS.

hope there is solution.
thanks

baze22

6:11 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



How are you registering your session vaiables? I had some warnings pop up when I was using session_register and session_unregister as opposed to

$_SESSION['var']= $var; and unset($_SESSION['var']);

what session functions are you using?

baze

smagdy

6:17 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



i tried both but i took off both and just trying the
session_start(); alone and it gives the error b4 even registering anything.

smagdy

6:20 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



i clicked ok in the error alert then the page loads normally then the error comes again after the page finish loading and also comes again if i rollover the mouse over any menu which is generated from photoshop so its javascript. The problem is either related to javascript or template but its weird for me anyway.

please any help cuz am so stuck.

smagdy

7:54 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



Ok here is the exact code if u try it in local host u should get just error b4 it loads n after it end loading.. I would appreciate it so much if someone can find me the error.. also it works normal if u take of the <?session_start();?> lines

<?
session_start();
?>
<HTML><!-- InstanceBegin template="/Templates/head.dwt" codeOutsideHTMLIsLocked="false" -->
<HEAD>
<!-- InstanceBeginEditable name="doctitle" -->
<TITLE>head</TITLE>
<SCRIPT language="JavaScript">

function OnSubmitForm(x)
{
if(x == 'v')
{
document.myform.action ="viewCart.php";
myform.submit();
}
else
if(x == 'a')
{
document.myform.action ="addToCart.php?u=0";
myform.submit();
}
return true;
}
</SCRIPT>
<!-- InstanceEndEditable -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!-- ImageReady Preload Script (head.psd) -->
<SCRIPT TYPE="text/javascript">
<!--
<!--

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
head_13_over = newImage("images/head_13-over.gif");
head_14_over = newImage("images/head_14-over.gif");
head_15_over = newImage("images/head_15-over.gif");
head_16_over = newImage("images/head_16-over.gif");
preloadFlag = true;
}
}

// -->

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

</SCRIPT>
<!-- End Preload Script -->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.font-grey {color:#000099;font-size:x-small;}
.font-orange {
color:#E16A01;
font-size: x-small;
}
input.input-form {
font-size: x-small;
border: 1px groove #000000;
font-family: "Times New Roman", Times, serif;
font-weight: normal;
color: #e16a01;
width: 150px;
height: 20px;
background-position: left center;
}
select {
font-size: x-small;
border: 1px groove #000000;
font-family: "Times New Roman", Times, serif;
font-weight: normal;
color: #e16a01;
width: 150px;
height: 20px;
background-position: left center;
}
input.but {
font-size: x-small;
border: 1px groove #000000;
font-family: "Times New Roman", Times, serif;
font-weight: normal;
color: #e16a01;
width: 75px;
height: 20px;
background-position: left center;
}
.style3 {font-size: xx-small;}
-->
input.login {
font-size: x-small;
border: 1px groove #000000;
font-family: "Times New Roman", Times, serif;
font-weight: normal;
color: #e16a01;
width: 100px;
height: 17px;
background-position: left center;
}
tr.pass{
height:1px;
font-size: xx-small;
}
.style5 {
color: #e16a01;
font-weight: bold;
font-size: 12px;
}
font.title{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: medium;
font-style: normal;
font-weight: bold;
color: #abcdef;
background-color: #E16A01;
background-position: center center;
}
.style6 {font-size: xx-small; color: #000099; }
.style7 {color: #000099;}
</style>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();MM_preloadImages('images/head_17-over.gif')">
<!-- ImageReady Slices (head.psd) -->
<TABLE WIDTH=750 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=2 ROWSPAN=3>
<IMG SRC="images/head_01.gif" WIDTH=126 HEIGHT=76 ALT=""></TD>
<TD COLSPAN=5 ROWSPAN=3 bgcolor="7E8C94">&nbsp;</TD>
<TD COLSPAN=3 ROWSPAN=3>
<IMG SRC="images/head_03.gif" WIDTH=204 HEIGHT=76 ALT=""></TD>
<TD ROWSPAN=3>
<IMG SRC="images/head_04.gif" WIDTH=5 HEIGHT=76 ALT=""></TD>
<TD COLSPAN=4>
<IMG SRC="images/head_05.gif" WIDTH=196 HEIGHT=4 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=3 bgcolor="ADB3B7"><table width="188" height="8" border="0" bgcolor="ADB3B7">
<tr>
<td width="30"><span class="style3">User:</span></td>
<td width="30"><input class="login" name="un" type="text" id="textfield1"></td>
<td width="145" rowspan="3" align="left" valign="bottom"><p><a href="cart.php" class="style6" tabindex="1">Submit</a></p>
<p><a href="register.php" class="style5">Register</a></p></td>
</tr>
<tr>
<td height="24"><span class="style3">Pass:</span></td>
<td><input name="pa" class="login" type="password" id="textfield2"></td>
</tr>
<tr class="pass">
<td colspan="2" align="right" ><a href="file:///C¦/Documents%20and%20Settings/Administrator/My%20Documents/php/Budget/forgotPass.php" class="style7">Forgot your password?</a></td>
</tr>
</table></TD>
<TD>
<IMG SRC="images/head_07.gif" WIDTH=6 HEIGHT=67 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=4>
<IMG SRC="images/head_08.gif" WIDTH=196 HEIGHT=5 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=5 ROWSPAN=2>
<IMG SRC="images/head_09.gif" WIDTH=238 HEIGHT=25 ALT=""></TD>
<TD COLSPAN=10>
<IMG SRC="images/head_10.gif" WIDTH=512 HEIGHT=4 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=10 bgcolor="E16A01">&nbsp;</TD>
</TR>
<TR>
<TD COLSPAN=3>
<IMG SRC="images/head_12.gif" WIDTH=146 HEIGHT=19 ALT=""></TD>
<TD>
<!-- InstanceBeginEditable name="home" --><a href="home.html"
onMouseOver="changeImages('head_13', 'images/head_13-over.gif'); return true;"
onMouseOut="changeImages('head_13', 'images/head_13.gif'); return true;"> <img name="head_13" src="images/head_13.gif" width=55 height=19 border=0 alt=""></a><!-- InstanceEndEditable --></TD>
<TD COLSPAN=2>
<!-- InstanceBeginEditable name="howItWorks" --><a href="howItWorks.html"
onMouseOver="changeImages('head_14', 'images/head_14-over.gif'); return true;"
onMouseOut="changeImages('head_14', 'images/head_14.gif'); return true;"> <img name="head_14" src="images/head_14.gif" width=111 height=19 border=0 alt=""></a><!-- InstanceEndEditable --></TD>
<TD COLSPAN=2>
<!-- InstanceBeginEditable name="benefits" --><a href="benefits.html"
onMouseOver="changeImages('head_15', 'images/head_15-over.gif'); return true;"
onMouseOut="changeImages('head_15', 'images/head_15.gif'); return true;"> <img name="head_15" src="images/head_15.gif" width=86 height=19 border=0 alt=""></a><!-- InstanceEndEditable --></TD>
<TD>
<!-- InstanceBeginEditable name="advices" --><a href="advices.html"
onMouseOver="changeImages('head_16', 'images/head_16-over.gif'); return true;"
onMouseOut="changeImages('head_16', 'images/head_16.gif'); return true;"> <img name="head_16" src="images/head_16.gif" width=108 height=19 border=0 alt=""></a><!-- InstanceEndEditable --></TD>
<TD COLSPAN=3><!-- InstanceBeginEditable name="faq" --><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image38','','images/head_17-over.gif',1)"><img src="images/head_17.gif" name="Image38" width="58" height="19" border="0"></a><!-- InstanceEndEditable --></TD>
<TD COLSPAN=3>
<IMG SRC="images/head_18.gif" WIDTH=186 HEIGHT=19 ALT=""></TD>
</TR>
<TR>
<TD ROWSPAN=2 bgcolor="#E7E6E4">&nbsp;</TD>
<TD COLSPAN=12 bgcolor="#E7E6E4">&nbsp;</TD>
<TD COLSPAN=2 bgcolor="#E7E6E4">&nbsp;</TD>
</TR>
<TR>
<TD COLSPAN=12 valign="top" bgcolor="E7E6E4"><!-- InstanceBeginEditable name="body" -->
<table width="200" border="0" bordercolor="#6699FF" align="center">
<tr>
<td colspan="3"><div align="center"></div></td>
</tr>
<?

$cat=mysql_query("select * from date");

?>
<tr>
<td width="58"><?
echo"<select name=s1>";
//echo"<option>--Month--";

$n = mysql_num_rows($cat);
$f = mysql_num_fields($cat);

for($i=0; $i<$n; $i++)
{
$w=mysql_fetch_array($cat);
echo"<option>".$w[1];
}
?>
</td>
<td width="52"><?
$cat=mysql_query("select * from date");
echo"<select name=s2>";
//echo"<option>--Year--";

$n = mysql_num_rows($cat);
$f = mysql_num_fields($cat);
$temp=0;

for($i=0; $i<$n; $i++)
{
$w=mysql_fetch_array($cat);

if($w[2]!= $temp)
{
echo"<option>".$w[2];
$temp = $w[2];
}
}
?>
</td>
<td width="76" rowspan="2" align="left" valign="top"><p><span class="class1"><a href="#" onClick="OnSubmitForm('v')">View</a></span></p>
<p><span class="class1"><a href="#" onClick="OnSubmitForm('a')">Add</a></span></p></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</table>
<!-- InstanceEndEditable --> </TD>
<TD COLSPAN=2 bgcolor="#E7E6E4">&nbsp;</TD>
</TR>
<TR>
<TD>
<IMG SRC="images/head_24.gif" WIDTH=17 HEIGHT=25 ALT=""></TD>
<TD COLSPAN=12>
<IMG SRC="images/head_25.gif" WIDTH=716 HEIGHT=25 ALT=""></TD>
<TD COLSPAN=2>
<IMG SRC="images/head_26.gif" WIDTH=17 HEIGHT=25 ALT=""></TD>
</TR>
<TR>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=17 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=109 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=20 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=55 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=37 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=74 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=33 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=53 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=108 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=43 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=5 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=10 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=169 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=11 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=6 HEIGHT=1 ALT=""></TD>
</TR>
</TABLE>
<!-- End ImageReady Slices -->
</BODY>
<!-- InstanceEnd --></HTML>

baze22

8:13 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



I ran your code and the only warnings I got were related to the queries not running (I don't have your DB set up ;)) But nothing related to the session. This was on Apache, tried both Win and *nix. What is the exact message you are getting? And I though I read in one of your posts you clicked on OK to proceed?

baze

smagdy

8:22 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



The exact msg is:

Problems with this Web page might prevent it from being displayed properly of functioning properly. In the futur, you can display this message by double-clicking the warning icon displayed in the status bar.

then
[checkbox]Always display this message when a page contains errors.

then
[OK] [Hide Details <<]

its just the normal error that comes when u have javascript error.

so its not session error but when i just comment the session_start(); it works normal.

anything I can try?

baze22

8:33 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



You got me then. I thought you were getting an error message related to sessions. I don't get any kind of js warning either. Looks like it is supposed to here. Not even the little warning sign in the lower left corner of IE.

Try copying it from your message like I did and save it in an alternate file name like testfile.php and see if that makes a difference.

Given that the error is coming from your browser instead of the script, you can also try viewing the source with the session and without and try to see what the difference is that your browser is seeing.

baze

smagdy

8:50 pm on Dec 11, 2004 (gmt 0)

10+ Year Member



i tried lot of things and still no..

but there is somethin I can add.. its that after i get the error and the page displays properly I can just browse the site and go back to same page with no problem so its just one time error and it comes back again if I closed the broswer and started viewing this page for 1st time again.

any clue?