|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #1 on: Feb 16, 10, 11:31 PM |
|
I just wanted to add that I put in some echoes so I could test syntax, input, etc and everything checks out. But still, the if check fails on user/pass echo( $_GET['user'] ); echo( $cSite['sAdminName'] ); echo( md5($_GET['password']) ); echo( $cSite['sAdminPassword'] ); 
|
|
|
|
|
Logged
|
|
|
|
Administrator
Sr. Member
Karma: 7
Posts: 486
|
 |
Reply #2 on: Feb 17, 10, 12:41 AM |
|
how does your php script call mochicron.php? could you post the line of code which does that?
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #3 on: Feb 17, 10, 02:24 AM |
|
I don't know what it is. I'm using this package: http://www.phpjobscheduler.co.uk/The way that thing works is there's a code I put in index.php which everytime it's served, it checks the scheduler's DB to see if a "job" needs to be executed. If yes, then it calls the URL I put in (which is done according to your instructions). I think he uses POST method...
|
|
|
|
|
Logged
|
|
|
|
Administrator
Sr. Member
Karma: 7
Posts: 486
|
 |
Reply #4 on: Feb 17, 10, 02:34 AM |
|
I see... in this case ask that package's authors about running a job with parameters.
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 43
|
 |
Reply #5 on: Feb 17, 10, 04:10 AM |
|
Easier it would be if you simulated POST from another script and THAT script would call mochicon.php
|
|
|
|
|
Logged
|
|
|
|
Administrator
Sr. Member
Karma: 7
Posts: 486
|
 |
Reply #6 on: Feb 17, 10, 04:25 AM |
|
As for me, I still believe it's easier to force hoster to enable parametrized cron 
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 43
|
 |
Reply #7 on: Feb 17, 10, 04:42 AM |
|
I am sure there is a reason for that.. SECURITY
|
|
|
|
|
Logged
|
|
|
|
Administrator
Sr. Member
Karma: 7
Posts: 486
|
 |
Reply #8 on: Feb 17, 10, 05:17 AM |
|
well, we are running out of the initial question's scope, but I'm curious - how can you increase the security level by switching from hoster's cron to its third-party replacement?
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 43
|
 |
Reply #9 on: Feb 17, 10, 05:21 AM |
|
ok, I believe that that thir-party is really only for launching the scripts. The third party assumes that the script you call has all it needs to launch itself properly. So, I'd just add username and password to mochicon itself 
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #10 on: Feb 17, 10, 01:31 PM |
|
The third-party script does not use Cron service. That is the difference.
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #11 on: Feb 18, 10, 02:51 PM |
|
Sergey, You asked to see the PHP. This is the function that calls the mochicron.php. As you can see, it uses a PHP INCLUDE method: function fire_script($script,$buffer_output=1) { if(!session_id()) session_start(); $md5_script=md5($script); if (!isset($_SESSION[$md5_script]))//check script is not already running { $_SESSION[$md5_script]="currently-running"; $start_time = microtime(true); if($buffer_output) ob_start(); $fire_type = (function_exists('curl_exec') ) ? " PHP CURL " : " PHP fsockopen "; // "://" satisfies both cases http:// and https:// if (strstr($script,"://") ) fire_remote_script($script); else { include(LOCATION.$script); $fire_type=" PHP include "; } if($buffer_output) $output=ob_get_contents(); else $output=""; if($buffer_output) ob_end_clean(); $execution_time=number_format( (microtime(true) - $start_time), 5 )." seconds via".$fire_type; $output=substr($output, 0, MAX_ERROR_LOG_LENGTH);// truncate output to defined length if (ERROR_LOG) save_log($script,$output,$execution_time); unset($_SESSION[$md5_script]); } }
|
|
|
|
|
Logged
|
|
|
|
Administrator
Sr. Member
Karma: 7
Posts: 486
|
 |
Reply #12 on: Feb 18, 10, 09:47 PM |
|
Thanks for the code Rabies... To use your method the mochicron.php script should contain admin username, password and all other parameters inside itself - no one parameter can be set via GET. If you want to send them via GET request you should use Curl module (Apache's) or sockets. Please read more at http://www.google.com/search?q=php+send+get+request
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #13 on: Feb 18, 10, 09:50 PM |
|
Thank you sir!
|
|
|
|
|
Logged
|
|
|
|
Customers
Full Member
Karma: 0
Posts: 67
|
 |
Reply #14 on: Feb 18, 10, 11:29 PM |
|
The scheduler uses cURL.
I ended up creating a new PHP file (copy of mochicron.php) with everything hardcoded, and it works. YAY!
|
|
|
|
|
Logged
|
|
|
|
|