cabe.php
<html><head>
<title> Pie </title>
</head>
<body bgcolor text="blue">
<hr>
<center><h1> BASE DE DATOS AGENDA </h1></center>
</body>
</html>
master.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Formulario de validación de usuario</title>
</head>
<script languaje='javascript'>
function actualizar(n,v,x){
location.href='master.php?id=11&num='+n+'&v='+v+'&x='+x;
}
function numeros(e){
var tecla=document.all? tecla=e.keyCode:tecla=e.which;
if (tecla==8 || tecla==0) return true;
return ((tecla>47 && tecla<58) || tecla==46);
}
function letras(e){
tecla=(document.all)?e.keyCode:e.which;
if (tecla==8 || tecla==0) return true;
patron=/[A-Za-z\s]/;
te=String.fromCharCode(tecla);
return patron.test(te);
}
function enter(e, object){
if (e.keyCode==13){
return object.focus();
}
}
</script>
<style type="text/css">
* {
padding:0px;
margin:0px;
}
#header {
margin:auto;
width:800px;
font-family:arial;
}
ul, ol {
list-style:none;
}
.nav li a {
background-color:#069;
color:#FFFFFF;
text-decoration:none;
padding: 10px 15px;
display:block;
}
.nav li a:hover {
background-color:#FF3300;
}
.nav > li {
float:left;
}
.nav li ul {
display:none;
position:absolute;
min-width:140px;
}
.nav li:hover > ul {
display:block;
}
.nav li ul li {
position:relative;
}
.nav li ul li ul {
right:-140px;
top:0px;
}
</style>
<?php
session_start();
include_once ("cabe.php");
?>
<div style="height:450px;width:100%">
<table border="0px" width="100%">
<tr>
<td colspan="2">
<?php
if (isset($_SESSION)){
if (isset($_SESSION['nivel'])){
if ($_SESSION['nivel']==3 || $_SESSION['nivel']==2){
include_once ("menuadmin.php");
}
if ($_SESSION['nivel']==1){
include_once ("menuuser.php");
}
if ($_SESSION['nivel']==4)
include_once ("menuadmin.php");
}
}
?>
</td>
</tr>
<tr>
<td width="200px" height="450px">
<?php
include_once ("Registro.php");
?>
</td>
<td>
<?php
switch($_GET['id']){
case 1:
include_once ("contenido.php");
break;
case 2:
include_once ("Registrar.php");
break;
case 3:
include_once ("Reporte.php");
break;
case 4:
include_once("Filtro.php");
break;
case 5:
include_once("Insertar.php");
break;
case 6:
include_once("Actualizar.php");
break;
case 7:
include_once("Eliminar.php");
break;
case 8:
include_once("Confirmar.php");
break;
case 9:
include_once('usuarios.php');
break;
case 10:
include_once('user.php');
break;
case 11:
include_once('admin.php');
break;
case 12;
unset($_SESSION['user']);
unset($_SESSION['nivel']);
unset($_SESSION['activo']);
echo "<script languaje='javascript'>location.href='master.php?id=1'</script>";
break;
}
?>
</td>
</tr>
</table>
</div>
</div>
<br>
<br>
<br>
<br>
<?php
include_once ("pi.php");
?>
<div>
</body>
</html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Formulario de validación de usuario</title>
</head>
<script languaje='javascript'>
function actualizar(n,v,x){
location.href='master.php?id=11&num='+n+'&v='+v+'&x='+x;
}
function numeros(e){
var tecla=document.all? tecla=e.keyCode:tecla=e.which;
if (tecla==8 || tecla==0) return true;
return ((tecla>47 && tecla<58) || tecla==46);
}
function letras(e){
tecla=(document.all)?e.keyCode:e.which;
if (tecla==8 || tecla==0) return true;
patron=/[A-Za-z\s]/;
te=String.fromCharCode(tecla);
return patron.test(te);
}
function enter(e, object){
if (e.keyCode==13){
return object.focus();
}
}
</script>
<style type="text/css">
* {
padding:0px;
margin:0px;
}
#header {
margin:auto;
width:800px;
font-family:arial;
}
ul, ol {
list-style:none;
}
.nav li a {
background-color:#069;
color:#FFFFFF;
text-decoration:none;
padding: 10px 15px;
display:block;
}
.nav li a:hover {
background-color:#FF3300;
}
.nav > li {
float:left;
}
.nav li ul {
display:none;
position:absolute;
min-width:140px;
}
.nav li:hover > ul {
display:block;
}
.nav li ul li {
position:relative;
}
.nav li ul li ul {
right:-140px;
top:0px;
}
</style>
<?php
session_start();
include_once ("cabe.php");
?>
<div style="height:450px;width:100%">
<table border="0px" width="100%">
<tr>
<td colspan="2">
<?php
if (isset($_SESSION)){
if (isset($_SESSION['nivel'])){
if ($_SESSION['nivel']==3 || $_SESSION['nivel']==2){
include_once ("menuadmin.php");
}
if ($_SESSION['nivel']==1){
include_once ("menuuser.php");
}
if ($_SESSION['nivel']==4)
include_once ("menuadmin.php");
}
}
?>
</td>
</tr>
<tr>
<td width="200px" height="450px">
<?php
include_once ("Registro.php");
?>
</td>
<td>
<?php
switch($_GET['id']){
case 1:
include_once ("contenido.php");
break;
case 2:
include_once ("Registrar.php");
break;
case 3:
include_once ("Reporte.php");
break;
case 4:
include_once("Filtro.php");
break;
case 5:
include_once("Insertar.php");
break;
case 6:
include_once("Actualizar.php");
break;
case 7:
include_once("Eliminar.php");
break;
case 8:
include_once("Confirmar.php");
break;
case 9:
include_once('usuarios.php');
break;
case 10:
include_once('user.php');
break;
case 11:
include_once('admin.php');
break;
case 12;
unset($_SESSION['user']);
unset($_SESSION['nivel']);
unset($_SESSION['activo']);
echo "<script languaje='javascript'>location.href='master.php?id=1'</script>";
break;
}
?>
</td>
</tr>
</table>
</div>
</div>
<br>
<br>
<br>
<br>
<?php
include_once ("pi.php");
?>
<div>
</body>
</html>
menuuser.php
<!doctype html>
<html lang="es" id="alex">
<head>
</head>
<body>
<div id="header">
<ul class="nav">
<li><a href="?id=1">INICIO</a></li>
<li><a href="?id=3">INFORMES</a></li>
<li><a href="master.php?id=12">CERRAR SESION</a>
</ul>
</div>
</body>
</html>
<html lang="es" id="alex">
<head>
</head>
<body>
<div id="header">
<ul class="nav">
<li><a href="?id=1">INICIO</a></li>
<li><a href="?id=3">INFORMES</a></li>
<li><a href="master.php?id=12">CERRAR SESION</a>
</ul>
</div>
</body>
</html>
menuadmin.php
<!doctype html>
<html lang="es" id="alex">
<head>
</head>
<body>
<div id="header">
<ul class="nav">
<li><a href="?id=1">INICIO</a></li>
<li><a href="#">REGISTROS</a>
<ul>
<li><a href="?id=2">Insertar</a></li>
<li><a href="?id=6">Actualizar</a></li>
<li><a href="?id=7">Eliminar</a></li>
</ul>
</li>
<li><a href="?id=3">INFORMES</a></li>
<li><a href="master.php?id=12">CERRAR SESION</a>
</ul>
</div>
</body>
</html>
<html lang="es" id="alex">
<head>
</head>
<body>
<div id="header">
<ul class="nav">
<li><a href="?id=1">INICIO</a></li>
<li><a href="#">REGISTROS</a>
<ul>
<li><a href="?id=2">Insertar</a></li>
<li><a href="?id=6">Actualizar</a></li>
<li><a href="?id=7">Eliminar</a></li>
</ul>
</li>
<li><a href="?id=3">INFORMES</a></li>
<li><a href="master.php?id=12">CERRAR SESION</a>
</ul>
</div>
</body>
</html>
Registro.php
<!doctype html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$name=$passw="";
if (isset($_POST)){
if (isset($_POST['user']))
$name=$_POST['user'];
if (isset($_POST['passw']))
$passw=$_POST['passw'];
if ($name!="" && $passw!=""){
$sql=mysql_query("select * from usuario where nom_usu='$name' and cla_usu='$passw'");
if ($fila=mysql_fetch_array($sql)) {
$_SESSION['user']=$fila['nom_usu'];
$_SESSION['nivel']=$fila['niv_usu'];
$_SESSION['activo']=$fila['est_usu'];
if ($fila['niv_usu']==4)
echo "<script languaje='javascript'>location.href='master.php?id=11'</script>";
else
echo "<script languaje='javascript'>location.href='master.php?id=1'</script>";
}else{
$error="NO EXISTE USUARIO REGISTRADO";
}
}
}
}
?>
<form method="POST" acction="master.php?id=11">
<table width="100%" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="" colspan="2"><center><font color=""><h2>REGISTRO</h2></center></font></td>
</tr>
<tr>
<td><b>USUARIO</b></td>
<td><input type="text" onkeypress="return letras(event);" id="user" name="user" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CLAVE</b></td>
<td><input type="password"onkeypress="return letras numeros(event);" id="passw" name="passw" style="width:120px;"/></td>
</tr>
<tr>
<td colspan="2"><center><b><input onclick="
var u=document.getElementById('user').value;
var c=document.getElementById('passw').value;
if (u=='' || c=='')
alert('REGISTRE DATOS EN LOS TEXTOS POR FAVOR');
" type="submit" name="registro" value="INGRESAR AL SISTEMA"/></b></center></td>
</tr>
<tr>
<td colspan="2"><center><a href="master.php?id=9">REGISTRAR AL SISTEMA</a></center></td>
</tr>
<tr>
<td colspan="2"><center><b><font color="red"><?php if (isset($error)) echo $error;?></font></b></center></td>
</tr>
</table>
</form>
</body>
</html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$name=$passw="";
if (isset($_POST)){
if (isset($_POST['user']))
$name=$_POST['user'];
if (isset($_POST['passw']))
$passw=$_POST['passw'];
if ($name!="" && $passw!=""){
$sql=mysql_query("select * from usuario where nom_usu='$name' and cla_usu='$passw'");
if ($fila=mysql_fetch_array($sql)) {
$_SESSION['user']=$fila['nom_usu'];
$_SESSION['nivel']=$fila['niv_usu'];
$_SESSION['activo']=$fila['est_usu'];
if ($fila['niv_usu']==4)
echo "<script languaje='javascript'>location.href='master.php?id=11'</script>";
else
echo "<script languaje='javascript'>location.href='master.php?id=1'</script>";
}else{
$error="NO EXISTE USUARIO REGISTRADO";
}
}
}
}
?>
<form method="POST" acction="master.php?id=11">
<table width="100%" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="" colspan="2"><center><font color=""><h2>REGISTRO</h2></center></font></td>
</tr>
<tr>
<td><b>USUARIO</b></td>
<td><input type="text" onkeypress="return letras(event);" id="user" name="user" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CLAVE</b></td>
<td><input type="password"onkeypress="return letras numeros(event);" id="passw" name="passw" style="width:120px;"/></td>
</tr>
<tr>
<td colspan="2"><center><b><input onclick="
var u=document.getElementById('user').value;
var c=document.getElementById('passw').value;
if (u=='' || c=='')
alert('REGISTRE DATOS EN LOS TEXTOS POR FAVOR');
" type="submit" name="registro" value="INGRESAR AL SISTEMA"/></b></center></td>
</tr>
<tr>
<td colspan="2"><center><a href="master.php?id=9">REGISTRAR AL SISTEMA</a></center></td>
</tr>
<tr>
<td colspan="2"><center><b><font color="red"><?php if (isset($error)) echo $error;?></font></b></center></td>
</tr>
</table>
</form>
</body>
</html>
contenido.php
<html>
<head>
</head>
<body bgcolor text="blue">
<div style="width:100%; height:100%; background:url('agenda.jpg')">
</div>
</body>
</html>
<head>
</head>
<body bgcolor text="blue">
<div style="width:100%; height:100%; background:url('agenda.jpg')">
</div>
</body>
</html>
Registrar.php
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if (isset($_GET['ida'])){
if(!$conexion)
die ('No se establecio la coneccion'.mysql_error());
else
echo("");
mysql_select_db("bddagenda",$conexion);
$codigo=$_GET['ida'];
$sql=mysql_query("select *from agenda where idagenda=$codigo");
while($fila=mysql_fetch_array($sql))
{
$codigo=$fila['idagenda'];
$nombre=$fila['Nombre'];
$apellido=$fila['Apellido'];
$edad=$fila['edad'];
$telefono=$fila['telefono'];
$direccion=$fila['Direccion'];
$ciudad=$fila['Ciudad'];
$sexo=$fila['Sexo'];
}
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reportes</title>
</head>
<body>
<form action="master.php?id=5" method="POST">
<fieldset>
<p>
<label for="codigo">Codigo</label>
<input id="codigo" type="text" name="codigo" size="18" value="<?php if (isset($codigo)){echo $codigo;}?>"/>
</p>
<p>
<label for="username">Nombre</label>
<input id="nombre" type="text" name="nombre" size="18" value="<?php if (isset($nombre)){echo $nombre;}?>"/>
</p>
<p>
<label for="apellido">Apellido</label>
<input id="apellido" type="text" name="apellido" size="18" value="<?php if (isset($apellido)){echo $apellido;}?>"/>
</p>
<p>
<label for="edad">Edad</label>
<input id="edad" type="text" name="edad" size="18" value="<?php if (isset($edad)){echo $edad;}?>"/>
</p>
<p>
<label for="correo">Direccion</label>
<input id="direccion" type="text" name="direccion" size="18" value="<?php if (isset($direccion)){echo $direccion;}?>"/>
</p>
<p>
<label for="correo">Telefono</label>
<input id="telefono" type="text" name="telefono" size="18" value="<?php if (isset($telefono)){echo $telefono;}?>"/>
<p>
<p>
<label for="Ciudad">Ciudad
<select name="ciu">
<option value="Azogues">Azogues
<option value="Biblian">Biblian
<option value="Cañar">Cañar
</select>
</label>
</p>
<p>
<label for="Sexo">Sexo
<select name="sex">
<option>M
<option>F
</select>
</label>
</p>
<input type="submit" name="b2" class="button" value="GUARDAR" /> </center>
</p>
</fieldset>
</form>
</body>
</html>
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if (isset($_GET['ida'])){
if(!$conexion)
die ('No se establecio la coneccion'.mysql_error());
else
echo("");
mysql_select_db("bddagenda",$conexion);
$codigo=$_GET['ida'];
$sql=mysql_query("select *from agenda where idagenda=$codigo");
while($fila=mysql_fetch_array($sql))
{
$codigo=$fila['idagenda'];
$nombre=$fila['Nombre'];
$apellido=$fila['Apellido'];
$edad=$fila['edad'];
$telefono=$fila['telefono'];
$direccion=$fila['Direccion'];
$ciudad=$fila['Ciudad'];
$sexo=$fila['Sexo'];
}
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reportes</title>
</head>
<body>
<form action="master.php?id=5" method="POST">
<fieldset>
<p>
<label for="codigo">Codigo</label>
<input id="codigo" type="text" name="codigo" size="18" value="<?php if (isset($codigo)){echo $codigo;}?>"/>
</p>
<p>
<label for="username">Nombre</label>
<input id="nombre" type="text" name="nombre" size="18" value="<?php if (isset($nombre)){echo $nombre;}?>"/>
</p>
<p>
<label for="apellido">Apellido</label>
<input id="apellido" type="text" name="apellido" size="18" value="<?php if (isset($apellido)){echo $apellido;}?>"/>
</p>
<p>
<label for="edad">Edad</label>
<input id="edad" type="text" name="edad" size="18" value="<?php if (isset($edad)){echo $edad;}?>"/>
</p>
<p>
<label for="correo">Direccion</label>
<input id="direccion" type="text" name="direccion" size="18" value="<?php if (isset($direccion)){echo $direccion;}?>"/>
</p>
<p>
<label for="correo">Telefono</label>
<input id="telefono" type="text" name="telefono" size="18" value="<?php if (isset($telefono)){echo $telefono;}?>"/>
<p>
<p>
<label for="Ciudad">Ciudad
<select name="ciu">
<option value="Azogues">Azogues
<option value="Biblian">Biblian
<option value="Cañar">Cañar
</select>
</label>
</p>
<p>
<label for="Sexo">Sexo
<select name="sex">
<option>M
<option>F
</select>
</label>
</p>
<input type="submit" name="b2" class="button" value="GUARDAR" /> </center>
</p>
</fieldset>
</form>
</body>
</html>
Reporte.php
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reportes</title>
</head>
<body>
<form action="master.php?id=4" method="POST">
<fieldset>
<p>
<label for="username">FILTRAR POR:</label>
</p>
<p>
<label for="username">Nombre</label>
<input id="nombre" type="text" name="nombre" size="18" value="<?php if (isset($_SESSION["usuario"])){echo $_SESSION["usuario"];}?>"/>
</p>
<p>
<label for="passwd">Apellido</label>
<input id="apellido" type="text" name="apellido" size="18" value="<?php if (isset($_SESSION["apellido"])){echo $_SESSION["apellido"];}?>"/>
</p>
<p>
<label for="correo">Direccion</label>
<input id="direccion" type="text" name="direccion" size="18" value="<?php if (isset($_SESSION["direccion"])){echo $_SESSION["direccion"];}?>"/>
</p>
<p>
<label for="correo">Telefono</label>
<input id="telefono" type="text" name="telefono" size="18" value="<?php if (isset($_SESSION["telefono"])){echo $_SESSION["telefono"];}?>"/>
<p>
<input type="radio" name="b3" value="1" class="imputradio" checked /><label for="username">ASENDENTE</label>
<br>
<input type="radio" name="b3" value="2" class="imputradio"/><label for="username">DESENDENTE</label>
</p>
<p>
<input type="submit" name="b2" class="button" value="FILTRAR" /> <input type="submit" name="b1" class="button" value="LISTAR TODO" /></center>
</p>
</fieldset>
</form>
</body>
</html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reportes</title>
</head>
<body>
<form action="master.php?id=4" method="POST">
<fieldset>
<p>
<label for="username">FILTRAR POR:</label>
</p>
<p>
<label for="username">Nombre</label>
<input id="nombre" type="text" name="nombre" size="18" value="<?php if (isset($_SESSION["usuario"])){echo $_SESSION["usuario"];}?>"/>
</p>
<p>
<label for="passwd">Apellido</label>
<input id="apellido" type="text" name="apellido" size="18" value="<?php if (isset($_SESSION["apellido"])){echo $_SESSION["apellido"];}?>"/>
</p>
<p>
<label for="correo">Direccion</label>
<input id="direccion" type="text" name="direccion" size="18" value="<?php if (isset($_SESSION["direccion"])){echo $_SESSION["direccion"];}?>"/>
</p>
<p>
<label for="correo">Telefono</label>
<input id="telefono" type="text" name="telefono" size="18" value="<?php if (isset($_SESSION["telefono"])){echo $_SESSION["telefono"];}?>"/>
<p>
<input type="radio" name="b3" value="1" class="imputradio" checked /><label for="username">ASENDENTE</label>
<br>
<input type="radio" name="b3" value="2" class="imputradio"/><label for="username">DESENDENTE</label>
</p>
<p>
<input type="submit" name="b2" class="button" value="FILTRAR" /> <input type="submit" name="b1" class="button" value="LISTAR TODO" /></center>
</p>
</fieldset>
</form>
</body>
</html>
Filtro.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la conexion'.mysql_error());
}
else
{
mysql_select_db("bddagenda",$conexion);
$order="asc";
if (isset($_POST['b3'])){
if ($_POST['b3']=="2")
$order="desc";
}
$activo=false;
if (isset($_POST['b2'])){
$value=$_POST['nombre'].$_POST['apellido'].$_POST['direccion'].$_POST['telefono'];
$sql=mysql_query("select * from agenda where concat(Nombre,Apellido,Direccion,telefono) like concat('%','$value','%') order by Nombre $order");
$activo=true;
}
if (isset($_POST['b1'])){
$sql=mysql_query("select * from agenda order by Nombre $order");
$activo=true;
}
if (isset($_POST['b4'])){
$nom=$_POST['nombre'];
$ape=$_POST['apellido'];
$dir=$_POST['direccion'];
$tel=$_POST['telefono'];
$datos="insert into agenda values(9,'$nom','$ape',99,'$tel','$dir')";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}
if ($activo==true){
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td></tr>";
while($fila=mysql_fetch_array($sql))
{
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "</tr>";
}
echo "</table></center";
}
echo "<br><br><br>";
}
?>
<form action="master.php?id=3" method="POST">
<center><input type="submit" name="Submit" class="button" value="REGRESAR" /></center>
</form>
</body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la conexion'.mysql_error());
}
else
{
mysql_select_db("bddagenda",$conexion);
$order="asc";
if (isset($_POST['b3'])){
if ($_POST['b3']=="2")
$order="desc";
}
$activo=false;
if (isset($_POST['b2'])){
$value=$_POST['nombre'].$_POST['apellido'].$_POST['direccion'].$_POST['telefono'];
$sql=mysql_query("select * from agenda where concat(Nombre,Apellido,Direccion,telefono) like concat('%','$value','%') order by Nombre $order");
$activo=true;
}
if (isset($_POST['b1'])){
$sql=mysql_query("select * from agenda order by Nombre $order");
$activo=true;
}
if (isset($_POST['b4'])){
$nom=$_POST['nombre'];
$ape=$_POST['apellido'];
$dir=$_POST['direccion'];
$tel=$_POST['telefono'];
$datos="insert into agenda values(9,'$nom','$ape',99,'$tel','$dir')";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}
if ($activo==true){
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td></tr>";
while($fila=mysql_fetch_array($sql))
{
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "</tr>";
}
echo "</table></center";
}
echo "<br><br><br>";
}
?>
<form action="master.php?id=3" method="POST">
<center><input type="submit" name="Submit" class="button" value="REGRESAR" /></center>
</form>
</body>
Insertar.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la conexion'.mysql_error());
}
else
{
mysql_select_db("bddagenda",$conexion);
if (isset($_POST['b2'])){
$cod=$_POST['codigo'];
$nom=$_POST['nombre'];
$ape=$_POST['apellido'];
$dir=$_POST['direccion'];
$tel=$_POST['telefono'];
$eda=$_POST['edad'];
$ciu=$_POST['ciu'];
$sex=$_POST['sex'];
$sql=mysql_query("select *from agenda where idagenda=$cod");
if($fila=mysql_fetch_array($sql)){
$datos="update agenda set Nombre='$nom',Apellido='$ape',edad=$eda,telefono='$tel',Direccion='$dir',Ciudad='$ciu',Sexo='$sex' where idagenda=$cod";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}else
{
$datos="insert into agenda values($cod,'$nom','$ape',$eda,'$tel','$dir','$ciu','$sex')";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}
}
echo "<br><br><br>";
}
?>
<form action="master.php?id=2" method="POST">
<center><input type="submit" name="Submit" class="button" value="REGRESAR" /></center>
</form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la conexion'.mysql_error());
}
else
{
mysql_select_db("bddagenda",$conexion);
if (isset($_POST['b2'])){
$cod=$_POST['codigo'];
$nom=$_POST['nombre'];
$ape=$_POST['apellido'];
$dir=$_POST['direccion'];
$tel=$_POST['telefono'];
$eda=$_POST['edad'];
$ciu=$_POST['ciu'];
$sex=$_POST['sex'];
$sql=mysql_query("select *from agenda where idagenda=$cod");
if($fila=mysql_fetch_array($sql)){
$datos="update agenda set Nombre='$nom',Apellido='$ape',edad=$eda,telefono='$tel',Direccion='$dir',Ciudad='$ciu',Sexo='$sex' where idagenda=$cod";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}else
{
$datos="insert into agenda values($cod,'$nom','$ape',$eda,'$tel','$dir','$ciu','$sex')";
mysql_query($datos) or die("No se puede grabar");
echo "EL REGISTRO SE CUMPLIO EXITOSAMENTE...BY OK";
}
}
echo "<br><br><br>";
}
?>
<form action="master.php?id=2" method="POST">
<center><input type="submit" name="Submit" class="button" value="REGRESAR" /></center>
</form>
</body>
</html>
Actualizar.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la coneccion'.mysql_error());
}
else
{
echo("");
}
echo "<br>";
mysql_select_db("bddagenda",$conexion);
$sql=mysql_query("select *from agenda");
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td><td>ACCION</td></tr>";
while($fila=mysql_fetch_array($sql))
{
$id=$fila['idagenda'];
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "<td>"."<a href='?id=2&ida=$id'>"."Editar"."</td>";
echo "</tr>";
}
echo "</table></center";
echo "<br><br><br>";
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la coneccion'.mysql_error());
}
else
{
echo("");
}
echo "<br>";
mysql_select_db("bddagenda",$conexion);
$sql=mysql_query("select *from agenda");
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td><td>ACCION</td></tr>";
while($fila=mysql_fetch_array($sql))
{
$id=$fila['idagenda'];
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "<td>"."<a href='?id=2&ida=$id'>"."Editar"."</td>";
echo "</tr>";
}
echo "</table></center";
echo "<br><br><br>";
?>
Eliminar.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la coneccion'.mysql_error());
}
else
{
echo("<br>");
}
echo "<br>";
mysql_select_db("bddagenda",$conexion);
if (isset($_POST['opcion'])){
$c=$_POST['opcion'];
if ($c=='SI'){
if (isset($_GET['ida'])){
$codigo=$_GET['ida'];
$datos="delete from agenda where idagenda=$codigo";
mysql_query($datos) or die("No se puede eliminar");
echo "LA ELIMINACION SE CUMPLIO EXITOSAMENTE...BY chaooo que no se lee o k <---> OK";
}
}
}
$sql=mysql_query("select *from agenda");
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td><td>ACCION</td></tr>";
while($fila=mysql_fetch_array($sql))
{
$id=$fila['idagenda'];
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "<td>"."<a href='?id=8&ida=$id'>"."Eliminar"."</td>";
echo "</tr>";
}
echo "</table></center";
echo "<br><br><br>";
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$conexion=mysql_connect("localhost","coneccionbdd","admin");
if(!$conexion)
{
die ('No se establecio la coneccion'.mysql_error());
}
else
{
echo("<br>");
}
echo "<br>";
mysql_select_db("bddagenda",$conexion);
if (isset($_POST['opcion'])){
$c=$_POST['opcion'];
if ($c=='SI'){
if (isset($_GET['ida'])){
$codigo=$_GET['ida'];
$datos="delete from agenda where idagenda=$codigo";
mysql_query($datos) or die("No se puede eliminar");
echo "LA ELIMINACION SE CUMPLIO EXITOSAMENTE...BY chaooo que no se lee o k <---> OK";
}
}
}
$sql=mysql_query("select *from agenda");
echo "<center><table border='1'><tr><td>ID</td><td>NOMBRE</td><td>APELLIDO</td><td>EDAD</td><td>TELEFONO</td><td>DIRECCIÓN</td><td>CIUDAD</td><td>SEXO</td><td>ACCION</td></tr>";
while($fila=mysql_fetch_array($sql))
{
$id=$fila['idagenda'];
echo "<tr>";
echo "<td>".$fila['idagenda'],''."</td>";
echo "<td>".$fila['Nombre'],''."</td>";
echo "<td>".$fila['Apellido'],''."</td>";
echo "<td>".$fila['edad'],''."</td>";
echo "<td>".$fila['telefono'],''."</td>";
echo "<td>".$fila['Direccion'],''."</td>";
echo "<td>".$fila['Ciudad'],''."</td>";
echo "<td>".$fila['Sexo'],''."</td>";
echo "<td>"."<a href='?id=8&ida=$id'>"."Eliminar"."</td>";
echo "</tr>";
}
echo "</table></center";
echo "<br><br><br>";
?>
Confirmar.php
<?php
$cod=-1;
if (isset($_GET['ida']))
$cod=$_GET['ida'];
?>
<html>
<head>
<title>BorrarCookie</title>
</head>
<body>
<form action="master.php?id=7&ida=<?php echo $cod; ?>" method="post">
<h1> Desea eliminar el campo seleccionado</h1>
<br>
<br>
<br>
<br>
<p>
<label for="Si">SI</label>
<input type="radio" name="opcion" value="SI">
<br>
<label for="No">NO</label>
<input type="radio" name="opcion" value="NO">
</p>
<br>
<br>
<input type="submit" value="CONFIRMAR">
</form>
</body>
</html>
$cod=-1;
if (isset($_GET['ida']))
$cod=$_GET['ida'];
?>
<html>
<head>
<title>BorrarCookie</title>
</head>
<body>
<form action="master.php?id=7&ida=<?php echo $cod; ?>" method="post">
<h1> Desea eliminar el campo seleccionado</h1>
<br>
<br>
<br>
<br>
<p>
<label for="Si">SI</label>
<input type="radio" name="opcion" value="SI">
<br>
<label for="No">NO</label>
<input type="radio" name="opcion" value="NO">
</p>
<br>
<br>
<input type="submit" value="CONFIRMAR">
</form>
</body>
</html>
usuarios.php
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$name=$alias=$passw=$rpassw=$email="";
if (isset($_POST)){
if (isset($_POST['name']))
$name=$_POST['name'];
if (isset($_POST['alias']))
$alias=$_POST['alias'];
if (isset($_POST['passw']))
$passw=$_POST['passw'];
if (isset($_POST['rpassw']))
$rpassw=$_POST['rpassw'];
if (isset($_POST['email']))
$email=$_POST['email'];
if ($name!="" && $alias!="" && $passw!="" && $rpassw!="" && $email!=""){
if(filter_var($email, FILTER_VALIDATE_EMAIL)){
if ($passw==$rpassw){
$sql="insert into usuario values('$name','$alias','$passw','$email',3,0)";
if (!mysql_query($sql,$conexion))
$error="ERROR DE REGISTRO DE USUARIO";
}else
$error="LAS CLAVES NO COINCIDEN";
}else{
$error="ERROR EN REGISTRO DE EMAIL";
}
}
}
}
?>
<!doctype html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<form method="POST" action="master.php?id=9">
<table width="300px" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="" colspan="2"><center><font color=""><h2>REGISTRO DE USUARIO</h2></center></font></td>
</tr>
<tr>
<td><b>NOMBRE</b></td>
<td><input type="text" onkeypress="return letras(event);" onkeyup="return enter(event,this);" id="name" name="name" style="width:120px;"/></td>
</tr>
<tr>
<td><b>ALIAS</b></td>
<td><input type="text" onkeypress="return letras(event);" id="alias" name="alias" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CLAVE</b></td>
<td><input type="password" id="passw" name="passw" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CONFIRMAR CLAVE</b></td>
<td><input type="password" id="rpassw" name="rpassw" style="width:120px;"/></td>
</tr>
<tr>
<td><b>EMAIL</b></td>
<td><input type="text" id="email" name="email" style="width:250px;"/></td>
</tr>
<tr>
<td colspan="2"><center><b><input onclick="
var n=document.getElementById('name').value;
var a=document.getElementById('alias').value;
var p=document.getElementById('passw').value;
var r=document.getElementById('rpassw').value;
var e=document.getElementById('email').value;
if (n=='' || a=='' || e=='')
alert('LLENE TODOS LOS REGISTROS PARA ALMACENAR LA INFORMACION DE USUARIO');"
type="submit" name="registro" value="REGISTRAR"/></b></center></td>
</tr>
<tr>
<td colspan="2"><center><b><font color="red"><?php if (isset($error)) echo $error;?></font></b></center></td>
</tr>
</table>
</form>
</body>
</html>
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$name=$alias=$passw=$rpassw=$email="";
if (isset($_POST)){
if (isset($_POST['name']))
$name=$_POST['name'];
if (isset($_POST['alias']))
$alias=$_POST['alias'];
if (isset($_POST['passw']))
$passw=$_POST['passw'];
if (isset($_POST['rpassw']))
$rpassw=$_POST['rpassw'];
if (isset($_POST['email']))
$email=$_POST['email'];
if ($name!="" && $alias!="" && $passw!="" && $rpassw!="" && $email!=""){
if(filter_var($email, FILTER_VALIDATE_EMAIL)){
if ($passw==$rpassw){
$sql="insert into usuario values('$name','$alias','$passw','$email',3,0)";
if (!mysql_query($sql,$conexion))
$error="ERROR DE REGISTRO DE USUARIO";
}else
$error="LAS CLAVES NO COINCIDEN";
}else{
$error="ERROR EN REGISTRO DE EMAIL";
}
}
}
}
?>
<!doctype html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<form method="POST" action="master.php?id=9">
<table width="300px" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="" colspan="2"><center><font color=""><h2>REGISTRO DE USUARIO</h2></center></font></td>
</tr>
<tr>
<td><b>NOMBRE</b></td>
<td><input type="text" onkeypress="return letras(event);" onkeyup="return enter(event,this);" id="name" name="name" style="width:120px;"/></td>
</tr>
<tr>
<td><b>ALIAS</b></td>
<td><input type="text" onkeypress="return letras(event);" id="alias" name="alias" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CLAVE</b></td>
<td><input type="password" id="passw" name="passw" style="width:120px;"/></td>
</tr>
<tr>
<td><b>CONFIRMAR CLAVE</b></td>
<td><input type="password" id="rpassw" name="rpassw" style="width:120px;"/></td>
</tr>
<tr>
<td><b>EMAIL</b></td>
<td><input type="text" id="email" name="email" style="width:250px;"/></td>
</tr>
<tr>
<td colspan="2"><center><b><input onclick="
var n=document.getElementById('name').value;
var a=document.getElementById('alias').value;
var p=document.getElementById('passw').value;
var r=document.getElementById('rpassw').value;
var e=document.getElementById('email').value;
if (n=='' || a=='' || e=='')
alert('LLENE TODOS LOS REGISTROS PARA ALMACENAR LA INFORMACION DE USUARIO');"
type="submit" name="registro" value="REGISTRAR"/></b></center></td>
</tr>
<tr>
<td colspan="2"><center><b><font color="red"><?php if (isset($error)) echo $error;?></font></b></center></td>
</tr>
</table>
</form>
</body>
</html>
user.php
<!doctype html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<table width="100%" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="heigth:20px" colspan="2">
HOLA:
<?php
if (isset($_SESSION['user']))
echo $_SESSION['user'];
else
echo "USUARIO SIN REGISTRAR";
?>
</td>
</tr>
<tr>
<td style="heigth:100%" colspan="2">
<table border="1px">
<tr>
<td>NOMBRE</td>
<td>ALIAS</td>
<td>CLAVE</td>
<td>EMAIL</td>
<td>NIVEL</td>
<td>ESTADO</td>
</tr>
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$sql=mysql_query("select * from usuario where niv_usu<>4");
while ($fila=mysql_fetch_array($sql)) {
$nom=$fila['nom_usu'];
echo "<tr><td>".$fila['nom_usu']."</td>";
echo "<td>".$fila['ali_usu']."</td>";
echo "<td>".$fila['cla_usu']."</td>";
echo "<td>".$fila['ema_usu']."</td>";
$nivel=$fila['niv_usu'];
echo "<td>$nivel</td>";
if ($fila['est_usu']==1)
echo "<td>Activado</td>";
else
echo "<td>Desactivado</td>";
}
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
admin.php
<!doctype html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<table width="100%" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="heigth:20px" colspan="2">
HOLA:
<?php
if (isset($_SESSION['user']))
echo $_SESSION['user'];
else
echo "USUARIO SIN REGISTRAR";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
if (isset($_GET['num'])){
$user=$_GET['num'];
$nivel=$_GET['v'];
$estado=$_GET['x'];
$sql="update usuario set niv_usu=$nivel, est_usu=$estado where nom_usu='$user'";
if (!mysql_query($sql,$conexion))
$error="ERROR DE ACTUALIZACIÓN DE USUARIO";
else
echo "<script languaje='javascript'>location.href='master.php?id=11'</script>";
}
}
?>
</td>
</tr>
<tr>
<td style="heigth:100%" colspan="2">
<table border="1px">
<tr>
<td>NOMBRE</td>
<td>ALIAS</td>
<td>CLAVE</td>
<td>EMAIL</td>
<td>NIVEL</td>
<td>ESTADO</td>
<td>GUARAR</td>
</tr>
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$sql=mysql_query("select * from usuario");
$i=0;
while ($fila=mysql_fetch_array($sql)) {
$nom=$fila['nom_usu'];
echo "<tr><td>".$fila['nom_usu']."</td>";
echo "<td>".$fila['ali_usu']."</td>";
echo "<td>".$fila['cla_usu']."</td>";
echo "<td>".$fila['ema_usu']."</td>";
$nivel=$fila['niv_usu'];
echo "<td><SELECT id='valor$i'>
<OPTION VALUE='1'>1</OPTION>
<OPTION VALUE='2'>2</OPTION>
<OPTION VALUE='3'>3</OPTION>
<OPTION VALUE='4'>4</OPTION>
</SELECT><script>document.getElementById('valor$i').value=$nivel</script></td>";
if ($fila['est_usu']==1)
echo "<td><input id='chk$i' type='checkbox' checked='true' /></td>";
else
echo "<td><input id='chk$i' type='checkbox'/></td>";
echo "<td><a href='#' onclick=\"
actualizar('$nom',document.getElementById('valor$i').value,document.getElementById('chk$i').checked);
\">GUARAR</a></td></tr>";
$i++;
}
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
<html lang="es" id="alex">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>REGISTRO</title>
</head>
<body>
<table width="100%" border="0px" cellpadding="3" cellspacing="3">
<tr>
<td style="heigth:20px" colspan="2">
HOLA:
<?php
if (isset($_SESSION['user']))
echo $_SESSION['user'];
else
echo "USUARIO SIN REGISTRAR";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
if (isset($_GET['num'])){
$user=$_GET['num'];
$nivel=$_GET['v'];
$estado=$_GET['x'];
$sql="update usuario set niv_usu=$nivel, est_usu=$estado where nom_usu='$user'";
if (!mysql_query($sql,$conexion))
$error="ERROR DE ACTUALIZACIÓN DE USUARIO";
else
echo "<script languaje='javascript'>location.href='master.php?id=11'</script>";
}
}
?>
</td>
</tr>
<tr>
<td style="heigth:100%" colspan="2">
<table border="1px">
<tr>
<td>NOMBRE</td>
<td>ALIAS</td>
<td>CLAVE</td>
<td>EMAIL</td>
<td>NIVEL</td>
<td>ESTADO</td>
<td>GUARAR</td>
</tr>
<?php
$error="";
$conexion=mysql_connect("localhost","root","");
if(!$conexion)
die('No se establecio la conexion'.mysql_error());
else
{
mysql_select_db("cuentas",$conexion);
$sql=mysql_query("select * from usuario");
$i=0;
while ($fila=mysql_fetch_array($sql)) {
$nom=$fila['nom_usu'];
echo "<tr><td>".$fila['nom_usu']."</td>";
echo "<td>".$fila['ali_usu']."</td>";
echo "<td>".$fila['cla_usu']."</td>";
echo "<td>".$fila['ema_usu']."</td>";
$nivel=$fila['niv_usu'];
echo "<td><SELECT id='valor$i'>
<OPTION VALUE='1'>1</OPTION>
<OPTION VALUE='2'>2</OPTION>
<OPTION VALUE='3'>3</OPTION>
<OPTION VALUE='4'>4</OPTION>
</SELECT><script>document.getElementById('valor$i').value=$nivel</script></td>";
if ($fila['est_usu']==1)
echo "<td><input id='chk$i' type='checkbox' checked='true' /></td>";
else
echo "<td><input id='chk$i' type='checkbox'/></td>";
echo "<td><a href='#' onclick=\"
actualizar('$nom',document.getElementById('valor$i').value,document.getElementById('chk$i').checked);
\">GUARAR</a></td></tr>";
$i++;
}
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
pi.php
<html>
<head>
<title> Pie </title>
</head>
<body bgcolor text="blue">
<hr>
<center><h1 style="text-align:right"> Alexandra Maguana </h1></center>
</body>
</html>
EJECUCION
Al ejecutar con el servidor localhost lo que nos muestra es la siguiente ventana si ingresamos
como un usuario invitado solo puede ver los informe y no modificar.
En cambio como administrador realiza todas las acciones que sean necesarioas.