From f290d0a6ce845a848b734a24885707f1f5f513f4 Mon Sep 17 00:00:00 2001 From: Vladimir H Date: Sun, 14 Dec 2008 15:32:11 -0600 Subject: [PATCH] =?utf8?q?Restaurado:=20Edicici=C3=B3n=20Eliminaci=C3=B3n?= =?utf8?q?=20de=20instructores=20Modulo=20de=20depuraci=C3=B3n=20adicional?= =?utf8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- contenido/admin.php | 6 ++-- contenido/adminprocess.php | 65 ++++++++++++++++++----------------------- contenido/global+404.php | 2 +- contenido/sub.php | 3 +- contenido/usuario+registrar.php | 2 +- include/depurar.php | 5 ++++ include/process.php | 2 +- include/sesion.php | 2 +- index.php | 4 +-- 9 files changed, 42 insertions(+), 49 deletions(-) create mode 100644 include/depurar.php diff --git a/contenido/admin.php b/contenido/admin.php index a988575..40473c6 100755 --- a/contenido/admin.php +++ b/contenido/admin.php @@ -1,9 +1,7 @@ isAdmin()){ - header("Location: ../"); -} function displayUsers(){ global $database; @@ -69,7 +67,7 @@ Level:

Quitar Instructor

error("deluser"); ?> -
+ Código:
"> diff --git a/contenido/adminprocess.php b/contenido/adminprocess.php index c798db9..96fdecd 100755 --- a/contenido/adminprocess.php +++ b/contenido/adminprocess.php @@ -1,38 +1,33 @@ -isAdmin()){ - header("Location: ../?x=admin"); - return; - } + if($session->isAdmin()){ + /* Admin submitted update user level form */ if(isset($_POST['subupdlevel'])){ - $this->procUpdateLevel(); + procUpdateLevel(); } /* Admin submitted delete user form */ else if(isset($_POST['subdeluser'])){ - $this->procDeleteUser(); + procDeleteUser(); } /* Admin submitted delete inactive users form */ else if(isset($_POST['subdelinact'])){ - $this->procDeleteInactive(); + procDeleteInactive(); } /* Admin submitted ban user form */ else if(isset($_POST['subbanuser'])){ - $this->procBanUser(); + procBanUser(); } /* Admin submitted delete banned user form */ else if(isset($_POST['subdelbanned'])){ - $this->procDeleteBannedUser(); - } - /* Should not get here, redirect to home page */ - else{ - header("Location: ../?x=admin"); + procDeleteBannedUser(); } + + } else { + + return; + } /** @@ -43,18 +38,18 @@ function procUpdateLevel(){ global $session, $database, $form; /* Username error checking */ - $subuser = $this->checkUsername("upduser"); + $subuser = checkUsername("upduser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } /* Update user level */ else{ $database->updateUserField($subuser, "userlevel", (int)$_POST['updlevel']); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } } @@ -65,19 +60,19 @@ function procDeleteUser(){ global $session, $database, $form; /* Username error checking */ - $subuser = $this->checkUsername("deluser"); + $subuser = checkUsername("deluser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } /* Delete user from database */ else{ $q = "DELETE FROM ".TBL_USERS." WHERE username = '$subuser'"; $database->query($q); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } } @@ -93,7 +88,7 @@ $q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time " ."AND userlevel != ".ADMIN_LEVEL; $database->query($q); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } /** @@ -105,13 +100,13 @@ function procBanUser(){ global $session, $database, $form; /* Username error checking */ - $subuser = $this->checkUsername("banuser"); + $subuser = checkUsername("banuser"); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } /* Ban user from member system */ else{ @@ -120,7 +115,7 @@ $q = "INSERT INTO ".TBL_BANNED_USERS." VALUES ('$subuser', $session->time)"; $database->query($q); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } } @@ -132,19 +127,19 @@ function procDeleteBannedUser(){ global $session, $database, $form; /* Username error checking */ - $subuser = $this->checkUsername("delbanuser", true); + $subuser = checkUsername("delbanuser", true); /* Errors exist, have user correct them */ if($form->num_errors > 0){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } /* Delete user from database */ else{ $q = "DELETE FROM ".TBL_BANNED_USERS." WHERE username = '$subuser'"; $database->query($q); - header("Location: ../?x=admin"); + header("Location: ../?accion=admin"); } } @@ -171,10 +166,6 @@ } } return $subuser; - } -}; - -/* Initialize process */ -$adminprocess = new AdminProcess; +} ?> diff --git a/contenido/global+404.php b/contenido/global+404.php index c20c15e..c94da8c 100644 --- a/contenido/global+404.php +++ b/contenido/global+404.php @@ -3,7 +3,7 @@ function CONTENIDO_global_404() { echo '

Sistema de Horarios- ¡Error!


-¡Lo sentimos pero Ud. ha intentado ingresar a un área de este sitio que no existe!
+¡Lo sentimos pero Ud. ha intentado ingresar a un área de este sitio que no existe!('.$_SESSION[_ACC_] .')
Si Ud. cree que esta página debería de existir, entonces por favor notifique al Administrador.
Puede hacerlo haciendo clic en el enlace "contacto con el Administrador" mostrado más abajo
'; diff --git a/contenido/sub.php b/contenido/sub.php index e47d3cd..7860119 100644 --- a/contenido/sub.php +++ b/contenido/sub.php @@ -123,8 +123,9 @@ function CONTENIDO_mostrar_principal() { case "infosis": break; case "ayuda contacto": break; case "rpr clave": break; - default: if (!$session->logged_in){$_SESSION[_ACC_] = "ingresar";} + default: if (!$session->logged_in||!isset($_SESSION[_ACC_])){$_SESSION[_ACC_] = "ingresar";} } + switch ($_SESSION[_ACC_] ) { case "usuario info": diff --git a/contenido/usuario+registrar.php b/contenido/usuario+registrar.php index 35608c4..729f4e9 100644 --- a/contenido/usuario+registrar.php +++ b/contenido/usuario+registrar.php @@ -18,7 +18,7 @@ if($form->num_errors > 0){ echo "$form->num_errors error(s) found"; } ?> - + diff --git a/include/depurar.php b/include/depurar.php new file mode 100644 index 0000000..a7a99fe --- /dev/null +++ b/include/depurar.php @@ -0,0 +1,5 @@ +";} +} +?> \ No newline at end of file diff --git a/include/process.php b/include/process.php index 58888a0..cf14565 100755 --- a/include/process.php +++ b/include/process.php @@ -110,7 +110,7 @@ class Process } $_SESSION['post-post'] = true; - header("Location: ./?x=registro"); + header("Location: ./?accion=registro"); } /** diff --git a/include/sesion.php b/include/sesion.php index 1b5f7f2..f0b8247 100755 --- a/include/sesion.php +++ b/include/sesion.php @@ -2,7 +2,7 @@ require_once("database.php"); require_once("mailer.php"); require_once("form.php"); - +require_once("depurar.php"); class Session { var $username; //Username given on sign-up diff --git a/index.php b/index.php index a642d79..3611d67 100644 --- a/index.php +++ b/index.php @@ -17,6 +17,7 @@ define("CONTINUAR",'Continuar'); /*-----------------------INCLUSIONES-------------------*/ /* CODIGO */ /* Controlador principal de la sesión */ +require_once("include/depurar.php"); require_once("include/sesion.php"); /* Datos de configuración para el servidor */ require_once("include/data.php"); @@ -41,9 +42,6 @@ $_SESSION[_ACC_] = $_GET[_ACC_]; /* Hacer disponible a todos mi ubicación*/ $sURL_INDEX = $_SERVER['PHP_SELF']; -function DEPURAR($sTexto){ - if (0) {echo $sTexto."
";} -} ?> -- 2.11.4.GIT
Carné:">error("user"); ?>
Clave:">error("pass"); ?>