コード例 #1
0
function compteur($currentPath = '..')
{
    global $nbLines, $nbrPage, $nbrLignes, $nbrCaractere, $nbrImg, $arrayImg, $arrayFiles;
    $dirsInDir = array();
    $filesInDir = array();
    if ($recup = opendir($currentPath)) {
        while (false !== ($file = readdir($recup))) {
            if ($file != "." && $file != "..") {
                $path = $currentPath . '/' . $file;
                if (is_dir($path)) {
                    if (substr_count($path, '.git') == 0 && substr_count($path, 'download') == 0 && substr_count($path, 'jquery') == 0 && substr_count($path, 'forum') == 0) {
                        $dirsInDir[] = $path;
                    }
                } else {
                    $filesInDir[] = $file;
                }
            }
        }
    }
    closedir($recup);
    $nbFiles = count($filesInDir) > 0;
    $nbDirs = count($dirsInDir) > 0;
    if ($nbFiles || $nbDirs) {
        // Si des fichiers existent
        if ($nbFiles) {
            foreach ($filesInDir as $file) {
                $pathinfo = pathinfo($file);
                //gif, jpg, jpeg, psd, png
                if (isset($pathinfo['extension']) && in_array($pathinfo['extension'], $arrayImg)) {
                    $nbrImg++;
                    // php js css html
                } elseif (isset($pathinfo['extension']) && in_array($pathinfo['extension'], $arrayFiles)) {
                    $nbrPage++;
                    $contenuFichier = file_get_contents($currentPath . '/' . $file);
                    // nbr ligne
                    $nbrLignes += count(file($currentPath . '/' . $file));
                    // nbr caractère
                    $nbrCaractere += strlen($contenuFichier);
                } else {
                    $nbrPage++;
                    echo 'Non Classé =>' . $currentPath . '/' . $file . '<br />';
                }
            }
        }
        // Si des dossiers existent
        if ($nbDirs) {
            // Tri inverse
            rsort($dirsInDir);
            foreach ($dirsInDir as $dir) {
                compteur($dir);
            }
        }
    }
}
コード例 #2
0
   | along with AdminBot; if not, write to the Free Software Foundation, |
   | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA       |
   |                                                                     |
   +---------------------------------------------------------------------+
   | Authors: Li0n  <*****@*****.**>                               |
   |          RV <*****@*****.**>                                    |
   |          Gougou                                                     |
   +---------------------------------------------------------------------+
*/
if (eregi("header.inc.php", $_SERVER['PHP_SELF'])) {
    die("You cannot open this page directly");
}
/*<script lang="Javascript"><?php include('include/javascript.inc.php');?></script>*/
/*** Benchmark ***/
$time_start = getmicrotime();
$compteur = compteur();
//<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
//http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd>
?>
<html>
<head>
<title><?php 
echo 'phpTournois - ' . $config['nomsite'];
?>
</title>
<link rel="shortcut icon" href="/images/transparent.ico" />
<META NAME="TITLE" CONTENT="phpTournois">
<META NAME="DESCRIPTION" CONTENT="Outil en php d'aide dans la gestion de tournois, de lan party">
<META NAME="KEYWORDS" CONTENT="php, gestion, tournoi, tournois, lan, management, manager, lan party, tournament, organisation, ladder, ligue, league, coupe, championnat">
<META NAME="OWNER" CONTENT="phpTournois - phpTG4">
<META NAME="AUTHOR" CONTENT="RV, Li0n, Gectou4">
コード例 #3
0
 static function insertReservation($id)
 {
     global $bdd;
     // -- Insertion --
     $idResa = compteur('idReservation');
     $requete = $bdd->prepare('INSERT INTO reservations (id_reservation, id_admin, id_etat, debut_reservation, fin_reservation, terminer_reservation) VALUES (:idResa, :id, 1, NOW(), DATE_ADD(NOW(), INTERVAL 15 DAY), false) ;');
     $requete->bindParam(':id', $id, PDO::PARAM_INT);
     $requete->bindParam(':idResa', $idResa, PDO::PARAM_STR);
     $requete->execute();
     return $idResa;
 }