
31/12/2012, 09:59
|
| | Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 13 años, 7 meses Puntos: 1 | |
Respuesta: problema de variable este es todo el codigo la variable seria categorias
Código:
<?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;
}
}
$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));
}
$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_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);
mysql_select_db($database_libre, $libre);
$query_categorias = "SELECT * FROM categorias";
$categorias = mysql_query($query_categorias, $libre) or die(mysql_error());
$row_categorias = mysql_fetch_assoc($categorias);
$totalRows_categorias = mysql_num_rows($categorias);
?>
<!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"><!-- InstanceBegin template="/Templates/base.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>acceso</title>
<!-- InstanceEndEditable -->
<link href="tables.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
.centro1 {text-align: center;
}
.centro {
text-align: center;
}
.centro {
text-align: center;
}
.letra {
font-size: 14px;
}
.centro3 { text-align: center;
}
.centro3 { text-align: center;
}
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
body {
background-image: url();
background-color: #D3E4E5;
}
</style>
</head>
<body>
<table width="54%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td align="center" valign="middle"><img src="imagen/logo_final_.jpg" width="877" height="195" align="middle" /></td>
</tr>
<tr>
<td><!-- InstanceBeginEditable name="panel de control" -->
<table width="99%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="50%"><span class="letra">Categorias</span>
<strong>
<?php if($_SESSION['MM_UserGroup']=="admin"){
?>
<a href="insectar categoria.php?nombre_user=<?php echo $row_usuarios['nombre_user']; ?>">Insectar_categoria
<?php } ?>
</a></strong></td>
<td width="26%" align="center"><span class="centro3">Publicaciones totales</span></td>
<td width="24%" align="center"><span class="centro3">Ultimo Post</span></td>
</tr>
<?php do { ?>
<?php
mysql_select_db($database_libre, $libre);
$publicacion_sql = "SELECT mensaje FROM mensajes WHERE categoria = " .
$row_temas['id_categoria'];
$ultimo_sql = "SELECT autor,fecha FROM mensajes WHERE tema = " .
$row_temas['id_tema'] . " ORDER BY fecha DESC LIMIT 1";
$uPost = mysql_query($ultimo_sql) or die(mysql_error ());
$pTotales = mysql_query($publicacion_sql) or die(mysql_error());
?>
<tr>
<td><a href="categorias.php?id_categorias=<?php echo $row_categorias['id_categoria']; ?>&nombre_user=<?php echo $row_usuarios['nombre_user']; ?>"><strong><?php echo $row_categorias['nombre']; ?></strong></a><strong><a href="insectar categoria.php?nombre_user=<?php echo $row_usuarios['nombre_user']; ?>">
<?php if($_SESSION['MM_UserGroup']=="admin"){
?>
</a><a href="borrar_confirma.php?nombre_user=<?php echo $row_usuarios['nombre_user']; ?>">Eliminar </a><a href="insectar categoria.php?nombre_user=<?php echo $row_usuarios['nombre_user']; ?>">
<?php } ?>
|