Ver Mensaje Individual
  #18 (permalink)  
Antiguo 30/09/2010, 14:18
Avatar de mexbale
mexbale
 
Fecha de Ingreso: septiembre-2010
Ubicación: Iztapalapa
Mensajes: 146
Antigüedad: 13 años, 7 meses
Puntos: 1
Respuesta: probrema con index

INDEX:
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}


?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}


?>

<?php require_once('localhost.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['Nombre'])) {
$loginUsername=$_POST['Nombre'];
$password=$_POST['Contrasena'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "tabular.php";
$MM_redirectLoginFailed = "index.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_localhost, $localhost);

// $LoginRS__query=sprintf("SELECT usr, passwd FROM usuarios_sha1 WHERE usr=%s AND passwd=%s",
$LoginRS__query=sprintf("SELECT nombre, contrasena, num_cap FROM usuarios WHERE nombre='$loginUsername' AND contrasena='$password'",

GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"), GetSQLValueString($loginId, "text"));

$LoginRS = mysql_query($LoginRS__query, $localhost) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['MM_num_cap'] = $loginId;
//$_SESSION['MM_Id'] = $loginRS[2];


if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}

echo "

<script language='Javascript'>


window.open(\"tabular.php\",\"tabular\",\"fullscre en,scrollbars\");


</script>";



//header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index</title>
</head>

<body bgcolor="#FF9400">
<form action="" method="POST">
<center>
<h1>Bienvenidos al proyecto de SEP Becas de Preparatoria</h1>
<table width="550" border="1" bordercolor="#BF8330">
<tr>
<td colspan="2" bgcolor="#A66000"><div align="center">
<h2>Por favor escribe tu nombre y tu contraseña</h2>
</div></td>
</tr>
<tr>
<td>Nombre Completo</td>
<td><label>
<input name="Nombre" type="text" id="Nombre" size="40" maxlength="30" onkeyup = "this.value=this.value.toUpperCase();" />
</label></td>
</tr>
<tr>
<td>Contraseña</td>
<td><label>
<input name="Contrasena" type="password" id="Contrasena" size="20" maxlength="20" onkeyup = "this.value=this.value.toUpperCase();" />
</label></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Entrar" id="Entrar" value="Entrar a Capturar" />
</div></td>
</tr>
</table>
</center>
</form>
</body>
</html>