trawets
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to use Wp-Infos pluginHi
I would like to say thanks to Meekgood man
trawetsForum: Fixing WordPress
In reply to: How to use Wp-Infos pluginHello
Where’s everybody gone? am I alone in here?Can someone help please
regards
StewartForum: Fixing WordPress
In reply to: How to use Wp-Infos plugin<?php wp_infos(); ?>
is what i tried to add
got a parse error
this required renaming the file from wp-infos-03.php, which it didnt like eitherForum: Fixing WordPress
In reply to: How to use Wp-Infos pluginPlugin Name: wp-infos
Version: 0.3
Plugin URI: https://sebacatalano.altervista.org
Description: Show the total visits, the current ip and browser of the user.
Author: Seba Catalano
Author URI: https://sebacatalano.altervista.orgNot too many ways on his site to contact him
plug in file
<?php
/*
Plugin Name: wp-infos
Version: 0.3
Plugin URI: https://sebacatalano.altervista.org
Description: Show the total visits, the current ip and browser of the user.
Author: Seba Catalano
Author URI: https://sebacatalano.altervista.org
*/function wp_infos() {
$timeout = "5"; // Timeout, in minutes, to consider a visitor online.
$ip = $_SERVER['REMOTE_ADDR']; // Ip of the visitor
$browser = $_SERVER['HTTP_USER_AGENT']; // Browser of the visitor
$host = $_SERVER['SERVER_NAME']; // Local host name.
$referer = $_SERVER['HTTP_REFERER']; // Ref url// Database extraction
$query = mysql_query("SELECT * FROM wp_infos WHERE visits != '0'")
or die("Error in query: ". mysql_error());$dbarray = mysql_fetch_array($query);
$id = $dbarray['id'];
$totalcount = $dbarray['visits'];
$partialcount = $dbarray['daycount'];
$date = $dbarray['daydate'];$online = usr_online($timeout, $ip);
counter($id, $totalcount, $partialcount, $host, $date, $referer);// Visualitazion table
echo "Total visits: $totalcount<br>
Today visits: $partialcount<br>
Users online: $online<br>
Your ip: $ip<br>
Your browser: $browser<br>";
}function usr_online ($timeout, $ip) {
$time = time();
$less = $time - ($timeout*60);mysql_query("INSERT INTO wp_infos (ip, time) VALUES ('$ip', '$time')") or die("Error in query: ". mysql_error());
mysql_query("DELETE FROM wp_infos WHERE time<'$less' AND visits=0") or die("Error in query: ". mysql_error());$query = mysql_query("SELECT COUNT(DISTINCT ip) FROM wp_infos") or die("Error in query: ". mysql_error());
$iplist = mysql_fetch_array($query, MYSQL_NUM);return $iplist[0]-1;
}function counter ($id, $totalcount, $partialcount, $host, $date, $referer) {
// Date
$time = getdate();// Vars initialization
if (empty($id)) {$id = 0;}
if (empty($totalcount)) {$totalcount = 0;}
if (empty($partialcount)) {$partialcount = 0;}
if (empty($date)) {$date = $time[mday].$time[month];}if (!eregi($host, $referer)) {
$totalcount++;if (!strcmp($date, $time[mday].$time[month])) {
$partialcount++;
}
else {
$partialcount = 0;
$date = $time[mday].$time[month];
}// Database entry
mysql_query("DELETE FROM wp_infos WHERE visits!=0")
or die("Error in query: ". mysql_error());mysql_query("INSERT INTO wp_infos (visits, daycount, daydate) VALUES ($totalcount, $partialcount, '$date')")
or die("Error in query: ". mysql_error());
}
}
?>Any suggestions most welcome
Forum: Fixing WordPress
In reply to: How to use Wp-Infos pluginHi Guys
Im a newbie too, a complete not very bright one at that, so
I would like to echo my co-ignoramus and request details on how to use this plug in