http://vision-web.webcindario.com/ad...rar/login.html
el original login lo pueden encontrar aquí:
http://www.chazzuka.com/blog/?cat=11&paged=2
el codigo es el siguiente, espero puedan ayudarme ..
Archivo login.config.php
Código PHP:
<?php
//@ validate inclusion
if(!defined('VALID_ACL_')) exit('direct access is not allowed.');
define('USEDB', true); //@ use database? true:false
define('LOGIN_METHOD', 'both'); //@ 'user':'email','both'
define('SUCCESS_URL', 'admin.php'); //@ redirection target on success
//@ you could delete one of block below according to the USEDB value
if(USEDB)
{
$db_config = array(
'server' => 'localhost', //@ server name or ip address along with suffix ':port' if needed (localhost:3306)
'user' => 'root', //@ mysql username
'pass' => '', //@ mysql password
'name' => 'bohemios', //@ database name
'tbl_user' => 'tbl_user' //@ user table name
);
}
else
{
$user_config = array(
array(
'username' => 'admin',
'useremail' => 'admin@localhost',
'userpassword' => 'e10adc3949ba59abbe56e057f20f883e', // md5:123456
),
array(
'username' => 'user',
'useremail' => 'user@localhost',
'userpassword' => 'e10adc3949ba59abbe56e057f20f883e', // md5:123456
)
);
}
?>
Código PHP:
<?php
//@ validate inclusion
if(!defined('VALID_ACL_')) exit('direct access is not allowed.');
$ACL_LANG = array (
'USERNAME' => 'Usuario',
'EMAIL' => 'E-mail',
'PASSWORD' => 'Password',
'LOGIN' => 'Login!',
'SESSION_ACTIVE' => 'Tu Sesión esta ya activa, click <a href="'.SUCCESS_URL.'">aquí</a> para continuar.',
'LOGIN_SUCCESS' => 'Te has logeado exitosamente, click <a href="'.SUCCESS_URL.'">aquí</a> para continuar.',
'LOGIN_FAILED' => 'Logeo Fallado: error, mala combinación '.((LOGIN_METHOD=='user'||LOGIN_METHOD=='both')?'Username':'').
((LOGIN_METHOD=='both')?'/':'').
((LOGIN_METHOD=='email'||LOGIN_METHOD=='both')?'email':'').
' y password.',
);
?>
Código PHP:
<?php
// @ error reporting setting ( modify as needed )
ini_set("display_errors", 1);
error_reporting(E_ALL);
//@ explicity start session just if not automatically started at php.ini
session_start();
//@ validate inclusion
define('VALID_ACL_', true);
//@ load dependency files
require('login.config.php');
require('login.lang.php');
require('login.class.php');
sleep(1); // do not use in production
//@ new acl instance
$acl = new Authorization;
//@check session status
$status = $acl->check_status();
if($status)
{
// @ session already active
echo "{'status':true,'message':'".$ACL_LANG['SESSION_ACTIVE']."','url':'".SUCCESS_URL."'}";
}
else
{
//@ session not active
if($_SERVER['REQUEST_METHOD']=='GET')
{
//@ first load
echo "{'status':false,'message':'".$acl->form()."'}";
}
else
{
//@ form submission
$u = (!empty($_POST['u']))?trim($_POST['u']):false; // retrive user var
$p = (!empty($_POST['p']))?trim($_POST['p']):false; // retrive password var
// @ try to signin
$is_auth = $acl->signin($u,$p);
if($is_auth)
{
//@ success
echo "{'status': true,'message':'".$ACL_LANG['LOGIN_SUCCESS']."','url':'".SUCCESS_URL."'}";
}
else
{
//@ failed
echo "{'status': false,'message':'".$ACL_LANG['LOGIN_FAILED']."'}";
}
}
}
//@ destroy instance
unset($acl);
?>
Código PHP:
<?php
// @ error reporting setting ( modify as needed )
ini_set("display_errors", 1);
error_reporting(E_ALL);
//@ explicity start session just if not automatically started at php.ini
session_start();
//@ validate inclusion
define('VALID_ACL_', true);
//@ load dependency files
require('login.config.php');
require('login.lang.php');
require('login.class.php');
sleep(1); // do not use in production
//@ new acl instance
$acl = new Authorization;
//@check session status
$status = $acl->check_status();
if($status)
{
// @ session already active
echo "{'status':true,'message':'".$ACL_LANG['SESSION_ACTIVE']."','url':'".SUCCESS_URL."'}";
}
else
{
//@ session not active
if($_SERVER['REQUEST_METHOD']=='GET')
{
//@ first load
echo "{'status':false,'message':'".$acl->form()."'}";
}
else
{
//@ form submission
$u = (!empty($_POST['u']))?trim($_POST['u']):false; // retrive user var
$p = (!empty($_POST['p']))?trim($_POST['p']):false; // retrive password var
// @ try to signin
$is_auth = $acl->signin($u,$p);
if($is_auth)
{
//@ success
echo "{'status': true,'message':'".$ACL_LANG['LOGIN_SUCCESS']."','url':'".SUCCESS_URL."'}";
}
else
{
//@ failed
echo "{'status': false,'message':'".$ACL_LANG['LOGIN_FAILED']."'}";
}
}
}
//@ destroy instance
unset($acl);
?>
Código HTML:
<!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>SISTEMA DE AMINISTRACION VISION-WEB | PHP ajax</title> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="login.js"></script> <link href="login.css" rel="stylesheet" media="all" /> </head> <body> <div id="wait"></div> <div id="header"> <h2>SISTEMA DE ADMINISTRACIÓN VISION-WEB</h2> </div> <div id="wrapper"></div> <div id="footer"> <a href="#">PHP ajax Login</a> by Vision-Web </div> </body> </html>
Código PHP:
<?php
// @ error reporting setting ( modify as needed )
ini_set("display_errors", 1);
error_reporting(E_ALL);
//@ explicity start session ( remove if needless )
session_start();
//@ if logoff
if(!empty($_GET['logoff'])) { $_SESSION = array(); }
//@ is authorized?
if(empty($_SESSION['exp_user']) || @$_SESSION['exp_user']['expires'] < time()) {
header("location:login.html"); //@ redirect
} else {
$_SESSION['exp_user']['expires'] = time()+(45*60); //@ renew 45 minutes
}
?>
<!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>SISTEMA DE AMINISTRACION VISION-WEB | PHP ajax </title>
<style type="text/css">
body { background:#ccc; text-align: center; font:normal 11px/normal arial; color:#333; padding:50px; }
#wrapper { width:400px; background:#666; border:solid 1px #fff; margin:0px auto; padding:15px;}
a{ color:#333; text-decoration:none; border-bottom:dotted 1px #666; }
a:hover { color:#000; }
</style>
</head>
<body>
<div id="wrapper">
<h1>Administracion Vision-Web</h1>
<p>Tu estas logeado, Gracias por Visitarnos, sera redireccionado en unos segundos a la pagina principal.</p>
<p>
<a href="index.php?logoff=1">Logout</a> |
<a href="http://www.chazzuka.com/blog/?p=212">Back to the article</a> |
<a href="http://www.chazzuka.com">Bali Web Design Services</a>
</p>
</div>
</body>
</html>