$j) { $final[$k] = $content2[0] ; //echo $final[$k]."
"; $j++; $k++; } $i++; } return $final; } do_the_thing(); function do_the_thing() { check(); if(strlen($_GET[formname])<3) { exit("Error Code : KR10001"); } $array = directory_parse($_GET[formname]); //echo count($array); $random_number = random(count($array)-1); file_value($array[$random_number]); write_file($array[$random_number]); } function random($max) { return rand(0,$max); } function write_file($file) { //open file, get file value $handle = fopen("data/".$file.".txt", "r"); $content = fread($handle, filesize("data/".$file.".txt")); fclose($handle); //write exposure $handle = fopen("data/".$file.".txt", "w+"); fwrite($handle, $content+1); fclose($handle); } function file_value($file) { $handle = fopen("data/".$file, "r"); $content = fread($handle, filesize("data/".$file)); fclose($handle); echo $content; return; } ?>