1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
<?php
$heure=$_GET["heure"];
$numero=$_GET["numero"];
$minute=$_GET["minute"];
$annee=$_GET["annee"];
$mois=$_GET["mois"];;$jour=$_GET["jour"];
if(file_exists('/var/www/clients/client'.$numero.'.txt'))
{
unlink('/var/www/clients/client'.$numero.'.txt');
unlink('/home/charles/scripts/client'.$numero.'txt');
}
// on cree
if(!file_exists('/var/www/clients/client'.$numero.'.txt'))
{
touch('/var/www/clients/client'.$numero.'.txt');
//Ouverture du fichier en lecture et ecriture
$file = fopen('/var/www/clients/client'.$numero.'.txt', 'r+');
//Et on écrit dans le fichier
fwrite($file,"allo");
//Fermeture du fichier
fclose($file);
//Creation du fichier bash
$msg="mv /var/www/clients/client$numero /home/charles/doc/";
touch('/home/charles/scripts/client'.$numero);
//Ouverture du fichier en lecture et ecriture
$file1 = fopen('/home/charles/scripts/client'.$numero, 'r+');
//Et on écrit dans le fichier batch la commande à executer
fwrite($file1,$msg);
fclose($file1);
//Rendre le fichier executable
exec('/bin/chmod a+x /home/charles/scripts/client'.$numero);
//Execution de la commande at
if(exec(' /usr/bin/at -f /home/charles/scripts/client'.$numero.' ' .$heure.':'.$minute.' '.$mois.''.$jour.''.$annee.''))
{echo 'ok';} else {echo 'ko';}
}
?> |
Partager