Código PHP:
<?php
session_name('pd');
session_start();
session_register('login');
session_register('masterlogin');
session_register('codigo');
session_register('name');
$user=$HTTP_POST_VARS['user'];
$pass=$HTTP_POST_VARS['pass'];
if ($user==null AND $pass==null){header("location: login.php");
}else{
session_name('pd');
session_start ();
include("cone.php");
$tabla="usuarios";
$query = mysql_query ("SELECT codigo FROM $tabla WHERE codigo='$user' AND clave='$pass'", $conexion);
if (mysql_num_rows($query)==1) {
session_register ('login');
session_register ('codigo');
$_SESSION['login']=true;
$_SESSION['codigo']=$user;
header("location: presentacion.php");
}else{
$tabla="admin";
$query = mysql_query ("SELECT codigo FROM $tabla WHERE nombre='$user' AND pass='$pass'", $conexion);
if (mysql_num_rows($query)==1) {
session_register ('masterlogin');
session_register ('name');
$_SESSION['masterlogin']=true;
$_SESSION['name']=$user;
header("location: presentacion.php");
}else{ header("location: error.php");}
}} ?>
Código PHP:
<?php
session_name('pd');
session_start();
session_register('login');
session_register('codigo');
if ($_SESSION['login']==true AND isset($_SESSION['codigo'])){
include("cone.php");
$tabla="usuarios";
$codigo=$_SESSION['codigo'];
$query = mysql_query ("SELECT codigo,nombre,apepat,nota1,nota2,nota3,nota4 FROM $tabla WHERE codigo='$codigo'", $conexion);
$user = mysql_fetch_array($query);
$tabla_mod="modapren"; ?>