Current time: 11-26-2024, 12:56 PM Hello There, Guest! (LoginRegister)


Post Reply 
Writing CronJobs Web int. It's time!
Author Message
data-stream_ru Offline
Moderator
*****
Moderators

Posts: 471
Joined: Jan 2009
Reputation: 7
Post: #9
RE: Writing CronJobs Web int. It's time!
Code for litle checking $comand_line

Code:
<?php

// Vladimir Sinitsyn aka SenatoR
// Russia, Yekaterinburg
// Русские, привет! =)


#$command_line = "/aaa.php?bb=ccc&e";


$file_type = array('.php','.php4','.php5,'.cgi','.pl','.py'); //List of GOOD files ;-)
// only php, perl and python we let to execute

//Let`s start our work!

$flag = 0; //Use one thing!

  foreach($file_type as $k=>$v) //Start
  {

      if(strpos($command_line,$v) == true) //Works fast!!! (its important)
    {    
        $flag++; //Yeah! Its good!
        
        $file = preg_replace("/(\\".$v.").*/i","\\1",$command_line); //CUT ALL!!! Only filename in $file!
        break; //Stop
    }
  }

if($flag == 0) exit; //Nothing to do!

//Check something...

if(!file_exists($file)) exit; //No file!

if(!is_readable($file)) exit; //Wrong permissions!

if(strpos("cgi",$file) || strpos("pl",$file)) // only for cgi and pl and so..
{
    if(!is_executable($file)) exit; //Wrong permissions!
}

?>

We can add thise simply checks to cronjobs_add.php & cronjobs_edit.php in future.

And now I go to testing hcrond-0.3.2.tar.gz
I do not know what is hcrond-nopid.
(This post was last modified: 01-07-2009 02:30 AM by data-stream_ru.)
01-07-2009 02:29 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Writing CronJobs Web int. It's time! - data-stream_ru - 01-07-2009 02:29 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)