Kasabian Posted September 29, 2008 Posted September 29, 2008 Ok if anyone needs help understanding one line of code or short peaces post it here i will start it off what does "MONO_ON" do? Quote
POG1 Posted September 29, 2008 Posted September 29, 2008 Re: code line help just stating 2 words won't help much... Quote
Kasabian Posted September 29, 2008 Author Posted September 29, 2008 Re: code line help just stating 2 words won't help much... define("MONO_ON"); its in the db class file, login file etc Quote
Haunted Dawg Posted September 30, 2008 Posted September 30, 2008 Re: code line help define("MONO_ON",1); include "class/class_db_{$_CONFIG['port']}.php"; I think it is, If you go look at class_db_mysql.php it says if(define("MONO_ON") != 1) { die(); } Quote
Kasabian Posted September 30, 2008 Author Posted September 30, 2008 Re: code line help if(define("MONO_ON") != 1) { die(); } ye but my question is what does it do Quote
Haunted Dawg Posted September 30, 2008 Posted September 30, 2008 Re: code line help A simple search can help you with that... <?php define("CONSTANT", "Hello world."); echo CONSTANT; // outputs "Hello world." echo Constant; // outputs "Constant" and issues a notice. define("GREETING", "Hello you.", true); echo GREETING; // outputs "Hello you." echo Greeting; // outputs "Hello you." ?> Taken from http://www.php.net/define Quote
Guest Anonymous Posted September 30, 2008 Posted September 30, 2008 Re: code line help It's often used as a mechanism to prevent a file from being executed *unless* it was included from somewhere else. For example, Assuming the following (and rather daft) file: <?php /* mypass.php */ if (!defined('SECURE_LABEL')) { die("Access Denied"); } echo "Your password is 'elephant'"; ?> Now, if somebody tries to call the file directly - usually by typing the full url into the address bar, they will just see "Access Denied"; In order to gain access to that file, you could do: <?php /* mysecurepass.php */ define('SECURE_LABEL', true); include("mypass.php"); ?> Now, if anybody navigates to mysecurepass.php, the mypass.php will be include, but this time, as SECURE_LABEL was defined, it will actually show your password. For obvious reasons, DON'T DO THIS, however it does hopefully exhibit how using manifest constants (in your case MONO_ON, in mine SECURE_LABEL) can be used to provide a limited for of protection. Personally, I find little need for this type of protection, however there are a lot of scripts that use it. Quote
Haunted Dawg Posted September 30, 2008 Posted September 30, 2008 Re: code line help I used this way on my ptc to stop the some script's from outsider's. I also used this to stop people from going to the config.php as many people were looking for it at some point. Another way is if some one find's a way to exploit your game in uploading a file such as a file that will connect to config.php and then fetch data from it this can be used. For example: in config.php: if(!defined('Config_Connect')) { die("Your not allowed to be here"); } else { $_CONFIG = array(.....); } Then in register.php, globals.php, fpass.php, login.php You add define("Config_Connect"); It's just another way to secure some script's from outsider's. Quote
Zero-Affect Posted October 1, 2008 Posted October 1, 2008 Re: code line help I used this way on my ptc to stop the some script's from outsider's. I also used this to stop people from going to the config.php as many people were looking for it at some point. Another way is if some one find's a way to exploit your game in uploading a file such as a file that will connect to config.php and then fetch data from it this can be used. For example: in config.php: if(!defined('Config_Connect')) { die("Your not allowed to be here"); } else { $_CONFIG = array(.....); } Then in register.php, globals.php, fpass.php, login.php You add define("Config_Connect"); It's just another way to secure some script's from outsider's. Interesting Method Kyle... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.