Jump to content

Recommended Posts


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 :)

 

Link to comment
https://forums.phpfreaks.com/topic/281511-warning/
Share on other sites

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 by mac_gyver
Link to comment
https://forums.phpfreaks.com/topic/281511-warning/#findComment-1446533
Share on other sites

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);
        }
    }
}
Link to comment
https://forums.phpfreaks.com/topic/281511-warning/#findComment-1446547
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.