| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | [RESOLVED] Disable MySQL In A Script? [RESOLVED] Hey, Okay, i need a way in PHP to disable MySQL access for the rest of the script. Users will be allowed to upload their scripts and i would like to execute them for reasons i'm not going to reveal yet But i need to obviously secure it best i can so is there any way to disable MySQL access, so as to kinda run in sandbox mode?
__________________ -Beaver6813.com - Web Developer Extraordinaire!
Last edited by beaver6813; 01-05-2007 at 12:17 PM.
|
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: United Kingdom
Posts: 413
![]() ![]() ![]() | at the top of all the scripts PHP Code: ????: NamePros.com http://www.namepros.com/programming/276405-resolved-disable-mysql-in-a-script.html I'm not sure if that would work though, just a thought: http://uk.php.net/features.safe-mode Lee
__________________ Linux Screenshots |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 363
![]() ![]() ![]() ![]() | if you have apd installed, http://ca.php.net/manual/en/ref.apd.php , you can use the following method of disabling the functions you wish: for example: PHP Code: etc etc... but besure to disable the mysqli functions as well if they are applicable. Also if you don't want to lose functionality of the functions for yourself you can use rename_function to rename the functions to a secure name for your use. for example PHP Code:
__________________ Canadian Domain Registrar Ready.ca |
| |
| | THREAD STARTER #4 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | Brilliant Ill give rep in a sec Okay another incredibly annoying feature i can't get to work is that when i use my error handler in PHP it works fine with registering the first error, but doesn't pickup the others and it doesn't pickup parse errors, PHP overrides my error handler for parse errors. Any ideas?
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | #5 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Not sure why it would only do the first error however. An error handler cannot deal with parse errors as they are found before the script is executed and is outside the scope of the script. The following is taken from THIS manual page:-
| ||||
| |
| | THREAD STARTER #6 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | Okies, so there is definately no way around that? So it returns all parse errors instead of just the first one found?All i'm doing at the moment is picking up errors and setting error_log to write all errors to a text file which i can read at a later date. However even when i put in 3 errors like unclosed brackets and unterminated lines etc it still shows only one of the errors...
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | #7 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | sorry edited my post must have been just after you replied. As far as I am aware there is nothing you can do about reporting parse errors. I believe it is the zend engine that actually deals with the following errors:- E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, E_STRICT ????: NamePros.com http://www.namepros.com/showthread.php?t=276405 Hence why a custom error handler cannot deal with them.
| ||||
| |
| | THREAD STARTER #8 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() | Thanks Resolved!
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| |
| | THREAD STARTER #10 (permalink) | ||||
| NamePros Regular Join Date: May 2005 Location: England
Posts: 392
![]() ![]() ![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=276405 I've also taken a peek at a debugger written in C++ that actually taps straight into PHP's Zend engine, but i doubt i'd be able to do that in PHP
__________________ -Beaver6813.com - Web Developer Extraordinaire! | ||||
| |