Jump to content

[SOLVED] PHP 6.0.0-dev $_SESSION problem


morthor

Recommended Posts

i have a huge problem, my web page is full of $_SESSION vars and the problem is... i updated my server with Apache 2.2.8 and PHP 6.0.0-dev and will not accept the register_session and $_SESSION, so i need some way to recover all that vars... before this problem make's me sick...

 

and sorry about my english...

Link to comment
https://forums.phpfreaks.com/topic/147582-solved-php-600-dev-_session-problem/
Share on other sites

ok the next code check password and login from students, and register some Session vars....

 

$alumnos=mysql_query("SELECT * FROM users WHERE nick='$_POST[LOG]' and pass='$_POST[PSW]' ");

 

  if(is_numeric($psw{1}) and is_numeric($psw{4}) AND $user_ok = mysql_fetch_array($alumnos))

 

  {

 

  //comprobamos en la db si existe ese nick con esa pass

 

  session_register("usuario"); //registramos la variable usuario que contendrá el nick del user

 

  session_register("email"); //registramos la variable idusuario que contendrá la id del user

 

  session_register("level"); //registramos la variable level que contendrá el level del user

 

  session_register("clave"); //registramos la clave del alumno

 

  session_register("permiso"); //registramos los permiso para califs

 

  //damos valores a las variables de la sesión

 

  $_SESSION[usuario] = $user_ok["nick"]; //damos el nick a la variable usuario

 

  $_SESSION = $user_ok["email"]; //damos la id del user a la variable idusuario

 

  $_SESSION[level] = $user_ok["level"]; //damos el level del user a la variable level

 

  $_SESSION[clave] = $user_ok["id"];    //damos el id a la variable clave

 

  $_SESSION[permiso] = $user_ok["give"];    //damos el give a la variable permiso

 

  Header("Location: 07alumno/2alumno.htm"); //volvemos al login donde nos saldrá nuestro menú de usuario

 

  }

 

 

the problem is all pages need this vars to work properly, for example this code, says me the student classroom

 

<?

//Let the Goddamn game begins

session_start();

include '../coneccion.php';

$base0=mysql_query("SELECT * FROM alu_st WHERE ID=$_SESSION[clave]");

$pre0=mysql_fetch_array($base0);

if($pre0[skin]==0)

{

$i=1;

$az=0;

if($_SESSION[clave]>=1000 and  $_SESSION[clave]<=2000)

{

  $z=1;

}

elseif($_SESSION[clave]>=2000 and  $_SESSION[clave]<=3000)

{

  $z=2;

}

elseif($_SESSION[clave]>=3000 and  $_SESSION[clave]<=4000)

{

  $z=3;

}

elseif($_SESSION[clave]>=4000 and  $_SESSION[clave]<=5000)

{

  $z=4;

}

elseif($_SESSION[clave]>=5000 and  $_SESSION[clave]<=6000)

{

  $z=5;

}

elseif($_SESSION[clave]>=6000)

{

  $z=6;

}

 

so every page in my web need this vars, and i have aprox 200 php's and encode all of 200... just imagine

 

I hope this have a solution

 

FOR YOUR TIME THANKS BRO

Any page that sets or references a $_SESSION variable must have a session_start() statement in it before any content is output.

 

You should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON to get php to help you with problems it finds when your code runs.

ok my final code after the corrections

 

$maestros=mysql_query("SELECT * FROM maestros WHERE nick='$_POST[LOG]' and pass='$_POST[PSW]' ");

 

  if($user_ok = mysql_fetch_array($maestros)) //si existe comenzamos con la sesion, si no, al index

 

  {

 

  //session_start();

 

 

 

  //damos valores a las variables de la sesión

 

  $_SESSION['usuario'] = $user_ok["nick"]; //damos el nick a la variable usuario

 

  $_SESSION['email'] = $user_ok["email"]; //damos el email que determinara el salon

 

  $_SESSION['level'] = $user_ok["level"]; //damos el level del user a la variable level

 

  $_SESSION['periodo'] = $user_ok["periodo"]; //damos al periodo a la variable de sesion

 

  Header("Location: 09personal/schuler.php"); //volvemos al login donde nos saldrá nuestro menú de usuario

 

  }

 

and this is Shuler.php

 

session_start();

/*NOTA: aqui solo se hace una mera redireccion de la sección*/

        if ($_SESSION[level] == 3)

        Header("Location: mainmaestros.htm");

        elseif($_SESSION[level] == 4)

        Header("Location: secres.htm");

        elseif($_SESSION[level] == 3 and $_SESSION == 91)

        Header ("Location: compu.htm");

        elseif($_SESSION[level] == 4 and $_SESSION == 99)

        Header ("Location: psico.htm");

        else

        echo $_SESSION[level];

        //Header ("location: ../denaid.htm");

 

the problem is aparently solved, but here put echo because dont send session var, always sendme to denaid... so thats why i comment that codeline... so what is the problem here???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.