miércoles, 11 de diciembre de 2013


contenido.php

<?php

echo "<html>

<head><title>Suma</title>

<style type='text/css'>

               [required]{

                              border-color:blue;

                              box-shadow:0px 0px 5px green;

}

</style>

</head>

<body bgcolor='black' text='green'>

<center>

<h1> Escoja la opcion que desee </h1>

<h1> 1.Iniciar </h1>

<h1> 2.Registrar </h1>

<h1> 3.Cerrar </h1>

<form action='operaciones.php' method='POST'>

<table border=2>

<tr><td> Ingrese la opcion que desee :  </td>

    <td> <input name='opcion' required> </td>

</tr>

<tr><td>Ingrese el correo : </td>

               <td><input name='cor' required></td>

</tr>

<tr><td>Ingrese el nombre : </td>

               <td><input name='nom' required></td>

</tr>

<tr><td>Ingrese la clave : </td>

               <td><input type='password' name='cla' required></td>

</tr>

<tr>

<tr><td><input type='submit' value='Procesar' requiered></td>

</tr>

</table>

</form>

</center>

</body>

</html>

";

?>

 

operaciones.php

 

<?php

session_start();

$_SESSION['nombre']=$_REQUEST['nom'];

$_SESSION['clave']=$_REQUEST['cla'];

$_SESSION['correo']=$_REQUEST['cor'];

if ($_SESSION['nombre']=="admin" && $_SESSION['correo']=="admin@admin.com" && $_SESSION['clave']=="admin")

{

$op = $_POST['opcion'];

echo "<head><body bgcolor='black' text='green'><center><h1>Prueba</h1>";

class Operacion {

var $Nombre;

var $Clave;

var $Correo;

function iniciar($nombre,$clave,$correo){

echo "<br> Inicializar <br>";

$this->Nombre=$nombre;

$this->Clave=$clave;

$this->Correo=$correo;

echo "<br> a inicializado : ".$this->Nombre." con la clave ".$this->Clave." y el correo ".$this->Correo;

}

function registrar($nombre,$clave,$correo){

echo "<br> Registrar <br>";

$this->Nombre=$nombre;

$this->Clave=$clave;

$this->Correo=$correo;

echo "<br> a registrado : ".$this->Nombre." con la clave ".$this->Clave." y el correo ".$this->Correo;

}

function cerrar($nombre,$clave,$correo){

echo "<br> Cerrar <br>";

$this->Nombre=$nombre;

$this->Clave=$clave;

$this->Correo=$correo;

echo "<br> a cerreado : ".$this->Nombre." con la clave ".$this->Clave." y el correo ".$this->Correo;

}

//function Operacion($opc){

//$this->Opcion=$opc;

//echo "La opcion es : ".$this->Opcion;

//}

}

$operacion= new Operacion(" Opciones de Session <br>");

switch($op)

{

case 1:

$op1=$operacion->Iniciar($_SESSION['nombre'],$_SESSION['clave'],$_SESSION['correo']);

break;

case 2:

$op2=$operacion->registrar($_SESSION['nombre'],$_SESSION['clave'],$_SESSION['correo']);

break;

case 3:

$op3=$operacion->Cerrar($_SESSION['nombre'],$_SESSION['clave'],$_SESSION['correo']);

break;

}

echo "<br> <br> <a href='opcion.php'>Ir al principio</a>";

}

else

{

echo "<br> <br> <a href='siguiente.php'>Ir al siguiete</a>";

}

?>

 

siguiente.php

 

<?php

session_start();

?>

<?php 

if (isset($_SESSION["contar"]))

{

   $_SESSION["contar"]++;

}

else

{

   $_SESSION["contar"]=1;

}

$contar=$_SESSION["contar"];

?>

<?php

class Operacion {

var $Fecha;

var $Numero;

function iniciar($fecha,$numero){

echo "<br> Registrar <br>";

$this->Fecha=$fecha;

$this->Numero=$numero;

echo "<br> la fecha es : ".$this->Fecha."<br>"." el numero de veces es ".$this->Numero."<br>";

}

}

$operacion= new Operacion(" Registrar <br>");

$op1=$operacion->iniciar(date('l')." , ".date('j')." de ".date('F')." del ".date('Y'),$contar);

?>

<html>

<head>

<title>Variables de sesion</title>

<meta http-equiv="Content-Type" Content="text/html; charset=UTF-8">

</head>

<body>

<?php

echo "Nombre de usuario :".$_SESSION['nombre'];

echo "<br><br>";

echo "La fecha es ".date('l')." , ".date('j')." de ".date('F')." del ".date('Y')."<br>";

echo "Numero de intento :".$contar;

echo "<br>

<br>

<a href='opcion.php'>Ir al principio</a>";

?>

</body>

</html>

No hay comentarios:

Publicar un comentario