diff options
Diffstat (limited to 'includes/hits.php')
| -rw-r--r-- | includes/hits.php | 102 |
1 files changed, 102 insertions, 0 deletions
| diff --git a/includes/hits.php b/includes/hits.php new file mode 100644 index 0000000..053c6b4 --- /dev/null +++ b/includes/hits.php | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | <?php | ||
| 2 | /* | ||
| 3 | 444444444 | ||
| 4 | 4::::::::4 | ||
| 5 | 4:::::::::4 | ||
| 6 | 4::::44::::4 | ||
| 7 | 4::::4 4::::4 Four Island | ||
| 8 | 4::::4 4::::4 | ||
| 9 | 4::::4 4::::4 Written and maintained by Starla Insigna | ||
| 10 | 4::::444444::::444 | ||
| 11 | 4::::::::::::::::4 includes/hits.php | ||
| 12 | 4444444444:::::444 | ||
| 13 | 4::::4 Please do not use, reproduce or steal the | ||
| 14 | 4::::4 contents of this file without explicit | ||
| 15 | 4::::4 permission from Hatkirby. | ||
| 16 | 44::::::44 | ||
| 17 | 4::::::::4 | ||
| 18 | 4444444444 | ||
| 19 | */ | ||
| 20 | |||
| 21 | if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} | ||
| 22 | |||
| 23 | require('headerproc.php'); | ||
| 24 | |||
| 25 | /* Notice: | ||
| 26 | |||
| 27 | This is an old module for counting hits | ||
| 28 | taken directly from the old Four Island. | ||
| 29 | Because of this, it may contain unforseen | ||
| 30 | bugs. | ||
| 31 | */ | ||
| 32 | |||
| 33 | $getlreset = "SELECT * FROM config WHERE name = 'lastReset'"; | ||
| 34 | $getlreset2 = mysql_query($getlreset); | ||
| 35 | $getlreset3 = mysql_fetch_array($getlreset2); | ||
| 36 | if ((floor(time()/86400))>($getlreset3['value'])) | ||
| 37 | { | ||
| 38 | $sethits = "UPDATE config SET value = " . (floor(time()/86400)) . " WHERE name = 'lastReset'"; | ||
| 39 | $sethits2 = mysql_query($sethits); | ||
| 40 | $getips = "SELECT * FROM hits"; | ||
| 41 | $getips2 = mysql_query($getips); | ||
| 42 | $i=0; | ||
| 43 | while ($getips3[$i] = mysql_fetch_array($getips2)) | ||
| 44 | { | ||
| 45 | $ttime = strtotime($getips3[$i]['lasttime']); | ||
| 46 | $delip = "DELETE FROM hits WHERE id = " . $getips3[$i]['id']; | ||
| 47 | $delip2 = mysql_query($delip); | ||
| 48 | $i++; | ||
| 49 | } | ||
| 50 | $sethits6 = "UPDATE config SET value = 0 WHERE name = 'todayHits'"; | ||
| 51 | $sethits7 = mysql_query($sethits6); | ||
| 52 | } | ||
| 53 | $client_ip = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') ); | ||
| 54 | $user_ip = $client_ip; | ||
| 55 | $getip = "SELECT * FROM hits WHERE ip = '" . $user_ip . "'"; | ||
| 56 | $getip2 = mysql_query($getip); | ||
| 57 | $getip3 = mysql_fetch_array($getip2); | ||
| 58 | if ($getip3['ip'] != $user_ip) | ||
| 59 | { | ||
| 60 | $gethits = "SELECT * FROM config WHERE name = 'hits'"; | ||
| 61 | $gethits2 = mysql_query($gethits); | ||
| 62 | $gethits3 = mysql_fetch_array($gethits2); | ||
| 63 | $sethits = "UPDATE config SET value = " . ($gethits3['value']+1) . " WHERE name = 'hits'"; | ||
| 64 | $sethits2 = mysql_query($sethits); | ||
| 65 | $gethits4 = "SELECT * FROM config WHERE name = 'todayHits'"; | ||
| 66 | $gethits5 = mysql_query($gethits4); | ||
| 67 | $gethits6 = mysql_fetch_array($gethits5); | ||
| 68 | $sethits4 = "UPDATE config SET value = " . ($gethits6['value']+1) . " WHERE name = 'todayHits'"; | ||
| 69 | $sethits5 = mysql_query($sethits4); | ||
| 70 | $gethits7 = "SELECT * FROM config WHERE name = 'imHits'"; | ||
| 71 | $gethits8 = mysql_query($gethits7); | ||
| 72 | $gethits9 = mysql_fetch_array($gethits8); | ||
| 73 | $setip = "INSERT INTO hits SET ip = '" . $user_ip . "'"; | ||
| 74 | $setip2 = mysql_query($setip); | ||
| 75 | if (isset($_SERVER['HTTP_REFERER'])) | ||
| 76 | { | ||
| 77 | $page = $_SERVER['HTTP_REFERER']; | ||
| 78 | } else { | ||
| 79 | $page = ''; | ||
| 80 | } | ||
| 81 | $ipdetails = str_pad($client_ip,15,' ') . ' - ' . str_pad($page,61,' ') . ' - ' . str_pad($_SERVER['REQUEST_URI'],27,' ') . ' - ' . time() . chr(13) . chr(10); | ||
| 82 | // file_put_contents('/var/www/fourisland/ipdetails.txt',$ipdetails,FILE_APPEND); | ||
| 83 | $milestones = array(100,500,1000,1337,4444,5000,10000,15000,50000,75000,100000,150000,250000,500000,750000,1000000); | ||
| 84 | $i=0; | ||
| 85 | for ($i=0; $i<15; $i++) { | ||
| 86 | if (($gethits3['value']+1)==$milestones[$i]) { | ||
| 87 | file_put_contents('/var/www/fourisland/tophits.txt',$ipdetails,FILE_APPEND); | ||
| 88 | $setmst = 'UPDATE config SET value = "' . time() . '" WHERE name = "milestonetime"'; | ||
| 89 | $setmst2 = mysql_query($setmst); | ||
| 90 | $setms = 'UPDATE config SET value = "' . ($gethits3['value']+1) . '" WHERE name = "milestone"'; | ||
| 91 | $setms2 = mysql_query($setms); | ||
| 92 | include('includes/header.php'); | ||
| 93 | ?> | ||
| 94 | <FONT SIZE="6" COLOR="RED">CONGRADULATIONS! You are the <?php echo($gethits3['value']+1); ?>th person to visit this site! Refresh the page to return to the page you were visiting.</FONT> | ||
| 95 | <?php | ||
| 96 | include('includes/footer.php'); | ||
| 97 | exit; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | ?> | ||
