Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/parla/public_html/libre/entrada.php:30) in /home/parla/public_html/libre/entrada.php on line 66
$MM_restrictGoTo = "error.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;
}
Código PHP:
<?php require_once('Connections/libre.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "entrada.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "admin,premium,user";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "error.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
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 (!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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE categorias SET nombre=%s, descripcion=%s WHERE id_categoria=%s",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['id_categoria'], "int"));
mysql_select_db($database_libre, $libre);
$Result1 = mysql_query($updateSQL, $libre) or die(mysql_error());
$updateGoTo = "acceso.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE categorias SET nombre=%s, descripcion=%s WHERE id_categoria=%s",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['id_categoria'], "int"));
mysql_select_db($database_libre, $libre);
$Result1 = mysql_query($updateSQL, $libre) or die(mysql_error());
$updateGoTo = "acceso.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO categorias (nombre, descripcion) VALUES (%s, %s)",
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['descripcion'], "text"));
mysql_select_db($database_libre, $libre);
$Result1 = mysql_query($insertSQL, $libre) or die(mysql_error());
$insertGoTo = "acceso.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_usuarios = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_usuarios = $_SESSION['MM_Username'];
}
mysql_select_db($database_libre, $libre);
$query_usuarios = sprintf("SELECT * FROM libre WHERE nombre_user = %s", GetSQLValueString($colname_usuarios, "text"));
$usuarios = mysql_query($query_usuarios, $libre) or die(mysql_error());
$row_usuarios = mysql_fetch_assoc($usuarios);
$totalRows_usuarios = mysql_num_rows($usuarios);
mysql_select_db($database_libre, $libre);
$query_carpetas = "SELECT * FROM folders";
$carpetas = mysql_query($query_carpetas, $libre) or die(mysql_error());
$row_carpetas = mysql_fetch_assoc($carpetas);
$totalRows_carpetas = mysql_num_rows($carpetas);
mysql_select_db($database_libre, $libre);
$query_mensajes = "SELECT * FROM mensajes";
$mensajes = mysql_query($query_mensajes, $libre) or die(mysql_error());
$row_mensajes = mysql_fetch_assoc($mensajes);
$totalRows_mensajes = mysql_num_rows($mensajes);
mysql_select_db($database_libre, $libre);
$query_categorias = "SELECT * FROM categorias ORDER BY id_categoria ASC";
$categorias = mysql_query($query_categorias, $libre) or die(mysql_error());
$row_categorias = mysql_fetch_assoc($categorias);
$totalRows_categorias = mysql_num_rows($categorias);
$colname_fichero = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_fichero = $_SESSION['MM_Username'];
}
mysql_select_db($database_libre, $libre);
$query_fichero = sprintf("SELECT * FROM asignar WHERE nombre_usuario = %s", GetSQLValueString($colname_fichero, "text"));
$fichero = mysql_query($query_fichero, $libre) or die(mysql_error());
$row_fichero = mysql_fetch_assoc($fichero);
$totalRows_fichero = mysql_num_rows($fichero);
mysql_select_db($database_libre, $libre);
$query_menssages = "SELECT * FROM messages";
$menssages = mysql_query($query_menssages, $libre) or die(mysql_error());
$row_menssages = mysql_fetch_assoc($menssages);
$totalRows_menssages = mysql_num_rows($menssages);
?>