-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.php
More file actions
37 lines (30 loc) · 855 Bytes
/
router.php
File metadata and controls
37 lines (30 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
//var_dump( $_SERVER );
$sPath = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$sHttp = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if( substr( $sPath, -1 ) != '/' ){
$sPath .= '/';
}
if( substr( $sHttp, -1 ) != '/' ){
$sHttp .= '/';
}
if( file_exists( $sPath ) && is_dir( $sPath )
// && !file_exists( $sPath . 'index.php' )
) {
echo "<html><head><meta charset='utf-8'></head><body>";
echo '<h2>'.$sPath.'</h2>';
echo '<h2>'.$sHttp.'</h2>';
echo '<ul>';
foreach( scandir( $sPath ) as $sEntry ) {
if( $sEntry == '.' ){
continue;
}
echo ' <li><a href="'. $sHttp . $sEntry .'">'. $sEntry .'</a></li>';
}
echo '</ul>';
echo '<div style="font-size: 11px; margin-top: 50px; border-top: 1px solid">php '. phpversion() .'</div>';
echo '</body>';
}
else {
return false;
}