Re: [PHP4BETA] session problem

From: Date: Mon, 29 May 2000 10:19:22 +0000
Subject: Re: [PHP4BETA] session problem
Groups: php.version4 
Request: Send a blank email to php-version4+get-15885@lists.php.net to get a copy of this message
>hi there, > >i've been experiencing a very strange behavior with php 4.0.0 + apache >1.3.12. basically, what i do is post some vars to a script which evaluates >and decides where to redirect it to. it goes fine for the first and second >file (it only creates one session file that contains the registered session >variables). but when it redirects to the final php file, it starts a NEW >(?!?!?!?!!?) session, so 'no variable' is registered, and it goes back to >the input file. and i know code IS working fine, with php4b1 and php4rc1 >(since production server still has rc1). well, here they go: > >input script: >>>>>>>>>>>>> > ><form action="revisar_usuario.php" method="post"> > Usuario: <input tyep="text" name="userTxt" size="8" >maxlength="8"><br> > Contraseña: <input type="password" name="passTxt" size="8" >maxlength="8"><br> > <br> > <input type="submit" value="Ingresar"> ></form> > ><<<<<<<<<<<< > >evaluation script: >>>>>>>>>>>>> > >require "../inc/default_includes.inc"; > >$found = false; > >$db_conn = pg_connect("dbname=$g_database user=$db_user password=$db_pass"); >$query = pg_exec($db_conn, "select * from user_pass where usuario = >'$userTxt' and clave = '$passTxt'"); >$row = 0; // postgres needs a row counter other dbs might not > >if (pg_NumRows($query) > 0) { > $data = pg_fetch_array($query, $row); Have you started any session? If not the vars will not register... You need start a session before register something. From teh manual: "session_register -- Register one or more variables with the current session" ^^^^^^^^^^^^^^^ Sorry my english... Inte, Fernando Silva > session_register('s_user'); > session_register('s_pass'); > session_register('s_logon'); > $s_user = $data['usuario']; > $s_pass = $data['clave']; > $s_logon = true; > $found = true; >} > >if (strlen($userTxt) <= 0 || strlen($passTxt) <= 0) { > $found = false; >} > >if ($found) { > Header("Location: inicio.php"); >} else { > Header("Location: entrada.php?_status=1"); >} > ><<<<<<<<<<< > >check script: >>>>>>>>>>> > >session_start(); >if ($s_logon != true) { > Header("Location: salir.php"); >} > ><<<<<<<<<< > >also, maybe it has something to do, here are the compiling args: > >'./configure' '--with-apache=../apache_1.3.12' >'--enable-track-vars' >'--enable-ftp' '--with-gd=/usr/src/gd-1.8.2/' >'--with-jpeg=/usr/local/bin/' >'--with-zlib-dir=/usr/lib/' '--with-png-dir=/usr/lib/' >'--with-pgsql' >'--enable-trans-sid' '--with-regex=php' '--enable-sysvsem' >'--enable-sysvshm' '--with-dom=/usr/lib/' > >thanks in advance.

« previous php.version4 (#15885) next »