Ver Mensaje Individual
  #6 (permalink)  
Antiguo 11/02/2014, 06:30
Yoshua9
 
Fecha de Ingreso: abril-2008
Mensajes: 33
Antigüedad: 16 años
Puntos: 0
Respuesta: Proyecto web de Trivial

options.php
require_once "config.php";

if (strlen(trim($strSessionPath)) > 0)
session_save_path($strSessionPath);

session_start();

$strName = "";
$strMessage = "";
$strAction = "";

if (empty($_SESSION))
{
$_SESSION['action'] = $strAction = "Crear nuevo Usuario";
}
else
{
if (strlen(trim($_SESSION['name'])) > 0)
{
$strName = $_SESSION['name'];
$_SESSION['action'] = $strAction = "Cambiar Contraseña";
}
else
{
$strName = "";
$_SESSION['action'] = $strAction = "Crear nuevo Usuario";
}

if (!empty($_SESSION['message']))
{
$strMessage = trim($_SESSION['message']);
}
}
?>

<html>
<head>
<title>Registro</title>
<meta charset="UTF-8">
</head>
<body>
<?php
if (strlen(trim($strMessage)) > 0)
{
echo $strMessage;
$_SESSION['message'] = "";
}
?>

<table width='800'>
<tr>
<td width='160'><table></table></td>
<td width='640' align='center' style="font-weight: bold; font-size:25px;">
<table><?php echo $strAction ?></table>
</td>
</tr>
</table>

<hr>
<form name='options' action='user.php' method='POST'>
<table width='800'>
<tr>
<td width='160' valign='center' align='center' STYLE='background-image:url(images/count.png); background-repeat: no-repeat; background-position:center center;''>
<table>
<tr>
<td STYLE='color: #000000; font-size: 20px;'>
<?php
if ($strAction == "Cambiar Contraseña")
{
echo "<a href='main.php' accesskey='b'>[<span STYLE='color: red'>B</span>ack]</a>";

}

if ($strAction == "Crear nuevo Usuario")
{
echo "<a href='logout.php' accesskey='l' >[<span STYLE='color: red'>L</span>oguearse]</a>";
}
?>
</td>
</tr>
</table>
</td>
<td width='640' align='center'>
<table>
<tr><td><u>U</u>suario:</td></tr>
<tr>
<td>
<?php
if ($strAction == "Cambiar Contraseña")
{
echo "<input type='text area' name='name' accesskey='u' size='10' readonly value='$strName'>";
}

if ($strAction == "Crear nuevo Usuario")
{
echo "<input type='text area' name='name' accesskey='u' size='10'>";
}
?>
</td>
</tr>
<tr><td>Nueva <u>C</u>ontraseña:</td></tr>
<tr><td><input type='password' name='password1' accesskey='p' size='10'></td></tr>
<tr><td><u>R</u>epetir:</td></tr>
<tr><td><input type='password' name='password2' accesskey='r' size='10'></td></tr>
<tr><td><input type='submit' name='submit' value='Guardar' class='button'></td></tr>
</table>
</td>
</tr>
</table>
</form>

<?php require_once "footer.php"; ?>
</body>
</html>

<script type="text/javascript">
<!--
if (document.options.name.value.length == 0 )
{
document.options.name.focus();
}
else
{
document.options.password1.focus();
}

document.onkeypress=keyevent;

function keyevent(e)
{
var c;

c=String.fromCharCode(window.event.keyCode).toUppe rCase();
target=window.event.srcElement;

if (target.nodeName.toUpperCase() == 'INPUT')
{
if (target.type.toUpperCase() == 'SUBMIT')
{
if (document.options.name.value.length == 0 )
{
if (c == 'L') { window.location='logout.php';; return false; }
}
else
{
if (c == 'B') { window.location='main.php';; return false; }
}
}
}
else
{
if (document.options.name.value.length == 0 )
{
if (c == 'L') { window.location='logout.php';; return false; }
}
else
{
if (c == 'B') { window.location='main.php';; return false; }
}
}
}
//-->
</script>