Ver Mensaje Individual
  #10 (permalink)  
Antiguo 01/12/2012, 17:20
ofertasdiairias
 
Fecha de Ingreso: junio-2011
Mensajes: 39
Antigüedad: 13 años, 5 meses
Puntos: 2
Respuesta: Saber cantidad de visitas a anuncio

y este el php de la pagina mis_anuncios.php

Código PHP:
Ver original
  1. <?php require('/Connections/hoysale.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. }
  5. $MM_authorizedUsers = "";
  6. $MM_donotCheckaccess = "true";
  7.  
  8. // *** Restrict Access To Page: Grant or deny access to this page
  9. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  10.   // For security, start by assuming the visitor is NOT authorized.
  11.   $isValid = False;
  12.  
  13.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  14.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  15.   if (!empty($UserName)) {
  16.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  17.     // Parse the strings into arrays.
  18.     $arrUsers = Explode(",", $strUsers);
  19.     $arrGroups = Explode(",", $strGroups);
  20.     if (in_array($UserName, $arrUsers)) {
  21.       $isValid = true;
  22.     }
  23.     // Or, you may restrict access to only certain users based on their username.
  24.     if (in_array($UserGroup, $arrGroups)) {
  25.       $isValid = true;
  26.     }
  27.     if (($strUsers == "") && true) {
  28.       $isValid = true;
  29.     }
  30.   }
  31.   return $isValid;
  32. }
  33.  
  34. $MM_restrictGoTo = "/ingresar.php";
  35. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  36.   $MM_qsChar = "?";
  37.   $MM_referrer = $_SERVER['PHP_SELF'];
  38.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  39.   if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
  40.   $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  41.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  42.   header("Location: ". $MM_restrictGoTo);
  43.   exit;
  44. }
  45. ?>
  46. <?php
  47. if (!function_exists("GetSQLValueString")) {
  48. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  49. {
  50.   if (PHP_VERSION < 6) {
  51.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  52.   }
  53.  
  54.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  55.  
  56.   switch ($theType) {
  57.     case "text":
  58.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  59.       break;    
  60.     case "long":
  61.     case "int":
  62.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  63.       break;
  64.     case "double":
  65.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  66.       break;
  67.     case "date":
  68.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  69.       break;
  70.     case "defined":
  71.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  72.       break;
  73.   }
  74.   return $theValue;
  75. }
  76. }
  77.  
  78. $maxRows_misanuncios = 10;
  79. $pageNum_misanuncios = 0;
  80. if (isset($_GET['pageNum_misanuncios'])) {
  81.   $pageNum_misanuncios = $_GET['pageNum_misanuncios'];
  82. }
  83. $startRow_misanuncios = $pageNum_misanuncios * $maxRows_misanuncios;
  84.  
  85. $colname_misanuncios = "-1";
  86. if (isset($_SESSION['MM_id_user'])) {
  87.   $colname_misanuncios = $_SESSION['MM_id_user'];
  88. }
  89. mysql_select_db($database_hoysale, $hoysale);
  90. $query_misanuncios = sprintf("SELECT * FROM formulario_clasificados WHERE id_user = %s", GetSQLValueString($colname_misanuncios, "int"));
  91. $query_limit_misanuncios = sprintf("%s LIMIT %d, %d", $query_misanuncios, $startRow_misanuncios, $maxRows_misanuncios);
  92. $misanuncios = mysql_query($query_limit_misanuncios, $hoysale) or die(mysql_error());
  93. $row_misanuncios = mysql_fetch_assoc($misanuncios);
  94.  
  95. if (isset($_GET['totalRows_misanuncios'])) {
  96.   $totalRows_misanuncios = $_GET['totalRows_misanuncios'];
  97. } else {
  98.   $all_misanuncios = mysql_query($query_misanuncios);
  99.   $totalRows_misanuncios = mysql_num_rows($all_misanuncios);
  100. }
  101. $totalPages_misanuncios = ceil($totalRows_misanuncios/$maxRows_misanuncios)-1;
  102. ?>