Jump to content
The Uniform Server Community

Changing some code in index.php


mas123
 Share

Recommended Posts

thanks for unformserver team,

I suggest to change the php code of the index.php in the root of the server to the one attached to this post.

to display the server projects(folders) and server php files.

the changes is to put this code after line 86

   <tr><td colspan="3" style="text-align: center;"><h2>Server Projects</h2></td></tr><?php $n = 0;
foreach (scandir("./") as $file){
if (is_dir($file) && !in_array($file, array(".", "..", "css", "images"))){
	$n++;
	echo ($n % 2 == 0 ? "<td>$n - <a href='" . $file . "' target='_blank'>" . $file . "</a></td></tr>" : "<tr><td>$n - <a href='" . $file . "' target='_blank'>" . $file . "</a></td><td></td>");
}
}
echo ($n == 0 ? "<tr><td style='color: red;' colspan='3'>There is no folders in the server root.</td></tr>" : ($n % 2 == 0 ? "" : "<td></td></tr>"));?>
  <tr><td colspan="3" style="text-align: center;"><h2>Server Php Files</h2></td></tr><?php $n = 0;
foreach (scandir("./") as $file){
if (strtolower(strrchr($file, '.'))==".php" ){
	$n++;
	echo ($n % 2 == 0 ? "<td>$n - <a href='" . $file . "' target='_blank'>" . $file . "</a></td></tr>" : "<tr><td>$n - <a href='" . $file . "' target='_blank'>" . $file . "</a></td><td></td>");
}
}
echo ($n == 0 ? "<tr><td style='color: red;' colspan='3'>There is no Php Files in the server root.</td></tr>" : ($n % 2 == 0 ? "" : "<td></td></tr>"));?>

hope to be good for you.

M.A.S

index.zip

Link to comment
Share on other sites

  • 3 months later...

Thanks mas123!

 

This was a good idea. I had seen similar action in another WAMP and had thought of swiping the code.

A modified version of your code is now in 8-Coral www\index.php, and I wanted to give you credit for inspiring it.

 

Regards,

BobS

Link to comment
Share on other sites

  • 1 month later...

It was resolved by copying the CSS and images back to the www folder. Since there were two .htaccess files restricting access, the us_splash copy would disallow access to the css/images, while the www would allow the text.

 

Regards.

BobS

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...