source: trunk/tobeginphp/index.php @ 406

Last change on this file since 406 was 7, checked in by nanardon, 18 years ago
  • init
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head>
3  <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
4  <title>To Begin PHP</title>
5
6
7</head><body>
8<?php if(isset($phpfile)) {
9if ($hf = @fopen($phpfile, "r")) {
10?>
11<h1>Contenu du fichier
12<?php echo $phpfile;
13    ?><hr><?php
14while (!feof($hf)) {
15    $line = fgets($hf);
16    echo htmlentities($line). '<br>';
17}
18?><hr><?php
19pclose($hf);
20} else {
21    ?>Je ne peux pas ouvrir <?php echo $phpfile;
22}
23?><a href="<?php echo $PHP_SELF ?>"> Retour à la liste des fichiers</a><?php
24} else { //si fichier demandé
25?>
26<h1>Liste des fichiers
27pr&eacute;sent:
28</h1>
29
30<?php 
31    if ($hdir = opendir(".")) {
32?>
33<ul>
34
35<?php
36    $files_found = array(); 
37    while(($file = readdir($hdir)) !== false) {
38        if ($file == "index.php")
39            continue;
40        if (substr($file, strlen($file) - 4) != '.php')
41            continue;
42        $files_found[] = $file;
43    }
44    sort($files_found);
45    reset($files_found);
46    foreach($files_found as $file) {
47?>
48
49<li>
50<a href="<?php echo $file?>"><?php echo htmlentities($file) ?></a>
51<a href="<?php echo "$PHP_SELF?phpfile=" . urlencode($file) ?>">voir le source</a>
52</li>
53
54<?php 
55    }
56?>
57</ul>
58
59<?php 
60    closedir($hdir);
61}
62?><?php 
63} // si fichier demandé
64?>
65<br>
66<br>
67<br>
68$Id$
69</body></html>
Note: See TracBrowser for help on using the repository browser.