Hi, i have a function in an include file in the includes directory, the function sets some session vars. The problem is that when the login is ok, $_SESSION is empty.
If y look into the directory where sessions are stored, there is one file with de session data and another one new empty.
Any ideas?
Thanks in advance.
here goes the .inc:
<?php
require_once 'mensajes.inc';
require_once 'mysql_util.inc';
function vrfy_login(){
global $mensajes;
if (!isset($_SESSION["id_user"])) {
require_once 'style_new.css';
echo ("<table>");
echo ("<tr>");
echo ("<td>");
echo ("<img src=img/stop3d.jpg>");
echo ("</td>");
echo ("<td valign=top>");
echo ("<b>Error <font color=#ba1c14>igs</font></b><b> (ls1001):</b><br>");
echo ("</td>");
echo ("<td valign=top>");
echo( $mensajes["err_timeout"] );
echo ("</td>");
echo ("</tr>");
echo ("</table>");
exit();
}
}
function conectar($user_name,$pass){
conexion();
seleccion();
global $mensajes;
global $dbcnx;
$log_in = mysql_query("select usr,real_name,fe_perfiles.descripcion,mail,fe_users.id_perfil,id_usr from fe_users inner join fe_perfiles on fe_users.id_perfil = fe_perfiles.id_perfil where usr = '$user_name' and passwd = sha('$pass')",$dbcnx);
if (mysql_num_rows($log_in) < 1 or mysql_num_rows($log_in) > 1) {
require_once 'style_new.css';
echo ("<table>");
echo ("<tr>");
echo ("<td>");
echo ("<img src=img/stop3d.jpg>");
echo ("</td>");
echo ("<td valign=top>");
echo ("<b>Error <font color=#ba1c14>igs</font></b><b> (ls1000):</b><br>");
echo ("</td>");
echo ("<td valign=top>");
echo( $mensajes["err_login"] );
echo ("</td>");
echo ("</tr>");
echo ("</table>");
exit();
} else
{
while($myresult=mysql_fetch_array($log_in))
{
$_SESSION["user_ok"] = $myresult[0];
$_SESSION["real_name"] = $myresult[1];
$_SESSION["perfil"] = $myresult[2];
$_SESSION["mail"] = $myresult[3];
$_SESSION["id_perfil"] = $myresult[4];
$_SESSION["id_user"] = $myresult[5];
}
}
Header("Location: index2.php");
}