Hvad er der galt med denne kode??????
Den skriver til filen lige meget hvad?
- <?php
-
-
- $id = htmlentities($_GET['id']);
-
- $error = "No page id mentioned to count!";
-
- if ($id =="")
- {
- echo "document.write('$error');";
- }
- else
- {
-
- //Her skulle det virke sys jeg//
-
- $chrille_ip = array();
- $skole_ip = array();
- $niki_ip = array();
-
- $chrille_ip = '**.**.***.***';
- $skole_ip = '**.***.***.***';
- $niki_ip = '***.***.***.**';
- //Name of hit count file//
- if ($ip != $chrille_ip && $ip != $skole_ip && $ip != $niki_ip){
-
- $count_file = "counts/" . $id . "_counts.htm";
-
- if (! @$file = fopen($count_file,"r+"))
- {
- $count="1";
- }
- else {
- $count = @fread($file, filesize($count_file)) or $count=0;
- fclose($file);
- $count++;
- }
-
- $file = fopen($count_file,"w+") or die("Error to write logs!");
- fputs($file, $count);
- fclose($file);
-
-
-
- }
-
- //slut//
-
-
- //Navn på logfil
- $log_file = "logs/" . $id . "_logs.htm";
-
-
-
- $time = date("l, j F Y [h:i a]");
- $ip = $_SERVER['REMOTE_ADDR'];
- $browser = $_SERVER['HTTP_USER_AGENT'];
- $country = file_get_contents('http://api.hostip.info/country.php?ip='.$IP);
-
-
-
- if ($ip != $chrille_ip && $ip != $skole_ip && $ip != $niki_ip){
- $fp = fopen("$log_file", "a");
- }
-
- fputs($fp, "<p><strong>Tid:</strong> $time<br><strong>IP:</strong> $ip<br><strong>Browser:</strong> $browser<br><strong>Number:</strong> $count<br><strong>Land:</strong> $country</p>");
-
- fclose($fp);
-
-
-
- exit();
- }
-
-
- ?>