#2 Re: Ostatní problémy » Session error » 2012-07-16 23:21:58

Problém vyřešen, už žádná chyba, takže chyba byla, že jsem asi nespouštěl session rovnou v indexu, ale až v tom košíku? Mockrát Vám děkuji!

Jedním příkazem to neumím, můžu poprosit o příklad?

#3 Re: Ostatní problémy » Session error » 2012-07-16 23:14:11

Upraveno

<?php

Switch ($_REQUEST['s'])
{
case prehled:
$s="prehled";
break;

case d_bundy:
$s="d_bundy";
break;

case d_doplnky:
$s="d_doplnky";
break;

case kosik:
$s="kosik";
break;

case login_1:
$s="login_1";
break;

case pokladna:
$s="pokladna";
break;

case registrace_1:
$s="registrace_1";
break;

default:
$s="all";
}

echo '
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Internetový obchod s oblečením</title>
<style type="text/css">

#all   {
   width: 970px;
   text-align: center;
   margin: 0 auto;
   float:center;
   }

body   {
   background-color: #FFFFFF;
   text-align: center;
   }

#endora   {
   margin: 0 auto;
   width: 970px;
   height: 25px;
   text-align: center;
   }

#header   {
   margin: 0 auto;
   width: 970px;
   height: 135px;
   text-align: left;
   }

#menu   {
   margin: 0 auto;
   width: 200px;
   height: 340px
   text-align: left;
   float: left;
   background-color: #FFFFFF;
   }

#content   {
   margin: 0 auto;
   width: 770px;
   min-height: 340px;
   text-align: left;
   float: right;
   background-color: #FFFFFF;
   }

#below   {
   margin: 0 auto;
   width: 970px;
   height: 400px;
   text-align: left;
   float: right;
   background-color: #FFFFFF;
   }

.control_panel {
   font-style: normal;
   font-weight: bold;
   font-size: 11px;
   line-height: 1.5;
   font-family: SEE-go;
   letter-spacing: 0.5px;
   }

.menu_top {
   font-style: normal;
   font-weight: normal;
   font-size: 14px;
   line-height: 1.5;
   font-family: SEE-go;
   letter-spacing: 0.5px;
   }

.zbozi_popis {
   font-style: normal;
   font-weight: bold;
   font-size: 7pt;
   line-height: 1.5;
   font-family: SEE-go;
   letter-spacing: 0.5px;
   text-transform: uppercase;
   }

.zbozi_nazev {
   font-style: normal;
   font-weight: bold;
   color:#d64937;
   font-size: 10pt;
   line-height: 1.5;
   font-family: SEE-go;
   letter-spacing: 0.5px;
   text-transform: uppercase;
   }

.zbozi_nazev a {
   color:#d64937;
   text-decoration: none
   }


.zbozi_popis_2 {
   padding:0px 20px 0px 20px;
   font-style: normal;
   font-weight: normal;
   line-height: 1.5;
   font-family: arial;
   font-size: 11px;
   letter-spacing: 0.5px;
   }

.zbozi_nazev_2 {
   padding:10px 20px 0px 20px;
   color:#d64937;
   font-weight: bold;
   font-size:18px;
   line-height:1.8em;
   }
.odkaz_v_menu {
   padding:0px 0px 0px 0px;
   color:#000000;
   font-weight: normal;
   font-size:12px;
   line-height:1.8em;
   }
.do_kosiku {
   padding:0px 0px 0px 90px;
   color:#d64937;
   font-weight: bold;
   font-size:20px;
   line-height:1.8em;
   }
.do_kosiku a {

   color:#d64937;
   }

.kosik_nadpis {
   padding:0px 0px 0px 5px;
   color:#d64937;
   font-weight: bold;
   font-size:15px;
   line-height:1.8em;
   }

.kosik_obsah {
   padding:0px 0px 0px 5px;
   color:#000000;
   font-weight: normal;
   font-size:14px;
   line-height:1.8em;
   }

.kosik_dokoncit {
   padding:0px 0px 0px 0px;
   color:#d64937;
   font-weight: bold;
   font-size:17px;
   line-height:1.8em;
   }

.kosik_dokoncit a {
   color:#d64937;
   }

.prazdny_kosik {
   padding:20px 0px 0px 0px;
   font-style: normal;
   font-weight: normal;
   line-height: 1.5;
   font-family: arial;
   font-size: 11px;
   letter-spacing: 0.5px;
   }

.login_name {
   padding:0px 0px 0px 0px;
   font-style: normal;
   font-weight: normal;
   line-height: 1.5;
   font-family: arial;
   font-size: 11px;
   letter-spacing: 0.5px;
   }

.endora {
   padding:0px 0px 0px 0px;
   color:#000000;
   font-weight: bold;
   font-size:10px;
   line-height:1.8em;
   }
</style>
<script language="JavaScript" type="text/javascript" src="index.js"></script>
</head>
<body onload="start()">
<div id="all">
<div id="header">
<table width="970px" height="135px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="600px" height="25px" align="right" class="control_panel" colspan="2"></td><td width="150px" height="25px" align="center" class="control_panel"><img border="0" width="150px" height="25px" alt="Nový účet" src="img/new_account.jpg" /></td><td width="120px" height="25px" align="left" class="control_panel"><img width="120px" height="25px" alt="Přihlásit se" src="img/login_account.jpg"/></td><td width="100px" height="25px" align="right" class="control_panel"><a href="./index.php?s=kosik"><img width="100px" height="25px" alt="Košík" src="img/shoping_cart.jpg" border="0"/></a></td>
</tr>
<tr>
<td width="197px" height="89px"><img alt="Header" src="img/header.jpg" width="197px" height="89px" /></td><td colspan="4" width="773px" height="89px"></td>
</tr>
<tr>
<td width="970px" height="18px" bgcolor="#eeeeee" colspan="5"></td>
</tr>
<tr>
<td width="970px" height="3px"></td>
</tr>
</table>
</div>
   <div id="menu">
   <table width="200px" height="340px" cellspacing="0" cellpadding="0" border="0" id="vyska">
   <tr>
   <td colspan="2" align="center" width="200px" height="40px" id="damske" class="menu_top" onmousedown="damskyvyber()"><img width="200px" height="40px" src="img/girl_fashion.jpg" alt="Dámská nabídka" /></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_bundy"  class="odkaz_v_menu" onclick="location.href='; ?>'index.php?s=d_bundy'<?php echo ';"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_doplnky"  class="odkaz_v_menu" onclick="location.href='; ?>'index.php?s=d_doplnky'<?php echo ';"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_kalhoty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_kosile" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_mikiny" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_saka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_sportovni_styl" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_svetry" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_sortky" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_tricka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="d_vesty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td colspan="2" align="center" width="200px" height="40px" id="panske" class="menu_top" onmousedown="panskyvyber()"><img width="200px" height="40px" alt="Pánská nabídka" src="img/man_fashion.jpg"/></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_bundy" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_doplnky" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_kalhoty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_kosile" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_mikiny" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_saka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_sportovni_styl" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_svetry" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_sortky" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_tricka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="p_vesty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td colspan="2" align="center" width="200px" height="40px" id="detske" align="right" class="menu_top" onmousedown="detskyvyber()"><img width="200px" height="40px" alt="Dětská nabídka" src="img/kid_fashion.jpg"/></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_bundy" class="odkaz_v_menu" onclick="location.href='; ?>'index.php?s=de_bundy'<?php echo ';"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_doplnky" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_kalhoty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_kosile" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_mikiny" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_saka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_sportovni_styl" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_svetry" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_sortky" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_tricka" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td width="75px"></td><td align="left" width="125px" id="de_vesty" class="odkaz_v_menu"></td>
   </tr>
   <tr>
   <td colspan="2" width="200px" height="220" id="rozmer"></td>
   </tr>
   </table>
   </div>
   <div id="content">';

include_once $s.".php";

echo '
   </div>
   <div id="below">
   </div>
<div id="endora"><table  width="970px" height="25px" cellspacing="0" cellpadding="0" border="0"><tr><td width="970px" height="25px" class="endora" align="center"><font color="#000000"><endora></font></td></tr></table></div>
</div>
</body>
</html>';
?>

#4 Re: Ostatní problémy » Session error » 2012-07-16 22:23:04

Ostatní chyby eliminovány, už je tam pouze ta se session.

Zdroják index.php

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Internetový obchod s oblečením</title>
<style type="text/css">

#all	{
	width: 970px;
	text-align: center;
	margin: 0 auto;
	float:center;
	}

body	{
	background-color: #FFFFFF;
 	text-align: center;
	}

#endora	{
	margin: 0 auto;
	width: 970px;
	height: 25px;
	text-align: center;
	}

#header	{
	margin: 0 auto;
	width: 970px;
	height: 135px;
	text-align: left;
	}

#menu	{
	margin: 0 auto;
	width: 200px;
	height: 340px
	text-align: left;
	float: left;
	background-color: #FFFFFF;
	}

#content	{
	margin: 0 auto;
	width: 770px;
	min-height: 340px;
	text-align: left;
	float: right;
	background-color: #FFFFFF;
	}

#below	{
	margin: 0 auto;
	width: 970px;
	height: 400px;
	text-align: left;
	float: right;
	background-color: #FFFFFF;
	}

.control_panel {
	font-style: normal; 
	font-weight: bold; 
	font-size: 11px; 
	line-height: 1.5; 
	font-family: SEE-go;
	letter-spacing: 0.5px;
	}

.menu_top {
	font-style: normal; 
	font-weight: normal; 
	font-size: 14px; 
	line-height: 1.5; 
	font-family: SEE-go;
	letter-spacing: 0.5px;
	}

.zbozi_popis {
	font-style: normal; 
	font-weight: bold; 
	font-size: 7pt; 
	line-height: 1.5; 
	font-family: SEE-go;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	}

.zbozi_nazev {
	font-style: normal; 
	font-weight: bold;
	color:#d64937;
	font-size: 10pt; 
	line-height: 1.5; 
	font-family: SEE-go;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	}

.zbozi_nazev a {
	color:#d64937;
	text-decoration: none
	}


.zbozi_popis_2 {
	padding:0px 20px 0px 20px;
	font-style: normal; 
	font-weight: normal; 
	line-height: 1.5; 
	font-family: arial;
	font-size: 11px;
	letter-spacing: 0.5px;
	}

.zbozi_nazev_2 {
	padding:10px 20px 0px 20px;
	color:#d64937;
	font-weight: bold; 
	font-size:18px;
	line-height:1.8em;
	}
.odkaz_v_menu {
	padding:0px 0px 0px 0px;
	color:#000000;
	font-weight: normal; 
	font-size:12px;
	line-height:1.8em;
	}
.do_kosiku {
	padding:0px 0px 0px 90px;
	color:#d64937;
	font-weight: bold; 
	font-size:20px;
	line-height:1.8em;
	}
.do_kosiku a {

	color:#d64937;
	}

.kosik_nadpis {
	padding:0px 0px 0px 5px;
	color:#d64937;
	font-weight: bold; 
	font-size:15px;
	line-height:1.8em;
	}

.kosik_obsah {
	padding:0px 0px 0px 5px;
	color:#000000;
	font-weight: normal; 
	font-size:14px;
	line-height:1.8em;
	}

.kosik_dokoncit {
	padding:0px 0px 0px 0px;
	color:#d64937;
	font-weight: bold; 
	font-size:17px;
	line-height:1.8em;
	}

.kosik_dokoncit a {
	color:#d64937;
	}

.prazdny_kosik {
	padding:20px 0px 0px 0px;
	font-style: normal; 
	font-weight: normal; 
	line-height: 1.5; 
	font-family: arial;
	font-size: 11px;
	letter-spacing: 0.5px;
	}

.login_name {
	padding:0px 0px 0px 0px;
	font-style: normal; 
	font-weight: normal; 
	line-height: 1.5; 
	font-family: arial;
	font-size: 11px;
	letter-spacing: 0.5px;
	}

.endora {
	padding:0px 0px 0px 0px;
	color:#000000;
	font-weight: bold; 
	font-size:10px;
	line-height:1.8em;
	}
</style>
<script language="JavaScript" type="text/javascript" src="index.js"></script>
</head>
<body onload="start()">
<div id="all">
<div id="header">
<table width="970px" height="135px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="600px" height="25px" align="right" class="control_panel" colspan="2"></td><td width="150px" height="25px" align="center" class="control_panel"><img border="0" width="150px" height="25px" alt="Nový účet" src="img/new_account.jpg" /></td><td width="120px" height="25px" align="left" class="control_panel"><img width="120px" height="25px" alt="Přihlásit se" src="img/login_account.jpg"/></td><td width="100px" height="25px" align="right" class="control_panel"><a href="./index.php?s=kosik"><img width="100px" height="25px" alt="Košík" src="img/shoping_cart.jpg" border="0"/></a></td>
</tr>
<tr>
<td width="197px" height="89px"><img alt="Header" src="img/header.jpg" width="197px" height="89px" /></td><td colspan="4" width="773px" height="89px"></td>
</tr>
<tr>
<td width="970px" height="18px" bgcolor="#eeeeee" colspan="5"></td>
</tr>
<tr>
<td width="970px" height="3px"></td>
</tr>
</table>
</div>
	<div id="menu">
	<table width="200px" height="340px" cellspacing="0" cellpadding="0" border="0" id="vyska">
	<tr>
	<td colspan="2" align="center" width="200px" height="40px" id="damske" class="menu_top" onmousedown="damskyvyber()"><img width="200px" height="40px" src="img/girl_fashion.jpg" alt="Dámská nabídka" /></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_bundy"  class="odkaz_v_menu" onclick="location.href='index.php?s=d_bundy';"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_doplnky"  class="odkaz_v_menu" onclick="location.href='index.php?s=d_doplnky';"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_kalhoty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_kosile" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_mikiny" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_saka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_sportovni_styl" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_svetry" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_sortky" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_tricka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="d_vesty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td colspan="2" align="center" width="200px" height="40px" id="panske" class="menu_top" onmousedown="panskyvyber()"><img width="200px" height="40px" alt="Pánská nabídka" src="img/man_fashion.jpg"/></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_bundy" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_doplnky" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_kalhoty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_kosile" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_mikiny" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_saka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_sportovni_styl" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_svetry" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_sortky" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_tricka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="p_vesty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td colspan="2" align="center" width="200px" height="40px" id="detske" align="right" class="menu_top" onmousedown="detskyvyber()"><img width="200px" height="40px" alt="Dětská nabídka" src="img/kid_fashion.jpg"/></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_bundy" onclick="location.href='index.php?s=de_bundy';" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_doplnky" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_kalhoty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_kosile" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_mikiny" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_saka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_sportovni_styl" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_svetry" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_sortky" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_tricka" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td width="75px"></td><td align="left" width="125px" id="de_vesty" class="odkaz_v_menu"></td>
	</tr>
	<tr>
	<td colspan="2" width="200px" height="220" id="rozmer"></td>
	</tr>
	</table>
	</div>
	<div id="content">
			<?php if(!isset($s)) $s=$_GET["s"];
			$invalide = array('\\','/','/\/',':','.','index');
			$s = str_replace($invalide,' ',$s);
			if(!file_exists($s.".php")) $s = "all";
			include($s.".php");
			?>
	</div>		
	<div id="below">
	</div>
<div id="endora"><table  width="970px" height="25px" cellspacing="0" cellpadding="0" border="0"><tr><td width="970px" height="25px" class="endora" align="center"><font color="#000000"><endora></font></td></tr></table></div>
</div>
</body>
</html>

#5 Re: Ostatní problémy » Session error » 2012-07-16 21:09:46

Není, toto je jedinný php kód, který se v indexu nachází. Zvláštní je, když dám http://obleceni.mzf.cz/kosik.php tak tam ta chyba se session není..

Děkuji za upozornění, ošetřeno.

#6 Re: Ostatní problémy » Session error » 2012-07-16 20:51:49

<?php if(!isset($s)) $s=$_GET["s"];
$invalide = array('\\','/','/\/',':','.');
$s = str_replace($invalide,' ',$s);
if(!file_exists($s.".php")) $s = "all";
include($s.".php");
?>

#7 Re: Ostatní problémy » Session error » 2012-07-16 20:37:27

S tou hlavičkou si na závěr pohraju.. Tak jsem to upravil, abych začínal <?php a žádná změna..

#8 Re: Ostatní problémy » Session error » 2012-07-16 20:14:48

V tom php souboru ji mám jen jednou a v indexu, do kterého includuji kosik.php žádnej session_start() nemám..
V jiným souboru, kde použivám session žádná chyba není.
Upravy jsem dělal v jiným souboru, který s košíkem nemá co dočinění a systém home made..

#9 Re: Ostatní problémy » Session error » 2012-07-16 19:58:21

Včera mi z ničeho nic začlo blbnout session na webu a vůbec nechtělo přenášet data do dalšího php souboru, vždy ty proměnný byly prázdný, tak jsem zkusil nastavit přes .htacess dobu existence session a tak se mi zase rozběhli, ale pouze v Chromu, v IE stále nechtěli běžet. Nakonec jsem zapl vykreslování chyb a háže mi to tuto chybu, kterou nejsem schopen odstranit. Nakonec se po pár hodinách z ničeho nic zase vše rozběhlo, ale ta chyba je tam stále, tak se chci zeptat, jestli někdo nevíte, co s ní... Zkoušel jsem to googlovat, bez výsledku. Zkoušel jsem to upravit přes pspad, jestli nevznikl BOM, také bez výsledku...

Notice: Undefined index: delete in /home/users/quadcore/obleceni.mzf.cz/web/kosik.php on line 12 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/users/quadcore/obleceni.mzf.cz/web/index.php:331) in /home/users/quadcore/obleceni.mzf.cz/web/kosik.php on line 13

Zde je kod ze souboru kosik.php

<table bgcolor="FFFFFF" width="100%" height="500px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td height="25px" colspan="4"></td>
</tr>
<tr>
<td class="kosik_nadpis" height="15px">Zboží</td><td class="kosik_nadpis"  height="15px">ID zboží</td><td class="kosik_nadpis"  height="15px">Cena</td><td class="kosik_nadpis"  height="15px">Volby</td>
</tr>
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
include "./mysql.php";
$delete = $_GET["delete"];
session_start();
if ($delete!=null)
{
$_SESSION['zbozi' . $delete] = null;
$_SESSION['barva' . $delete] = null;
$_SESSION['velikost' . $delete] = null;
$_SESSION['pocet'] = $_SESSION['pocet'] - 1;
}
$pocet = $_SESSION['pocet'];
$zbozi1 = $_SESSION['zbozi1'];
$barva1 = $_SESSION['barva1'];
$velikost1 = $_SESSION['velikost1'];
if ($zbozi1 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi1' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi1_1 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi1 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=1'>Smazat</a></td></tr>";
	}else
	{
	$zbozi1_1 = null;
	}
$zbozi2 = $_SESSION['zbozi2'];
$barva2 = $_SESSION['barva2'];
$velikost2 = $_SESSION['velikost2'];
if ($zbozi2 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi2' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi2_2 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi2 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=2'>Smazat</a></td></tr>";
	}else
	{
	$zbozi2_2 = null;
	}

$zbozi3 = $_SESSION['zbozi3'];
$barva3 = $_SESSION['barva3'];
$velikost3 = $_SESSION['velikost3'];
if ($zbozi3 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi3' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi3_3 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi3 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=3'>Smazat</a></td></tr>";
	}else
	{
	$zbozi3_3 = null;
	}

$zbozi4 = $_SESSION['zbozi4'];
$barva4 = $_SESSION['barva4'];
$velikost4 = $_SESSION['velikost4'];
if ($zbozi4 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi4' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi4_4 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi4 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=4'>Smazat</a></td></tr>";
	}else
	{
	$zbozi4_4 = null;
	}

$zbozi5 = $_SESSION['zbozi5'];
$barva5 = $_SESSION['barva5'];
$velikost5 = $_SESSION['velikost5'];
if ($zbozi5 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi5' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi5_5 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi5 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=5'>Smazat</a></td></tr>";
	}else
	{
	$zbozi5_5 = null;
	}

$zbozi6 = $_SESSION['zbozi6'];
$barva6 = $_SESSION['barva6'];
$velikost6 = $_SESSION['velikost6'];
if ($zbozi6 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi6' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi6_6 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi6 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=6'>Smazat</a></td></tr>";
	}else
	{
	$zbozi6_6 = null;
	}

$zbozi7 = $_SESSION['zbozi7'];
$barva7 = $_SESSION['barva7'];
$velikost7 = $_SESSION['velikost7'];
if ($zbozi7 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi7' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi7_7 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi7 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=7'>Smazat</a></td></tr>";
	}else
	{
	$zbozi7_7 = null;
	}

$zbozi8 = $_SESSION['zbozi8'];
$barva8 = $_SESSION['barva8'];
$velikost8 = $_SESSION['velikost8'];
if ($zbozi8 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi8' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi8_8 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi8 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=8'>Smazat</a></td></tr>";
	}else
	{
	$zbozi8_8 = null;
	}

$zbozi9 = $_SESSION['zbozi9'];
$barva9 = $_SESSION['barva9'];
$velikost9 = $_SESSION['velikost9'];
if ($zbozi9 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi9' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi9_9 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi9 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=9'>Smazat</a></td></tr>";
	}else
	{
	$zbozi9_9 = null;
	}

$zbozi10 = $_SESSION['zbozi10'];
$barva10 = $_SESSION['barva10'];
$velikost10 = $_SESSION['velikost10'];
if ($zbozi10 != null)
	{
	$produkt=mysql_query("select * from produkty where id='$zbozi10' ")or die(mysql_error());
	while($radek=mysql_fetch_assoc($produkt))
		{
		$cena=$radek['cena'];
		$nazev=$radek['nazev'];
		$foto_1=$radek['foto_1'];
		}
	$zbozi10_10 = "<tr><td class='kosik_obsah'>" . $nazev . "</td><td class='kosik_obsah'>" . $zbozi10 . "</td><td class='kosik_obsah'>" . $cena . ",- Kč</td><td class='kosik_obsah'><a href='./index.php?s=kosik&delete=10'>Smazat</a></td></tr>";
	}else
	{
	$zbozi10_10 = null;
	}

if ($pocet == 0)
	{
	$zbozi1_1 = '<tr><td colspan="4" class="prazdny_kosik">Ve Vašem košíku ještě není žádné zboží. Zboží se přidává do košíku kliknutím na tlačítko "Přidat zboží do košíku".</td></tr>';
	}

?>
<?php echo $zbozi1_1 ?>
<?php echo $zbozi2_2 ?>
<?php echo $zbozi3_3 ?>
<?php echo $zbozi4_4 ?>
<?php echo $zbozi5_5 ?>
<?php echo $zbozi6_6 ?>
<?php echo $zbozi7_7 ?>
<?php echo $zbozi8_8 ?>
<?php echo $zbozi9_9 ?>
<?php echo $zbozi10_10 ?>
<tr>
<td height="10px" colspan="4"></td>
</tr><?php
if ($pocet != 0)
{
echo '<tr>';
echo '<td height="20px" width="100%" colspan="4" align="right" class="kosik_dokoncit"><a href="./index.php?s=login_1">Přejít k pokladně</a></td>';
echo '</tr>';
}
?>
<tr>
<td height="470px" colspan="4"></td>
</tr>
</table>

Zápatí

Založeno na FluxBB | CZ a SK