Hola de nuevo:
que pena ya estoy solucionando mi problema, he hecho ciertos cambios en el codigo que dreamwevaer cs4 me genera aca les dejo el codigo con mis arreglos:
Código :
<?php require_once('Connections/iesd.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['jardin08001223'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "preescolar/jardin/ana alfonso/index-08001223.php";
$MM_redirectLoginFailed = "preescolar/cuenta-bloqueada.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_iesd, $iesd);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $iesd) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['username08001223'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['jardin08001223']) && false) {
$MM_redirectLoginSuccess = $_SESSION['jardin08001223'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
y ahora para comprobar en:(preescolar/jardin/ana alfonso/index-08001223.php) que el usuario esta logueado en preescolar/jardin/ana alfonso/index-08001223.php anexé este codigo:
Código :
<?php
include "seguridad.php";
?>
y ahora este es el codigo de de seguridad.php:
Código :
<?php
//inicio la sesion
session_start();
//compruebo que el usuario esta autenticado
if($SESSION[jardin08001223]){
}
else{
//si el usuario no esta autenticado redirigir a login.php
header("Location: login.php");
}
?>
y para salir añado un lik que dice SALIR que lleva a salir.php este es el codigo de salir.php:
Código :
<?php
session_start();
$_SESSION = array();
session_destroy();
?>
<html>
<head>
<title>titulo</title>
</head>
<body>
Ahora se ha cerrado la sesion.
<br>
<br>
<a href="login.php">Autenticar usuario</a>
</body>
he subido todo esto al servidor pero en:(preescolar/jardin/ana alfonso/index-08001223.php) me vota estos errores:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/iesdeduc/public_html/calificaciones/preescolar/jardin/ana alfonso/index-08001223.php:1) in /home/iesdeduc/public_html/calificaciones/preescolar/jardin/ana alfonso/seguridad.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/iesdeduc/public_html/calificaciones/preescolar/jardin/ana alfonso/index-08001223.php:1) in /home/iesdeduc/public_html/calificaciones/preescolar/jardin/ana alfonso/seguridad.php on line 10
Ademas el salir.php tampoco funciona pero ahy no bota ningun error...
Ayudenme por favor, me estoy muriendo del estres...
desde ya GRACIAS....