 | | Offres d'emplois |  | Intégrateur web Société spécialisée dans la Vente par Internet recrute :
Intégrateur Web en CDI
Débutants Passionnés.
Connaissances requises :
- maîtrise d... | |
 | | Avez vous lu ? |  | | |
|
 Créez des fichiers | |  |

<?
//Créez des fichiers
function make_file($file) {
$ch ='';
$txt='';
$tb_info = pathinfo($file);
if(preg_match("[php|txt|inc|asp|htm|html|log]",$tb_info['extension'])) {
if(isset($tb_info['dirname'])) {
$tb_dir = explode("/", $tb_info['dirname']);
}
else {
$tb_dir = '';
$ch .= $tb_info['basename'];
}
}
else {
return ("Le format : " . $tb_info['extension'] . " n'est pas accepté");
exit;
}
if(is_array($tb_dir)) {
$txt .='';
for($i=0;$i<count($tb_dir);$i++) {
$dir = $ch . $tb_dir[$i];
if(!is_dir($dir)) {
if(mkdir($dir, 700)) {
$txt .= 'creation : ' . $dir . '<br>';
$ch .= $tb_dir[$i].'/';
}
}
else {
$txt .= 'Dossier existant : ' . $dir . '<br>';
$ch .= $tb_dir[$i].'/';
}
}
$ch .= $tb_info['basename'];
if(!file_exists($ch)) {
if ($pointeur = fopen($ch, "w+")) {
$txt .= 'creation : ' . $ch;
fwrite($pointeur, $tb_info['basename']);
fclose($pointeur);
}
}
else {
$txt .= 'fichier existant : ' . $ch . '<br>';
}
}
else {
if(!file_exists($ch)) {
if (fopen($ch, "w+")) {
$txt .= 'creation : ' . $ch;
}
}
else {
$txt .= 'fichier existant : ' . $ch . '<br>';
}
}
return $txt;
}
?>
|
|
|
 |
|