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

este es el php de la pagina de detalles.php

Código PHP:
<?php require('/Connections/hoysale.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;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO comentarios_clasificados (id_noticia, detalle, id_user) VALUES (%s, %s, %s)",
                       
GetSQLValueString($_POST['id_noticia'], "int"),
                       
GetSQLValueString($_POST['detalle'], "text"),
                       
GetSQLValueString($_POST['id_user'], "int"));

  
mysql_select_db($database_hoysale$hoysale);
  
$Result1 mysql_query($insertSQL$hoysale) or die(mysql_error());

  
$insertGoTo "/mensaje-creado.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

$colname_detallesdeclasificados "-1";
if (isset(
$_GET['ver'])) {
  
$colname_detallesdeclasificados $_GET['ver'];
}
mysql_select_db($database_hoysale$hoysale);
$query_detallesdeclasificados sprintf("SELECT * FROM formulario_clasificados WHERE id_rubro = %s"GetSQLValueString($colname_detallesdeclasificados"int"));
$detallesdeclasificados mysql_query($query_detallesdeclasificados$hoysale) or die(mysql_error());
$row_detallesdeclasificados mysql_fetch_assoc($detallesdeclasificados);
$totalRows_detallesdeclasificados mysql_num_rows($detallesdeclasificados);

$maxRows_arelacionados 10;
$pageNum_arelacionados 0;
if (isset(
$_GET['pageNum_arelacionados'])) {
  
$pageNum_arelacionados $_GET['pageNum_arelacionados'];
}
$startRow_arelacionados $pageNum_arelacionados $maxRows_arelacionados;

mysql_select_db($database_hoysale$hoysale);
$query_arelacionados "SELECT * FROM formulario_clasificados";
$query_limit_arelacionados sprintf("%s LIMIT %d, %d"$query_arelacionados$startRow_arelacionados$maxRows_arelacionados);
$arelacionados mysql_query($query_limit_arelacionados$hoysale) or die(mysql_error());
$row_arelacionados mysql_fetch_assoc($arelacionados);

if (isset(
$_GET['totalRows_arelacionados'])) {
  
$totalRows_arelacionados $_GET['totalRows_arelacionados'];
} else {
  
$all_arelacionados mysql_query($query_arelacionados);
  
$totalRows_arelacionados mysql_num_rows($all_arelacionados);
}
$totalPages_arelacionados ceil($totalRows_arelacionados/$maxRows_arelacionados)-1;

$colname_comentaranuncio "-1";
if (isset(
$_SESSION['MM_id_user'])) {
  
$colname_comentaranuncio $_SESSION['MM_id_user'];
}
mysql_select_db($database_hoysale$hoysale);
$query_comentaranuncio sprintf("SELECT * FROM comentarios_clasificados WHERE id_user = %s"GetSQLValueString($colname_comentaranuncio"int"));
$comentaranuncio mysql_query($query_comentaranuncio$hoysale) or die(mysql_error());
$row_comentaranuncio mysql_fetch_assoc($comentaranuncio);
$totalRows_comentaranuncio mysql_num_rows($comentaranuncio);

mysql_select_db($database_hoysale$hoysale);
$query_comentariosdelsitio "SELECT * FROM comentarios_para_cuidadodelsitio";
$comentariosdelsitio mysql_query($query_comentariosdelsitio$hoysale) or die(mysql_error());
$row_comentariosdelsitio mysql_fetch_assoc($comentariosdelsitio);
$totalRows_comentariosdelsitio mysql_num_rows($comentariosdelsitio);

$colname_moneda "-1";
if (isset(
$_GET['ver'])) {
  
$colname_moneda $_GET['ver'];
}
mysql_select_db($database_hoysale$hoysale);
$query_moneda sprintf("SELECT * FROM monedas WHERE id = %s"GetSQLValueString($colname_moneda"int"));
$moneda mysql_query($query_moneda$hoysale) or die(mysql_error());
$row_moneda mysql_fetch_assoc($moneda);
$totalRows_moneda mysql_num_rows($moneda);
?>