php sessions

From: tomas vagner | chicken (tom@chickenator.cz)
Date: 09. 12. 2001, 15:41 CET


Potrebuju nakopnout:
Na jedne strance mam formular pro heslo a jmeno, po odelani se kontroluje
podle databaze - az sem je vsechno OK. Ted potrebuju zaregistrovat promennou
pomoci 'session_register("promenna")', zadnou chybu to nehlasi. Na jine
strance chci precist promennou, ale ono se to nejak nedari.
Session.auto_start mam nastavene na 1, session.use_cookies na 0 a
session.use_trans_sid mam na 1, takze by se registrovane promenne mely
nacitat automaticky a session id by se melo samo predavat v url (coz se
deje).

Pridam jeste zdrojaky:

prvni.php:
<?
$spojeni = MySQL_Connect("localhost","jmeno","heslo");
MySQL_Select_DB("mojeDB");
if($loginname && $pass && !$HTTP_GET_VARS['loginname'] &&
!$HTTP_GET_VARS['pass']){
	$vysledek = MySQL_Query("SELECT * FROM admins WHERE login LIKE
'".AddSlashes($loginname)."%' AND password LIKE '".AddSlashes($pass)."%'");
	if(!$vysledek){
		echo 'spatny login nebo heslo';
	}else{
		$a = MySQL_Fetch_Array($vysledek);
		Session_register("pass");
		echo 'druha stranka';
	}
}else{
?>
<form name="moje" action="prvni.php" method="post">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr><td height="60"></td></tr>
<tr>
	<td align="right" class="normal">
	login:&nbsp;&nbsp;<input type="Text" name="loginname" class="textInput">
	</td>
</tr>
<tr><td height="3"></td></tr>
<tr>
	<td align="right" class="normal">
	heslo:&nbsp;&nbsp;<input type="Password" name="pass" class="textInput">
	</td>
</tr>
<tr><td height="6"></td></tr>
<tr>
	<td align="right" class="normal">
	<input type="Image" src="../img/butform_odoslat.gif">
	</td>
</tr>
</form>
</table>
<?
}
MySQL_Close();
?>

...
a druha.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title></title>
		<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
		<meta name="Author" content="tomas vagner | chicken, tom@chickenator.cz">
	</head>
	<body bgcolor="" leftmargin="0" topmargin="0" marginheight="0"
marginwidth="0">
<?
echo $pass; //nic nevypise
?>
	</body>

</html>


Predem dik za radu, doufam ze se nekdo najde:)
      tomas vagner | chicken



This archive was generated by hypermail 2.1.2 : 09. 12. 2001, 15:36 CET