I am using the following script: http://fofwebdesign.co.uk/template/_testing/click-count/
And I keep receiving the following error: Notice: Undefined offset: 1 in .../public_html/counter.php on line 18
<?php 
$file = 'counter.txt'; // path to text file that stores counts
$fh = fopen($file, 'r+');
$id = $_REQUEST['id']; // posted from page
$lines = '';
while(!feof($fh)){
    $line = explode('||', fgets($fh));
    $item = trim($line[0]);
    $num = trim($line[1]);
    if(!empty($item)){
        if($item == $id){
            $num++; // increment count by 1
            echo $num;
            }
        $lines .= "$item||$num\r\n";
        }
    } 
file_put_contents($file, $lines);
fclose($fh);
?>  
I am not sure what is causing it as I made no modifications to the script. Is it related to my hosting?
Help will be highly appreciated.
Thank you very much!
