Commit e6a77210 authored by Cellophile's avatar Cellophile 🎨
Browse files

Replace fonctions.php

parent a5134eff
......@@ -34,13 +34,13 @@ function uniciteurl($verif,$srcfichiercsv) {
}
}
function creer($upersok,$urlbase,$srcfichiercsv){
function creer($urlsite,$upersok,$urlbase,$mdp,$datexpi,$timexpi,$srcfichiercsv){
// Puis on enregistre cette url dans le doc csv:
if ($returnerror==0){
$list = array(
array ($upersok, $urlbase)
array ($upersok, $urlbase, $datexpi, $timexpi)
);
$fp = fopen($srcfichiercsv, "ab");
foreach ($list as $field){
......@@ -62,16 +62,34 @@ function creer($upersok,$urlbase,$srcfichiercsv){
fclose($lecture);
// Ensuite on crée un fichier php pour établir la retirection :
$nfphp = __DIR__ . '/d/'.$upersok.'.php';
$fichieredirect = fopen($nfphp, "w");
fwrite($fichieredirect, "<?php
header('Status: 301 Moved Permanently', false, 301);
header('Location: ".$urlbase."');
exit();
?>");
fclose($fichieredirect);
if ($mdp !== false) {
$nfphp = __DIR__ . '/d/'.$upersok.'.php';
$fichieredirect = fopen($nfphp, "w");
$infoa = "$"."lecturetest";
$infob = "$"."mdpstock";
$infoc = "$"."urlredirect";
fwrite($fichieredirect, "<?php
if (!empty($infoa)){
$infob = '$mdp';
$infoc = '$urlbase';
return;
}else{
header('Status: 301 Moved Permanently', false, 301);
header('Location: ".$urlsite."password.php?redirect=".$upersok."');
exit();
}
?>");
fclose($fichieredirect);
}else{
$nfphp = __DIR__ . '/d/'.$upersok.'.php';
$fichieredirect = fopen($nfphp, "w");
fwrite($fichieredirect, "<?php
header('Status: 301 Moved Permanently', false, 301);
header('Location: ".$urlbase."');
exit();
?>");
fclose($fichieredirect);
}
// on lit ce qu'on vient d'écrire :
$relecture = fopen($nfphp, "r");
......@@ -84,4 +102,14 @@ function creer($upersok,$urlbase,$srcfichiercsv){
return $retour;
}
}
function fichiertemp ($fichiertemp, $upersoval, $ubaseval, $datexpi, $heurexpi){
$list = array(
array ($upersoval, $ubaseval, $datexpi, $heurexpi));
$ftemp = fopen($fichiertemp, "ab");
foreach ($list as $field){
fputcsv($ftemp, $field);
}
fclose($ftemp);
}
?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment