Home › Forum › Plugin e temi di WP › Log Visite!
-
AutorePost
-
-
8 Dicembre 2006 alle 11:18 #2705kEiTiSBaCkPartecipante
Salve ragazzi, ho aggiunto due righe di codice all’index.php di wordpress.. per farmi salvare in un file txt tutte le visite. Il problema è che.. in locale funge tranquillamente,(usando solo l’index e commentando gli include.. )mentre se lo uppo sul mio spazio non và , non scrive niente nel log.txt, ma non da neanche errori.
Ecco il codice
Code:<?php
/* Index.php */
define(‘WP_USE_THEMES’, true); /* QUeste righe le commentavo in locale, perchè avevo solo l’index.
require(‘./wp-blog-header.php’); /*anche questa*/
/* Stringa da Scrivere su file */
$stringa=”Data: $data Ora: $ora Ip: $ip Browser: $brw Os: $os”;
$data =date(“d/m/y”);
$ora = date(“H:i:s:”);
$os =
getos($HTTP_SERVER_VARS[‘HTTP_USER_AGENT’]);
$ip = $_SERVER[‘REMOTE_ADDR’];
/* Scrittura del file */
$scrivi_file=fopen(“log.txt”,”w”);
fwrite($scrivi_file,$stringa);
fclose($scrivi_file);
/* Funzione sistema operativo */function getbrowser($usr_ag) //Funzione Per Sgamare Il Browser Utilizzato
{
if (stristr($usr_ag,”IE”))
$brw = “Internet Explorer”;
else if (stristr($usr_ag,”Firefox”))
$brw = “Firefox”;
else if (stristr($usr_ag,”Opera”))
$brw = “Opera”;
else
$brw = “ND”;
return $brw;
}function getos($usr_ag)//Funzione Per Sgamare Il Sistema Operativo :::.
{
if (stristr($usr_ag,”Windows”))
$os = “Windows”;
else if (stristr($usr_ag,”Linux”))
$os = “Linux”;
else if (stristr($usr_ag,”MAC”))
$os = “MAC”;
else
$os = “ND”;
return $os;
}?>
-
8 Dicembre 2006 alle 15:59 #42100andreaPartecipante
Prova ad inserire il tuo codice prima del richiamo di wp-blog-header.php, e non dopo. Molto probabilmente wp-blog-header.php termina internamente e non restituisce il controllo a index.php.
-
8 Dicembre 2006 alle 19:00 #42103kEiTiSBaCkPartecipante
bravo hai ragione,, provo subito
-
8 Dicembre 2006 alle 19:09 #42104kEiTiSBaCkPartecipante
funzia chiudete pure
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.