Well, I was wondering if anyone could help me locate the exact cause of my error, seeing as I'm not finding it. I've been looking in ConTEXT with the PHP highlighter on and it hasn't done me any good. Anyway...
Parse error: parse error, unexpected $ in /home/ketsuka/public_html/test/counter.php on line 144
<?php
/*************************************
* Dissionance Counter v0.1 *
* by Nite Phire *
*====================================*
* [url]http://dissonance.ketsukaiten.net/[/url] *
* [email]nitephire@ketsukaiten.net[/email] *
*************************************/
// MySQL information, edit this.
$mysqlhost = 'localhost';
$mysqluser = 'xxxxxxx';
$mysqlpassword = 'xxxxxxx';
$database = 'ketsuka_stats';
$tableprefix = 'test';
//
// DO NOT EDIT until the bottom when it says to!
//
// Connects to MySQL.
$connect = mysql_connect ($mysqlhost, $mysqluser, $mysqlpassword)
or die ("Wrong host, username, or password.");
mysql_select_db ($database)
or die ("Could not select database.");
// Total hits.
$hitstotal = mysql_query ('SELECT total FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve hits total.');
$hitstotal = $hitstotal++;
mysql_query ('UPDATE ' . $tableprefix . '_stats SET total="' . $hitstotal . '" WHERE type="hits";')
or die ('Could not update total hits.');
// Hits today and hits average.
$checkdate = mysql_query ('SELECT checkdate FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve date.');
if ($checkdate == date (Ymd)) {
$hitstoday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type = hits;')
or die ('Could not retrieve hits today');
$hitdtoday = $hitstoday++;
mysql_query ('UPDATE ' . $tableprefix . '_stats SET today="' . $hitstoday . '" WHERE type="hits";')
or die ('Could not update hits today.');
} else {
$newdate = date (Ymd);
$hitsyesterday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve needed information.');
$hits2daysago = mysql_query ('SELECT yesterday FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve needed information.');
$hits3daysago = mysql_query ('SELECT 2daysago FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve needed information.');
$hits4daysago = mysql_query ('SELECT 3daysago FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve needed information.');
$hitsavg = ($hitsyesterday+$hits2daysago+$hits3daysago+$hits4daysago)/4;
mysql_query ('UPDATE ' . $tableprefix . '_stats SET checkdate="' . $newdate . '",
today="1",
yesterday="' . $hitsyesterday . '",
2daysago="' . $hits2daysago . '",
3daysago="' . $hits3daysago . '",
4daysago="' . $hits4daysago . '",
average="' . $hitsavg . '"
WHERE type="hits";')
or die ('Could not update the date check or hits for recent days.');
};
// Unique hits.
$currentip = $_SERVER['REMOTE_ADDR'];
if ($checkdate == date (Ymd)) {
$retrieveip = mysql_query ('SELECT ipadress FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve IP address list.');
$ipaddress = array (explode ('|'), $retrieveip);
if (!in_array ($currentip, $ipaddress)) {
$uniquetotal = mysql_query ('SELECT total FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$uniquetoday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$uniquetotal = $uniquetotal++;
$uniquetoday = $uniquetoday++;
$newipaddress = $retrieveip . "|" . $currentip;
mysql_query ('UPDATE ' . $tableprefix . '_stats SET total="' . $uniquetotal . '",
today="' . $uniquetoday . '",
ipadress="' . $newipaddress . '"
WHERE type="unique";')
or die ('Could not update unique hits information.');
}
} else {
$newdate = date (Ymd);
$uniquetotal = mysql_query ('Select total FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$uniquetotal = $uniquetotal++;
$uniqueyesterday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$unique2daysago = mysql_query ('SELECT yesterday FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$unique3daysago = mysql_query ('SELECT 2daysago FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$unique4daysago = mysql_query ('SELECT 3daysago FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve needed information.');
$uniqueavg = ($uniqueyesterday+$unique2daysago+$unique3daysago+$unique4daysago)/4;
mysql_query ('UPDATE ' . $tableprefix . '_stats SET total="' . $uniquetotal . '",
checkdate="' . $newdate . '",
today="1",
yesterday="' . $uniqueyesterday . '",
2daysago="' . $unique2daysago . '",
3daysago="' . $unique3daysago . '",
4daysago="' . $unique4daysago . '",
average="' . $uniqueavg . '"
WHERE type="unique";')
or die ('Could not update the date check or unique hits for recent days.');
// Retrieves new data.
$hitstotal = mysql_query ('SELECT total FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve total hits.');
$hitstoday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve hits today.');
$hitsavg = mysql_query ('SELECT average FROM ' . $tableprefix . '_stats WHERE type="hits";')
or die ('Could not retrieve average hits.');
$uniquetotal = mysql_query ('SELECT total FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve unique hits.');
$uniquetoday = mysql_query ('SELECT today FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve unique hits today.');
$uniqueavg = mysql_query ('SELECT average FROM ' . $tableprefix . '_stats WHERE type="unique";')
or die ('Could not retrieve average unique hits.');
mysql_close ($connect);
//
// Edit these display settings however you'd like, though keep a back-up for if it doesn't work. If you need help, contact Nite Phire.
//
print '
Page Hits Total :: ' . $hitstotal . '<br />
Page Hits Today :: ' . $hitstoday . '<br />
Page Hits Average :: ' . $hitsavg . '<br />
<br />
Unique Hits Total :: ' . $uniquetotal . '<br />
Unique Hits Today :: ' . $uniquetoday . '<br />
Unique Hits Average :: ' . $uniqueavg;
exit;
?>
Oh, and yes, I x-d out the MySQL user and password for privacy reasons...
And according to ConTEXT there are 143 lines of code total if that helps at all...