Stats for New Version

Anything about the script that does not fit in the other categories.

Stats for New Version

Postby Jason G » 2006-05-21 07:16 pm

I have a stats script that works with the old version. It's below. How can I change it for the new version? Or is there one?

Code: Select all
<?
require_once 'config.php';

$dbl = mysql_connect($CONFIG['sql_host'], $CONFIG['sql_user'], $CONFIG['sql_pass']) or die(mysql_error());
$db = mysql_select_db($CONFIG['sql_database'], $dbl) or die(mysql_error());

$result = mysql_query("SELECT SUM(unq_pv_today) FROM {$CONFIG['sql_prefix']}_stats") or die(mysql_error());
list($unq_pv_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "Unique Visitors On Members' Sites Today: {$unq_pv_today}";

mysql_close($dbl);

require_once 'config.php';

$dbl = mysql_connect($CONFIG['sql_host'], $CONFIG['sql_user'], $CONFIG['sql_pass']) or die(mysql_error());
$db = mysql_select_db($CONFIG['sql_database'], $dbl) or die(mysql_error());

$result = mysql_query("SELECT SUM(unq_in_today) FROM {$CONFIG['sql_prefix']}_stats") or die(mysql_error());
list($unq_in_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "  Unique Visitors On My Top 400 Today: {$unq_in_today}";

mysql_close($dbl);
?>
Jason G
Advanced Member
 
Posts: 85
Joined: 2005-03-01 08:29 pm
Location: San Diego, CA, USA

Postby Jeremy » 2006-05-21 09:04 pm

change config.php to settings_sql.php. change $CONFIG to $CONF. besides that it should work, although i haven't tested it.
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby Jason G » 2006-05-21 11:52 pm

Thanks, Jeremy. I'm getting this error, now:

Warning: mysql_connect(): Access denied for user 'SITENAME'@'localhost' (using password: NO) in /home/SITENAME/...../stats7.php on line 4
Access denied for user 'SITENAME'@'localhost' (using password: NO)
Jason G
Advanced Member
 
Posts: 85
Joined: 2005-03-01 08:29 pm
Location: San Diego, CA, USA

Postby Jeremy » 2006-05-22 12:01 am

can you post your updated code here? i want to see exactly what u updated
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby Jason G » 2006-05-22 01:03 am

Sure. Here it is:

Code: Select all
<?
require_once 'settings_sql.php';

$dbl = mysql_connect($CONF['sql_host'], $CONF['sql_user'], $CONF['sql_pass']) or die(mysql_error());
$db = mysql_select_db($CONF['sql_database'], $dbl) or die(mysql_error());

$result = mysql_query("SELECT SUM(unq_pv_today) FROM {$CONF['sql_prefix']}_stats") or die(mysql_error());
list($unq_pv_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "Unique Visitors On Members' Sites Today: {$unq_pv_today}";

mysql_close($dbl);

require_once 'settings_sql.php';

$dbl = mysql_connect($CONF['sql_host'], $CONF['sql_user'], $CONF['sql_pass']) or die(mysql_error());
$db = mysql_select_db($CONF['sql_database'], $dbl) or die(mysql_error());

$result = mysql_query("SELECT SUM(unq_in_today) FROM {$CONF['sql_prefix']}_stats") or die(mysql_error());
list($unq_in_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "  Unique Visitors On My Top 400 Today: {$unq_in_today}";

mysql_close($dbl);
?>
Jason G
Advanced Member
 
Posts: 85
Joined: 2005-03-01 08:29 pm
Location: San Diego, CA, USA

Postby Jeremy » 2006-05-22 01:18 am

ok, i have fixed it for version 5 (and improved the code a little):
Code: Select all
<?
require_once 'settings_sql.php';

$dbl = mysql_connect($CONF['sql_host'], $CONF['sql_username'], $CONF['sql_password']) or die(mysql_error());
$db = mysql_select_db($CONF['sql_database'], $dbl) or die(mysql_error());

$result = mysql_query("SELECT SUM(unq_pv_0_daily) FROM {$CONF['sql_prefix']}_stats") or die(mysql_error());
list($unq_pv_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "Unique Visitors On Members' Sites Today: {$unq_pv_today}<br /><br />";

$result = mysql_query("SELECT SUM(unq_in_0_daily) FROM {$CONF['sql_prefix']}_stats") or die(mysql_error());
list($unq_in_today) = mysql_fetch_array($result, MYSQL_NUM);

echo "  Unique Visitors On My Top 400 Today: {$unq_in_today}";

mysql_close($dbl);
?>


it really does work now, see http://www.aardvarktopsitesphp.com/topsites/test.php if you don't believe me :)
Jeremy
Supreme Diety
 
Posts: 8922
Joined: 2003-05-05 04:41 pm
Location: NJ, USA

Postby Jason G » 2006-05-22 01:22 am

Fantastic! Thanks, Jeremy.
Jason G
Advanced Member
 
Posts: 85
Joined: 2005-03-01 08:29 pm
Location: San Diego, CA, USA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron