.htaccess Disabled ( Php_value ) :(
Started on the old forum in November 2008 · view the original in the archive · old links redirect here
there are three ways to set php values , in php.ini, .htaccess and in the scripts
if your host has disabled php vals in htaccess then they will have most likely stopped u using an included php.ini, but if you want to try it if you put a file called php.ini in your root folder with the register_globals = off line in it , if the host allows you to do this it will work (unless they have different paths set up for conf files, it varies from host to host)
htaccess is disabled so ur left with scripts .. and unfortunately ini_set() will do nothing with register globals as register globals is initialised before script execution (runtime) so you can do that either.
its most likely a case of:
A. Move host B. stop relying on register globals C. plead with your host to enable register globals. They will then tell you to bugger off as its a major security issue when you use register globals then go back to A and start again
QUOTE (djlee @ Nov 10 2008, 02:21 PM) <{POST_SNAPBACK}>
C. plead with your host to enable register globals. They will then tell you to bugger off as its a major security issue when you use register globals then go back to A and start again
Thankyou Dj Lee Maybee someone will start listening now that globals are crap and there just a quick fix to sloving problem. Register Globals may fix your problems short term but they could give you a serious headache later on.
i dont really think you should turn on the register globals thing. Its not safe. But still you can make things work! Use
$who = $_GET["$who"]; this way there so many places where these types of codes are missing, thats why you get the errors.
like "page" "message" some more. you need to figure it out. then the script will work properly without register globals
Its not good to on registers globals with .htaccess or php.ini which makes a script insecure
in register.php just add this code
$bdy = $_REQUEST["bdy"];
$usx = $_REQUEST["usx"];
$ulc = $_REQUEST["ulc"];
and adding super globals like $_SERVER like
$brws = explode(" ",$_SERVER["HTTP_USER_AGENT"]);
will prevent
a/s/l: 0/shemale or agh who am i?/
Browser :
problem
and
$_REQUEST should be used which works as $_GET and $_POST
REQUESTS are also bad depending on your server configuration POST will take precedence over GET or vica versa. So if you want to get lets say the session ID from the URL using $_REQUEST['sid'] is insecure compared to $_GET['sid'].. beccause what happens if i pass $_POST['sid'] with the http headers... if your server config is set to allow GET priority over POST then your safe in this exact example but obviously expecting POST data would make that config insecure, but if your server config allows POST over GET then the sid i sent via the POST param will be the one used.
OK maybe sid changing isn't a major problem since it will just return that ur not logged in and u get forwarded to login page .. but what about changing hidden vars in forms and such, ok it can be done easily anyhow with various browsers addons to simplify the process but why give malicious users more options ??? or maybe thats just the way i think
$_REQUEST is far more secure than register globals for sure, if youve only made that change then you've come a long way. but $_GET/$_POST is even better than $_REQUEST. Personally i see no need for $_REQUEST.
The main tip here is tell the script what YOU want. Dont let the user or script decide, you know what information should be being passed by the user and how it should be passed so dont give them any leaway. Do you type cast your numbers to integers to ensure that a number only user passed variable is in fact a number ... if your safety conscious then yes you do and thats a form of type casting, and its similar to making sure the data you have passed is passed in the acceptable way you designed it too be.
Now i know some people are gonna say .. well what if the script is some sort of action script that takes both GET and POST vars .. so lets say you have an action script that confirms users , however you have interface scripts that can pass the user ID via GET or POST depending on which script you use to confirm them ... you might decide to use
$id = $_REQUEST['id'];
However why not try
$id = (isset($_GET['id']) ? 0+$_GET['id'] : (isset($_POST['id']) ? 0+$_POST['id'] : NULL));
In this case you can change GET and POST around as you feel fit, although in this case it may not seem much of a security threat (it was just an example bit of code) there are times when you may need to accept the same var on a script via 2 request methods but you want one of the methods to take precedence over the other in the case both are set no matter what the PHP config says.
Also ofcourse remember cookie vars are in request global too if you use cookies (i hope you dont use request to ever auth cookies lol) and any version of PHP before 4.3 will also include FILE data too
More on the subject of why registering globals on is unsafe: http://www.php.net/manual/en/security.globals.php