Simple PHP question

By the way, an alternative method is to use the import_request_variables method. It will import all of the name/value pairs from the HTTP request into your global variable space, same as before, but give them a prefix so that they can’t clash with the other variables in your script.

For example:


<?php
import_request_variables("gp", "req_");

echo 'meret='.filesize($req_filename) . "&ended=igen";
?>

Now, as long as you make sure that none of your variable names start with the req_ prefix, except when you actually intend to refer to the GET or POST request, you can have all the convenience of automatic globals, without the security risks.

I assume I access this through telnet?

I don’t know. But if you have to ask that question, you are presumably not the admin of the machine in question, which means that you almost certainly don’t have write permission to the /etc directory.

You could still try putting a php.ini in the web-root. However, you don’t need to, because either of the two scripts I gave in my last posts will work independently of the setting of register_globals, so you should just leave it disabled.

(By the way, register_globals isn’t that dangerous – it’s not as if merely having it enabled will, by itself, open up your machine to attacks. However, in larger programs it can allow hackers to insert stuff into your program’s variables in unexpected and undesired ways. And anyway, explicitly initializing your program’s input, instead of just dumping the contents of the GET/POST request into the global variable space, is just basic good programming practice: it makes your code more readable by showing explicitly what values the program expects. Not that it matters for a two-line script like this, of course, but you might as well get used to doing things the right way.)

shrug I don’t know. It’s my account, it’s web server space hosted at A Plus Net.
I have very little knowledge of how these things work beyond HTML. Last time I used telnet and UNIX was in my university days.

I figured it out.

Congratulations! Nice site, by the way – cool photos.

Oh, it’ll get cooler. :slight_smile: It’s not quite a random collection of images up there, but still a little ways from being complete.