Dynadot โ€” .com Transfer

Need help with a code

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch
Impact
19
Were can i get or how do i get a stats code? Show unique hits, hits, views, and that stuff?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
•••
I want it were it can be in a lil box on tha index (homepage) page.
 
0
•••
Can anyone help out?
 
0
•••
Yeah, you can use Qurinus and it will give you instructions on how to do just that. Where you 'include' it on your page, you will also be given the variables to use. For example

$u = unique visitors
 
0
•••
you can download a simple script found on this website, the scrpt name is php hits, you can display the hit counter in a text mode or image mode, here is hte link click here
 
0
•••
EDIT: Here's something, nothing special..

sql
Code:
CREATE TABLE `stats` (
`ip` varchar(20) NOT NULL ,
`date` varchar(50) NOT NULL
) TYPE = MyISAM;

config.php
PHP:
<?php

$db = mysql_connect("localhost", "dbusername", "dbpassword") or die("Error: " .mysql_error());
mysql_select_db("databasename", $db) or die("Error: " .mysql_error());

?>

stats.php
PHP:
<?php

include ("config.php");

//IP
$ip = $_SERVER['REMOTE_ADDR']; 

//Date
$date = date("F d Y h:i A"); 

//Add a hit
$add_hit = mysql_query("INSERT INTO stats (ip, date) VALUES ('$ip', '$date')") or die(mysql_error());

//Grab the amount of uniques
$unique = mysql_query("SELECT DISTINCT ip FROM stats");
$unique_hits = mysql_num_rows($unique);

//Unique hits by date
$unique_today = mysql_query("SELECT DISTINCT ip FROM stats WHERE date = '$date'");
$unique_hits_today = mysql_num_rows($unique_today);

//All time total hits
$hits = mysql_query("SELECT ip FROM stats");
$all_hits = mysql_num_rows($hits);

//Hits for the current day
$today = mysql_query("SELECT ip FROM stats WHERE date = '$date'");
$today_hits = mysql_num_rows($today);

echo "Hits: $all_hits <br>";
echo "Today's Hits: $today_hits<br>";
echo "Unique Hits: $unique_hits<br>";
echo "Today's Unique: $unique_hits_today";

?>

All you need to do is run the sql.. edit the config file with your database details, and
PHP:
<?php include("stats.php"); ?>
on whatever page you want the hits to be counted/shown on...

Easy enough, and very simple :) Enjoy.


-Eric
 
Last edited:
0
•••
Yea, ill be interested.
 
0
•••
You posted before I finished the edit. ;)
 
0
•••
What do NOT NULL mean?
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back