File: /home/ednermusika/ednergranados.com/admin/index.php
<?php require_once('../Connections/con_edner.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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['usu_correo'])) {
$loginUsername=$_POST['usu_correo'];
$password=$_POST['usu_contrasena'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "admin.php";
$MM_redirectLoginFailed = "usuario_novalido.html";
$MM_redirecttoReferrer = false;
mysql_select_db($database_con_edner, $con_edner);
$LoginRS__query=sprintf("SELECT usu_correo, usu_contrasena FROM usuario WHERE usu_correo=%s AND usu_contrasena=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $con_edner) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//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=iso-8859-1" />
<title>Edner Granados Impact Speaker</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="contenedor_login">
<form id="usuario" name="usuario" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="400" height="330" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="167" colspan="4" align="center"><h3><img src="img/logo-edner.png" width="445" height="93" /></h3>
<h3> </h3>
<h3><br />
Panel de Administración</h3></td>
</tr>
<tr>
<td> </td>
<td height="26"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="26"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="36"> </td>
<td width="121" height="26"><h2>Usuario</h2></td>
<td width="16"> </td>
<td width="227"><input name="usu_correo" type="text" id="usu_correo" size="30" maxlength="100" /></td>
</tr>
<tr>
<td> </td>
<td height="28"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="30"><h2>Contraseña</h2></td>
<td> </td>
<td><input name="usu_contrasena" type="password" id="usu_contrasena" size="30" maxlength="20" /></td>
</tr>
<tr>
<td colspan="4" align="center"> </td>
</tr>
<tr>
<td colspan="4" align="center"><input name="enviar" type="button" onclick="f_enviar();" class="texto_14_verdana" id="enviar" value="Enviar" /></td>
</tr>
</table>
</form>
</div>
<h5>Edner Granados Impact Speaker Todos los Derechos Reservados ® 2013. </h5>
<h5>Diseño y Desarrollo por Rosvel</h5>
</body>
</html>
<script type="text/javascript">
function f_validar ( )
{
var retorno = true;
with ( document.usuario )
{
if ( usu_correo.value == '' )
{
alert ( 'Por favor proporcione el usuario' );
usu_correo.focus ( );
retorno = false;
}
else if ( usu_contrasena.value == '' )
{
alert ( 'Por favor proporcione la contrase�a' );
usu_contrasena.focus ( );
retorno = false;
}
return retorno
}
}
function f_enviar()
{
with (document.usuario)
{
if ( f_validar ( ) )
{
submit ( );
}
}
}
</script>