On Mon, 13 Jan 2003, Bobo Wieland wrote:

> Just wanted to say thanks to those of you who've helped me on this one! =)
> Thanks...
>
> One more question to clarify one thing, though:
>
> if someone is calling 'index.php' like this: 'index.php?i=10'
>
> and on that page I have:
>
> while ($i <= 10) {
>  do something;
>  $i++;
> }
>
> that piece of code wouldn't be executed. But if I used $i = $_POST['i']; it
> would work. But then again the 'hacker' could write a form for himself and
> send $i via post...
> So the smartest(?) thing would be to just write:
>
> $i = 0;
> while ($i <= 10) {
>  do something;
>  $i++;
> }

Correct, but if you use a for loop, it would take care of that for you:

for($i=0;$i<10;$i++) {
        echo $i;
}

and it looks cleaner.

> Thanks for helping me!
>
> And about books being outdated; I still learn the basics better from books.
> When I've then learnt the basics it's easier to catch-up, reading on-line
> and asking people like you... But for me books is the way to go when I'm
> learning...

I agree. There's something about having physical paper in front of one
self that still makes things easier to understand.

-Dash

Atlanta makes it against the law to tie a giraffe to a telephone pole
or street lamp.




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to