Autor Zpráva
emissary
Profil
Zdravím Vás, skúšal som jeden script o bezpečnej autorizácii, ktorý bol na jednej stránke. Ale mám tam nejaký problém so session. Mohli by ste mi poradiť?
Odkaz na môj testovací web


Komu sa nechce klikať, tak hlásenie o chybe je

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /array3/apache/data/exot/p/prco.sk/www/auto/index.php:9) in /array3/apache/data/exot/p/prco.sk/www/auto/index.php on line 15

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /array3/apache/data/exot/p/prco.sk/www/auto/index.php:9) in /array3/apache/data/exot/p/prco.sk/www/auto/index.php on line 15



Pridávam zdrojové kódy.

index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<title>index</title>
</head>


<?php
ob_start ();

###########################
//require "session_mysql.php";
###########################
session_start ();

require "settings.php";
require "autorizacia.php";
require "head.php";

if (Autorizacia () == false) {
	require "login.php";
	require "foot.php";
	exit ();
	}

switch ($_GET["menu"]){
	case "dalsia2":
	case "dalsia3":
		require $_GET["menu"].".php";
		break;
	default:
		require "dalsia1.php";
		break;
	}

require "foot.php";
ob_end_flush ();
?>



<body>
</body>
</html>
emissary
Profil
getVisitorIdentifier.php

<?php echo "<?xml version=\"1.0\" encoding=\"windows-1250\"?>"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="sk" lang="sk">
<head>
	<title>Autorizácia v PHP pomocou SESSION</title>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
</head>

<body>
<?php
$db_server = "*******";
$db_user = "*******";
$db_passwd = "*******";
$db_name = "*******";

// vytvorenie spojenia s db serverom
mysql_connect ($db_server, $db_user, $db_passwd) or die ("Nepodarilo sa pripojiť k databáze !");
// vyber db
mysql_select_db ($db_name) or die ("Nepodarilo sa vybrať databázu !");
?>
<a href="<?echo HTTPS_PATH?>index.php?menu=dalsia1<?php echo (SID?"&amp;".SID:"")?>">Dalsia 1</a>&nbsp;|&nbsp;<a href="<?echo HTTPS_PATH?>index.php?menu=dalsia2<?php echo (SID?"&amp;".SID:"")?>"">Dalsia 2</a>&nbsp;|&nbsp;<a href="<?echo HTTPS_PATH?>index.php?menu=dalsia3<?php echo (SID?"&amp;".SID:"")?>"">Dalsia 3</a><hr />
Alphard
Profil
emissary:
Nemusíte sem dávat stovky řádků kódu, je to po milionté ten samý problém, přečtěte si FAQ nebo hledejte.
xmark
Profil
emissary:
session-start je nutno volat předtím, než pošleš cokoliv do prohlížeče. Tzn. nesmí nad tím být žádné html a v php žádné echo. Ta otázka se tady objevuje asi dvakrát týdně, stačí trochu hledat.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0