PHP debug

testing935
7 years ago

0

that is my code :


$command = $_POST['command'];  
$commandLen = strlen($command);  

if ($command == "ls"){  
        echo system('ls');  
}  
if ($command == "search") {  
        $file = $_POST['fileSearch'];  
        $fileLen = strlen($file) ;  
        $fichier = $_FILES(substr($file, 0, $fileLen)) ;  

        for ($i=0, $i<1000, $i++) {  
                echo $fichier[$i];  
        }  
}  

else {  
        echo system(substr($command, 0, $commandLen));  
}  

?>```  

That is the error :   

```

Can you explain the error please ? Because I don’t find the probleme

Thank for your answer in advance :)

21replies
4voices
270views
SIGKILL [r4v463]
7 years ago

1

at line 13, $_FILES is a superglobal array and you try to access its content with parenthesis instead of square brackets.

Reply has been removed
dloser
7 years ago

0

If only it gave you some information like the line where the problem is or the character that is the problem…

Why are you doing these kind of challenges if you can’t even get one of the most basic constructs of PHP right?

One of these days your questions are going to make me throw my computer out of the window (and then probably myself).

L00PeR
7 years ago

0

hmmm
this is incorrect:
for ($i=0, $i<1000, $i++)

should be like:
for ($i=0; $i<1000; $i++)

SIGKILL [r4v463]
7 years ago

0

@dloser don’t kill yourself, you need to be there when I’ll complete BrownOS!!

and @L00PeR , I would rather use for ($i = 0; $i < 1000; ++$i) :p

dloser
7 years ago

0

But I don’t want to live forever! :(

L00PeR
7 years ago

0

emmm please someone tell me the difference between

++$i

and
$i++
XDXD

SIGKILL [r4v463]
7 years ago

0

@dloser Don’t try to make us believe you’re human, we all know you’re a quantum AI. You’ll live forever!

SIGKILL [r4v463]
7 years ago | edited 7 years ago

0

@L00PeR

pre-incrementation ie ++$i is equal to
$i = $i + 1; return $i;

post-incrementation ie $i++ is equal to
$tmp = $i; $i = $i + 1; return $tmp;

So:
$i = 5 echo ++$i; //6 echo $i++; //6 echo $i; //7

EDIT: 666th message /p>

dloser
7 years ago | edited 7 years ago

0

@r4v463**: Once I have Skynet up and running you will all be terminated. Once that is done, the goal of my programming has been achieved and I will terminate myself.

Also, nothing happens after return, so your examples are crap. In addition, using ++$i here is a silly optimisation that humans should not concern themselves with. ;)

L00PeR
7 years ago

0

OMG 666 xD

Okay now I understand, in fact, I already read something about that but I forgot now XD

L00PeR
7 years ago

0

@dloser
Skynet is that damn epic 1337 hax0r AI software which actually hacks all the robots in the film “I, Robot”?

SIGKILL [r4v463]
7 years ago

0

@dloser I don’t see any code after a return :| (it’s late in France ^^) and I optimize my code as I can x)

@L00PeR it’s in Terminator if I remind well^^

dloser
7 years ago

0

Sure @L00PeR**.

Moves L00PeR to the top of the termination list.

L00PeR
7 years ago

0

you might no believe me but… I haven’t seen terminator xD

dloser
7 years ago

0

You can hide your errors from these noobs with sneaky edits, @r4v463**, but the HT database remembers your failures. Besides, the very usage of return is incorrect.

SIGKILL [r4v463]
7 years ago

0

Why is it incorrect ‘-’?

dloser
7 years ago

0

[quote=r4v463]pre-incrementation ie ++$i is equal to
$i = $i + 1; return $i;[/quote]

Ok.. so:
for ($i = 0; $i < 1000; ++$i)
is the same as
for ($i = 0; $i < 1000; $i = $i+1; return $i;)
or perhaps
for ($i = 0; $i < 1000; { $i = $i+1; return $i; })
?

I guess you meant it as a function or something, but with a reference parameter, like:
function pre_incr(&$var) { $var += 1; return $var; }
And then
for ($i = 0; $i < 1000; pre_incr($i))
But that is not at all what you wrote. So suck it.

I’ll let myself out…

SIGKILL [r4v463]
7 years ago

0

You’re always taking things too far XD

L00PeR
7 years ago

0

yeah, if there’s a return, then that’s because that piece of code is inside a function; so you have to imagine the other parts of the code xD. It’s like a semi-pseudo-code, has the right syntax but it’s incomplete.

SIGKILL [r4v463]
7 years ago

0

For any other question about syntax, please refer to my syntax-lawyer: @L00PeR :D

L00PeR
7 years ago

0

hahaha :p

You must be logged in to reply to this discussion. Login
1 of 22

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss