[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-clamav-2/www/ -> clamav-cron.php (source)

   1  <?php
   2  
   3  /**
   4  
   5     * Page clamv
   6     * @Version $Id: clamav-cron.php 8567 2015-03-15 14:27:22Z plouf $
   7  
   8     * @Projet LCS / SambaEdu
   9  
  10     * @auteurs
  11  
  12     * @Licence Distribue selon les termes de la licence GPL
  13  
  14     * @note
  15  
  16     */
  17  
  18     /**
  19  
  20     * @Repertoire: /se3-clamav
  21     * file: clamav-cron.php
  22     */
  23  
  24  
  25  require("entete.inc.php");
  26  require  ("ihm.inc.php");
  27  
  28  
  29  
  30  $id=$_GET[id];
  31  $directory=$_POST[directory];
  32  $frequency=$_POST[frequency];
  33  $remove=$_POST[remove];
  34  
  35  if ( isset($_POST['action']))  $cat = $_POST['action'];
  36  elseif ( isset($_GET['action'])) $cat = $_GET['action'];
  37  
  38  // Authorization
  39  if ( is_admin("se3_is_admin",$login)!="Y")  if ( ($uid != $login) || (($uid == $login)&&((!preg_match("//home/$login/", $wrep))&&($consul!=1))))  die (gettext("Vous n'avez pas les droits suffisants pour acc�der � cette fonction")."</BODY></HTML>");
  40  
  41  if ($action == "trash")
  42  {
  43    $query = "DELETE from clamav_dirs WHERE id=".$id;
  44    $result = mysql_query($query);
  45  }
  46  
  47  if ($action == "croncreate")
  48  {
  49    // Recuperation des donnees dans la base SQL
  50   $query = "SELECT * from clamav_dirs ";
  51   $result = mysql_query($query);
  52   //
  53   while ($r=mysql_fetch_array($result)) {
  54     $id = $r["id"];
  55     $frequency="frequency".$id;
  56     $remove="remove".$id;
  57     if (isset ($remove)) {
  58       $remove = "1";
  59       } else {
  60       $remove = "0";
  61       }
  62     $update_query = "UPDATE clamav_dirs SET frequency='$frequency',remove='$remove' WHERE id='$id'";
  63     mysql_query($update_query);
  64   }
  65  } 
  66  
  67  if ($action == "diradd")
  68   {
  69     $query="INSERT into clamav_dirs (directory,frequency,remove) VALUES ('".$directory."','weekly','0')";
  70     mysql_query($query);
  71   }
  72  
  73  //the form
  74  echo '<h1> Solution antivirus serveur</h1>
  75  <h2> Programmation de l\'antivirus </h2>
  76  ';
  77  $query = "SELECT * from clamav_dirs ";
  78  $result = mysql_query($query);
  79  
  80  $form = "<form action=\"clamav-cron.php\" method=\"post\">\n";
  81  
  82  $form .="<table align='center' border='1'>\n";
  83  $form .="<TR><TH class=\"menuheader\"> Programmation de l'antivirus </TH></TR>\n";
  84  $form .="<TR><td><table align='center' border='1'>\n";
  85  $form .="<TR><th class=\"menuheader\"> R&eacute;pertoire </th><th class=\"menuheader\"> p&eacute;riodicit&eacute; du scan </th>";
  86  $form .="<th class=\"menuheader\"> retirer les fichiers (dangeureux)</th></TR>\n";
  87        if (mysql_num_rows($result)==0) {
  88             } else {
  89             while ($r=mysql_fetch_array($result)) {
  90             $none_selected = "";
  91             $lundi_selected ="";
  92             $mardi_selected ="";
  93             $mercredi_selected ="";
  94             $jeudi_selected ="";
  95             $vendredi_selected ="";
  96             $samedi_selected ="";
  97             $dimanche_selected ="";
  98             $daily_selected="";
  99             $weekly_selected="";
 100             switch ($r["frequency"]) {
 101               case "none":$none_selected = "selected";
 102                 break;
 103               case "lundi":$lundi_selected ="selected";
 104                 break;
 105               case "mardi":$mardi_selected ="selected";
 106                break;
 107               case "mercredi":$mercredi_selected ="selected";
 108                break;
 109               case "jeudi":$jeudi_selected ="selected";
 110                break;
 111               case "vendredi":$vendredi_selected ="selected";
 112                break;
 113               case "samedi":$samedi_selected ="selected";
 114                break;
 115               case "dimanche":$dimanche_selected ="selected";
 116                break;
 117               case "daily":$daily_selected ="selected";
 118                break;
 119               case "weekly":$weekly_selected="selected";
 120                 break;
 121              }
 122              $form .="<tr><td align=\"left\">";
 123              $form .="<a href='clamav-cron.php?action=trash&amp;id=".$r['id']."'>\n";
 124              $form .="<img src='/elements/images/edittrash.png' border='0' alt='Supprimer' title='Supprimer'>\n";
 125              $form .="</a>\n";
 126              $form .= $r['directory']."</td>\n";
 127              $form .="<td  align=\"center\" ><select name=\"frequency".$r['id']."\"> \n";
 128              $form .="<option value=\"none\" $none_selected> Pas de scan </option> \n";
 129              $form .="<option value=\"lundi\" $lundi_selected> Scan lundi soir </option> \n";
 130              $form .="<option value=\"mardi\" $mardi_selected> Scan mardi soir </option> \n";
 131              $form .="<option value=\"mercredi\" $mercredi_selected> Scan mercredi soir </option> \n";
 132              $form .="<option value=\"jeudi\" $jeudi_selected> Scan jeudi soir </option> \n";
 133              $form .="<option value=\"vendredi\" $vendredi_selected> Scan vendredi soir </option> \n";
 134              $form .="<option value=\"samedi\" $samedi_selected> Scan samedi soir </option> \n";
 135              $form .="<option value=\"dimanche\" $dimanche_selected> Scan dimanche soir </option> \n";
 136              $form .="<option value=\"daily\" $daily_selected> Scan quotidien </option> \n";
 137              $form .="<option value=\"weekly\" $weekly_selected> Scan hebdomadaire </option> \n";
 138              $form .="</select></td>\n";
 139              if ($r['remove'] == 0 ) { $remove_selected=""; } else {$remove_selected ="checked";}
 140              $form .="<td class=\"menucell\"  align=\"center\" > Suppression des virus (dangereux) <input type=\"checkbox\" name=\"remove".$r['id']."\" value=\"remove".$r['id']."\" $remove_selected /><br/> \n";
 141              }
 142  $form .= "</table></td></tr>\n";
 143  
 144  $form .="<tr><td align='right'><input type='hidden' name='action' value='croncreate'>\n";
 145  $form.="<input type=\"submit\" value=\"Valider\"></td></tr>\n";
 146  $form .= "</table>\n";
 147  $form.="</form>\n";
 148  
 149  }
 150  
 151  echo $form;
 152  
 153  
 154  $form = "<form action=\"clamav-cron.php\" method=\"post\">\n";
 155  $form .="<table align='center' border='1'>\n";
 156  $form .="<TR><TH> Ajout de r&eacute;pertoire </TH></TR>\n";
 157  $form .="<TR><TD>R&eacute;pertoire &agrave; ajouter : <input type=\"text\" name=\"directory\" value=\"\"> 
 158  </TD></TR>";
 159  $form .= "</table>\n";
 160  $form .= "<input type=\"hidden\" name=\"action\" value=\"diradd\">";
 161  $form .= "<input type=\"submit\" value=\"Ajouter\">";
 162  $form.="</form>\n";
 163  
 164  
 165  echo $form;
 166  
 167  
 168  require ("pdp.inc.php");
 169  ?>


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1