JustFriend Posted August 24, 2013 Share Posted August 24, 2013 Warning: explode() expects parameter 2 to be string, array given in/home/manoww/domains/manowwe.us.lt/public_html/topu.phpon line 19 Somewhere there is some sort of mistake topu.php file <?php /////////pagr topas///////// $fp9 = fopen("topas.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[0]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("topas.txt"); $kl = explode("|",$tope); if ($lygg > 3){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topas.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////2as topas///// $fp9 = fopen("topex.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[3]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("topex.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topex.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////gyv topas///// $fp9 = fopen("topgy.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[5]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("topgy.txt"); $kl = explode("|",$tope); if ($lygg > 10){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topgy.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////patir topas///// $fp9 = fopen("toppa.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[6]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("toppa.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("toppa.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////extr topas///// $fp9 = fopen("topext.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $nyy = $hj[2]; $stt = $hj[16]; $bkll = @file_get_contents("miners/$nyy.txt"); $hjj = explode("|",$bkll); $lygg = $hjj[15]; $tope = file("topext.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topext.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////jega topas///// $fp9 = fopen("topje.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $nyy = $hj[2]; $stt = $hj[16]; $bkll = @file_get_contents("miners/$nyy.txt"); $hjj = explode("|",$bkll); $lygg = $hjj[16]; $tope = file("topje.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topje.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////pin topas///// $fp9 = fopen("toppin.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[7]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("toppin.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("toppin.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////kovu topas///// $fp9 = fopen("topkov.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = $hj[8]; $nyy = $hj[2]; $stt = $hj[16]; $tope = file("topkov.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topkov.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} /////kreditu topas///// $fp9 = fopen("topkrd.txt","w"); fwrite($fp9,""); fclose($fp9); $link="users/"; $dira=glob($link."*") or die('error '); $eil=count($dira); for($i=0; $i<$eil; $i++){ $bkl = @file_get_contents($dira[$i]); $hj = explode("|",$bkl); $lygg = file_get_contents("kreditai/$nyy.txt"); $nyy = $hj[2]; $stt = $hj[16]; $tope = file("topkrd.txt"); $kl = explode("|",$tope); if ($lygg > 1){if ($stt == "Narys"){ $vrdll = "$nyy"; } if ($stt == "Adminas"){ $vrdll = "@$nyy"; } if ($stt == "Moderatorius"){ $vrdll = "*$nyy"; } $fp9 = fopen("topkrd.txt","a"); fwrite($fp9,"$lygg|$vrdll|\n"); fclose($fp9); }} ?> IF YOU CAN PLEASE FIND ERRORS Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted August 24, 2013 Share Posted August 24, 2013 (edited) the error message is pretty self explanatory. did you look at line 19 and try to figure out why your code is supplying an array instead of a string to the explode() function, especially since your code isn't even using the result from the explode() statement on line 19? Edited August 24, 2013 by mac_gyver Quote Link to comment Share on other sites More sharing options...
JustFriend Posted August 24, 2013 Author Share Posted August 24, 2013 Here a lot of those lines are not sure what 19 :/ Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted August 24, 2013 Share Posted August 24, 2013 if your programming editor doesn't display line numbers, use something like notepad++ the following is a lesson in data driven design. as far as i can tell, this is what you code is trying to do (untested) - // define the data needed by the code for each output file/data type $data['topas.txt'] = array('type'=>'field','n'=>0,'value'=>3); // field [0] > 3 $data['topex.txt'] = array('type'=>'field','n'=>3,'value'=>1); // field [3] > 1 $data['topgy.txt'] = array('type'=>'field','n'=>5,'value'=>10); // field [5] > 10 $data['toppa.txt'] = array('type'=>'field','n'=>6,'value'=>1); // field [6] > 1 $data['topext.txt'] = array('type'=>'miners','n'=>15,'value'=>1); // field [15] in miners/$nyy.txt > 1 $data['topje.txt'] = array('type'=>'miners','n'=>16,'value'=>1); // field [16] in miners/$nyy.txt > 1 $data['toppin.txt'] = array('type'=>'field','n'=>7,'value'=>1); // field [7] > 1 $data['topkov.txt'] = array('type'=>'field','n'=>8,'value'=>1); // field [8] > 1 $data['topkrd.txt'] = array('type'=>'kreditai','value'=>1); // contents in kreditai/$nyy.txt > 1 $link="users/"; $dira=glob($link."*") or die('error'); // clear all output/data files foreach($data as $file=>$not_used){ file_put_contents($file,''); // clear file } foreach($dira as $user_file){ // loop over each user file $bkl = file_get_contents($user_file); $hj = explode("|",$bkl); // loop over each output file/data type foreach($data as $file=>$arr){ $nyy = $hj[2]; $stt = $hj[16]; switch($arr['type']){ case 'field'; $lygg = $hj[$arr['n']]; break; case 'miners': $bkll = file_get_contents("miners/$nyy.txt"); $hjj = explode("|",$bkll); $lygg = $hjj[$arr['n']]; break; case 'kreditai': $lygg = file_get_contents("kreditai/$nyy.txt"); break; } if($lygg > $arr['value']){ if ($stt == "Narys"){$vrdll = "$nyy";} if ($stt == "Adminas"){$vrdll = "@$nyy";} if ($stt == "Moderatorius"){$vrdll = "*$nyy";} file_put_contents($file,"$lygg|$vrdll|\n",FILE_APPEND); } } } Quote Link to comment Share on other sites More sharing options...
JustFriend Posted August 24, 2013 Author Share Posted August 24, 2013 I use notepad Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted August 24, 2013 Share Posted August 24, 2013 microsoft's notepad isn't a programming editor. notepad++ is this - http://notepad-plus-plus.org/ Quote Link to comment Share on other sites More sharing options...
JustFriend Posted August 24, 2013 Author Share Posted August 24, 2013 Bit I did not understand what you say because I am not an Englishman. This could identify the error Line 19? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.