El problema que tengo es que cuando la gente se loguea correctamente puede volver a accerder a la pagina de logeo, lo que nesesito y si ustedes tan amables me ayuden, es que la gente cuando se loguee en 'login.php' y ya tengan su sección abierta no puedan volver a accerder a la pagina y los rediriga a la principal, ayuda pór favor, nesesito que me pasen el codigo, aqui les dejo el mio 'login.php':
Código PHP:
<?php require_once('../db/config.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
$isValid = False;
if (!empty($UserName)) {
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php require_once('../db/config.php'); ?>
<?php require_once('../db/config.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;
}
}
mysql_select_db($database_config, $config);
$query_user_admin = "SELECT Id, micro_p_us, micro_p_co FROM micro_p_user_adm";
$user_admin = mysql_query($query_user_admin, $config) or die(mysql_error());
$row_user_admin = mysql_fetch_assoc($user_admin);
$totalRows_user_admin = mysql_num_rows($user_admin);
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;
}
}
if ((isset($_GET['Id'])) && ($_GET['Id'] != "")) {
$deleteSQL = sprintf("DELETE FROM micro_p_post WHERE Id=%s",
GetSQLValueString($_GET['Id'], "int"));
mysql_select_db($database_config, $config);
$Result1 = mysql_query($deleteSQL, $config) or die(mysql_error());
$deleteGoTo = "post.php";
if (isset($_SERVER['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}
$maxRows_mostrar_post = 10;
$pageNum_mostrar_post = 0;
if (isset($_GET['pageNum_mostrar_post'])) {
$pageNum_mostrar_post = $_GET['pageNum_mostrar_post'];
}
$startRow_mostrar_post = $pageNum_mostrar_post * $maxRows_mostrar_post;
mysql_select_db($database_config, $config);
$query_mostrar_post = "SELECT * FROM micro_p_post";
$query_limit_mostrar_post = sprintf("%s LIMIT %d, %d", $query_mostrar_post, $startRow_mostrar_post, $maxRows_mostrar_post);
$mostrar_post = mysql_query($query_limit_mostrar_post, $config) or die(mysql_error());
$row_mostrar_post = mysql_fetch_assoc($mostrar_post);
if (isset($_GET['totalRows_mostrar_post'])) {
$totalRows_mostrar_post = $_GET['totalRows_mostrar_post'];
} else {
$all_mostrar_post = mysql_query($query_mostrar_post);
$totalRows_mostrar_post = mysql_num_rows($all_mostrar_post);
}
$totalPages_mostrar_post = ceil($totalRows_mostrar_post/$maxRows_mostrar_post)-1;
?>