04/10/2010, 15:22
|
| | Fecha de Ingreso: septiembre-2009
Mensajes: 135
Antigüedad: 15 años, 2 meses Puntos: 0 | |
Respuesta: problemas en archivos fuentes. aqui esta el codigo
<?php require_once('cnx.php'); ?>
<?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;
}
}
?>
<?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['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['clave'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "reportes.php";
$MM_redirectLoginFailed = "error.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_conn2, $conn2);
$LoginRS__query=sprintf("SELECT co_usua, cl_usua FROM tb_usuario WHERE co_usua=%s AND cl_usua=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $conn2) 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;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
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" />
<META http-equiv="CACHE-CONTROL" content="NO-CACHE">
<META NAME="AUTHOR" CONTENT="Juan Camilo Vélez">
<title>Reservaciones Olimpo</title>
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="initial-scale=1.0" />
<meta name="viewport" content="user-scalable=false" />
<link href="styles/styles_v1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<img src="images/header.jpg" width="460" height="90" alt="Reservaciones Olimpo" />
<div id="content">
<div id="block">
<h2>Ingreso al Sistema</h2>
</div >
<div id="labels_login">Usuario:</div >
<div id="controls_login"><input type="text" name="user" id="user" /></div>
<div id="labels_login">Clave:</div >
<div id="controls_login"><input name="clave" type="password" id="clave"/>
</div>
<div id="labels_login"></div >
<div id="controls_login"> <input type="submit" class="boton" value="Enviar"/></div>
</div>
</form>
</div>
</body>
</html> |