Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/03/2010, 21:34
moz90
 
Fecha de Ingreso: mayo-2009
Mensajes: 94
Antigüedad: 15 años
Puntos: 0
Login Simple con PHP ayuda plis ¡¡

hola amigos foreros....No sabia donde poner este tema pq este login esta hecho mayormente por php pero usa algunas partes de ajax y jquery....espero me puedan ayudar pq el problema es que no aparece los cuadros de texto para ingresar usuario y password, sin embargo yo lo habia hecho y adaptado localmente con wampserver en mi pc y si esta normal aparecen todo ok,y otra cosa es que no me muestrar error alguno error no puedo ver los errores, este el login lo tengo alojado en un hosting gratutio webcindario es aqui:
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
            
)    
        );
    }
?>
Archivo login.lang.php
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&oacute;n esta ya activa, click <a href="'.SUCCESS_URL.'">aqu&iacute;</a> para continuar.',
        
'LOGIN_SUCCESS'        =>    'Te has logeado exitosamente, click <a href="'.SUCCESS_URL.'">aqu&iacute;</a> para continuar.',
        
'LOGIN_FAILED'        =>    'Logeo Fallado: error, mala combinaci&oacute;n '.((LOGIN_METHOD=='user'||LOGIN_METHOD=='both')?'Username':''). 
                            ((
LOGIN_METHOD=='both')?'/':'').
                                ((
LOGIN_METHOD=='email'||LOGIN_METHOD=='both')?'email':'').
                                
' y password.',
    );
?>
Archivo login.post.php
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);
?>
Archivo login.post.php
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);
?>
Archivo login.html
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> 
Archivo index.php
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>

Última edición por moz90; 21/03/2010 a las 22:37 Razón: mal escrito