Skip to content
Snippets Groups Projects
Commit 46672df4 authored by Gael PICOT's avatar Gael PICOT
Browse files

nétoyage des fichier temporaire automatique.

parent 7dea4e31
No related branches found
No related tags found
No related merge requests found
<?php
const TIME_TO_LIVE = 3600;
$tmpFiles = scandir('tmp');
foreach($tmpFiles as $tmpFile) {
if($tmpFile!='.'&&$tmpFile!='..') {
if(TIME_TO_LIVE <= time()-filemtime('tmp/'.$tmpFile)) {
unlink('tmp/'.$tmpFile);
function cleanOldFile() {
$tmpFiles = scandir('tmp');
foreach($tmpFiles as $tmpFile) {
if($tmpFile!='.'&&$tmpFile!='..') {
if(TIME_TO_LIVE <= time()-filemtime('tmp/'.$tmpFile)) {
unlink('tmp/'.$tmpFile);
}
}
}
}
......
......@@ -24,6 +24,8 @@
session_start();
require('halRequestBuilder.php');
require('clean.php');
cleanOldFile();
if(!isset($_SESSION['personalKey'])) {
$_SESSION['personalKey'] = bin2hex(random_bytes(20));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment