DanC Posted September 13, 2009 Share Posted September 13, 2009 Hi, I'm still quite new to PHP. I really can't figure this out. I have a file called chmod.php which only admins can use. This file chmods a few other files that need to be written to on the server. However, chmod.php will ONLY chmod files if they aren't already writeable (is_writeable)... I want to add a link to the bottom of chmod.php that says "Force CHMOD" and I want it to go into a different mode, e.g: www.example.com/chmod.php will execute a normal chmod. www.example.com/chmod.php&mode=force will execute a force. How would I go about doing this in my script? Thanks! Quote Link to comment Share on other sites More sharing options...
bmdsherman Posted September 13, 2009 Share Posted September 13, 2009 www.example.com/chmod.php?mode=force Quote Link to comment Share on other sites More sharing options...
AviNahum Posted September 14, 2009 Share Posted September 14, 2009 <?php switch ($_GET['mode']) { case 'force': force_function(); break; default: normal_function(); } function force_function() { //CODE } function normal_function() { //CODE } ?> Quote Link to comment Share on other sites More sharing options...
DanC Posted September 14, 2009 Author Share Posted September 14, 2009 Thanks so much! Quote Link to comment Share on other sites More sharing options...
bmdsherman Posted September 14, 2009 Share Posted September 14, 2009 I'm sorry, I didn't realize that was what you where looking for. You should be careful when putting variables in the url, anybody can edit them. For example if you had a login script you wouldn't want to send somebody to http://url.com/login.php?login=successfull?type=user because somebody could easily change that to http://url.com/login.php?login=successfull?type=admin Quote Link to comment Share on other sites More sharing options...
DanC Posted September 14, 2009 Author Share Posted September 14, 2009 Hi, No worries, thanks for the extra info! I'll be careful. Quote Link to comment Share on other sites More sharing options...
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.