View Single Post
Old 05-14-2012, 01:29 PM   #2 (permalink)
tony
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

Hi anilsoni7 welcome to the forum.

Based on the warnings it seems that the problems are in this lines:
php Code:
<?php
$f = fopen($CF_QUESTIONFILE,'r');
while($t = fread($f,102465)){
  $content .= $t;
}
fclose($f);
$content = trim(preg_replace('/\/\*.*\*\//ism', '', $content));

$temp = explode("\n",$content);
$random = rand(0,count($temp)-1);
$rand = $temp[$random];
list($question,$registration_id) = explode('\n\\',$rand);
$registration_id = bin2hex(encode_decode($registration_id,$CF_ENCDEC));

//mainly this lines; as the warnings show you the line numbers
while($t = fread($f,102465)){
fclose($f);
$registration_id = bin2hex(encode_decode($registration_id,$CF_ENCDEC));
?>
The first 2 warnings the problem seems to be that the fopen is not opening the $CF_QUESTIONFILE right so it returns FALSE. I would double check that $CF_QUESTIONFILE holds a valid path. (On I side not I find the functions file and file_get_contents easier to work with then the fopen,fread,fclose combo).

The last warning is basically saying that the encode_decode function doesn't exist. I know it doesn't exist in PHP so make sure it is implemented before it is used, either in the same file or in the require_once/require/include_once/include files.

P.S. Please use the PHP tags so that the PHP code retains the indentation when copied and is syntax highlighted. Easier to read.
tony is offline  
Reply With Quote