Yo creo que es por que mi pagina guarda las sessiones en la BD y no tengo configurado el php ini por que no macuerdo de los cambios que le hize...
aqui dejo el codigo ayudadme por favor...
GRACIAS
index.php
Código PHP:
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='es' lang='es'>
<head>
<title>Administrador De Disco Duro</title>
<META HTTP-EQUIV='PRAGMA' CONTENT='NO-CACHE'>
<link rel='stylesheet' href='css/login.css?nc' type='text/css'>
<script language='javascript' type='text/javascript' src='js/png.js'></script>
";
?>
<script>
function otwin(){
document.getElementById("bstopie").style.display='none'
document.getElementById("stopie").style.display='none'
}
function stopmsie(){
document.getElementById("bstopie").style.display = 'block';
document.getElementById("stopie").style.display = 'block';
}
</script>
</head>
<body onLoad="stopmsie()">
<form name="login" method="POST" action="login.php">
<input type="hidden" name="is_submit" value="ok" />
<center> <br><br> <br>
<center>
<br clear="all">
<br>
<table align=center border=0 cellpadding=0 cellspacing=0 width="407">
<tr>
<td background="img_desing/uplog.png" height="20" >
</td>
</tr>
<tr>
<td height="300">
<table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
<tr>
<td background="img_desing/middlelog.png" align="center" width="407" >
<table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
<tr>
<td align="center">
<a target="_blank">
<img src="img_desing/headerlog.png" width="346" height="174" style="border: 0px none" scale="noborder"></a>
</td>
</tr>
<tr>
<td align="center" height="40">
<font face=Tahoma style="font-size:10pt;"><b>[Administracion
Web]</b> | [Login]</font>
</td>
</tr>
</table>
</td>
<!-- <td width="5" background="img/login_righttop.gif">
<img src="img/transparent.gif" alt="" border="0" style="border: 0px none" width="1" height="1" />
</td>-->
</tr>
</table>
</td>
</tr>
<tr>
<td style="height: 1px" background="img_desing/login_topseperator.png" height="1">
</td>
</tr>
<tr>
<td height="130">
<table align=center border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
<tr>
<td background="img_desing/login_downmain.png" align="center">
<table width="255">
<tr>
<td align="center" colspan="2"> <br> </td>
</tr>
<tr>
<td align="right"><label for="usr">Usuario:</label> </td>
<td><input name="usuario" type="text" value="" size="25" class="inputtext">
</td>
</tr>
<tr>
<td align="right"><label for="pwd">Contraseña:</label> </td>
<td><input type="password" name="pass" value="" size="25" class="inputtext"></td>
</tr>
<tr>
<font face=Tahoma style="font-size:10pt;">
<td align="center" style="font-family: Verdana, Arial; font-size: 8pt" width="77"> </td>
<td style="font-family: Verdana, Arial; font-size: 8pt" width="160" align="center">
<font face=Tahoma style="font-size:10pt;">
<!-- <input type="submit" name="submit" value="Iniciar Sesión" size="120" style="font-family: Verdana, Arial; font-size: 8pt" tabindex="1">
<a href="#" onclick="javascript:document.login.submit()"><img src="img_desing/login.jpg" border="0"></a>
<input type="image" name="submit" src="img_desing/login.jpg" value="Iniciar Sesión" size="120" style="font-family: Verdana, Arial; font-size: 8pt" tabindex="1" onmouseover="submit.src='img_desing/login2.jpg'">-->
<input name="submit" type="image" onMouseOver="this.src='./img_desing/botonlogeoon.png'" onMouseDown="this.src='./img_desing/botonlogeodown.png'" onMouseOut="this.src='./img_desing/botonlogeo.png'" src="img_desing/botonlogeo.png" value="Iniciar Sesión" class="boton">
</font></td>
<td align="center" style="font-family: Verdana, Arial; font-size: 8pt" width="6" > </td>
</font>
</tr>
</table>
<p>
<font color="#19445d"> <?php echo "$logerr"; ?>
<br>
</font>
</p>
</td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="height: 12px" background="img_desing/downlog.png" height="20" >
</td>
</tr>
</table>
</center></center></form></body>
Código PHP:
//
//THIS FOLLOWING SCRIPT HAS BEEN CREATED BY JOE COOPER ([email protected]) ON 10/MARCH/06 FOR "PROJECT X"
//This is the user login script that allows the user to enter their username or password into the form to login
//The password uses MD5 encryption
//
include("codes/db.php");
include("codes/manejoSesiones.class.php");
ini_set('session.gc_maxlifetime', 350);
ini_set('session.cookie_lifetime', 350);
$sesionOA = new manejoSesiones();
session_set_save_handler(array(&$sesionOA,'abrirSesion'),array(&$sesionOA,'cerrarSesion'),array(&$sesionOA,'leerSesion'),array(&$sesionOA,'escribirSesion'),array(&$sesionOA,'borrarSesion'),array(&$sesionOA,'recolector'));
session_start(); //start the session
$username=$_POST['usuario']; //Get the username the user has entered
$password=$_POST['pass']; //Get the password the user has entered
$password=md5($password); //turn the password they entered into md5 to compare with the DB
$loginname=$_SESSION['username'];
//check to see if logged in allready
if (isset($_SESSION['loggedin'])){
die("You are logged in<br><a href='logout.php'>Click here to logout</a>");
//if not logged in, then run other script instead
}else{
//find if the page was enterd by the login button
if ( isset( $_POST['is_submit'] ) && ( $_POST['is_submit'] == 'ok' ) ) {
//if username was entered, continue
if($username && $password){
$result=mysql_query($sql);
//If the user gets to here, then they have typed both a username and password, so we may now go onto finding out if they excist in the DB
$sql="SELECT * FROM administradores WHERE (administrador='$username') AND password='$password'"; //get rows where the username feild matches the username or email feild in the database with same password
$result=mysql_query($sql);
//check to see if the account is activated
$moorow=mysql_fetch_array($result);
//if there was a row returned, then obiously there is an account with the correct username/password. They may login!
if (mysql_num_rows($result) > 0){
$_SESSION['loggedin']="TRUE"; //set the global session varible for loggedin to true
$row=mysql_fetch_array($result);
$_SESSION['username']=$username;
//setcookie("usuario", $username, time() + 31536000);
// setcookie("pass", $password, time() + 31536000);
$sql="SELECT sexo FROM administradores WHERE administrador='$username'";
$result=mysql_query($sql);
$sex=mysql_result($result,0,0);
$_SESSION['sexo']=$sex;
mysql_free_result($result);
header("Location: admin.php");
//die("Welcome $username You are now logged in");
}else{
header("Location: index.php?msg=err");
}
}else{
header("Location: index.php?msg=not");
}
}
}