<?php
$UWAMPFOLDER="../../";


//CODE TO ENCODE IMAGE IN PHP FILE
/*
$fp = fopen("favicon.ico",'r');
$data = fread ($fp, filesize ("favicon.ico"));
fclose ($fp);
echo base64_encode($data);
exit;
*/



if (isset($_REQUEST['getimg']))
{
	$IMAGE_FAVICON="[encoded data, 7240 characters]";
	$IMAGE_FOLDER="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLxZO7ihRBFIa/6u0ZW7GHBUV0UQQTZzd3QdhMQxOfwMRXEANBMNQX0MzAzFAwEzHwARbNFDdwEd31Mj3X7a6uOr9BtzNjYjKBJ6nicP7v3KqcJFaxhBVtZUAK8OHlld2st7Xl3DJPVONP+zEUV4HqL5UDYHr5xvuQAjgl/Qs7TzvOOVAjxjlC+ePSwe6DfbVegLVuT4r14eTr6zvA8xSAoBLzx6pvj4l+DZIezuVkG9fY2H7YRQIMZIBwycmzH1/s3F8AapfIPNF3kQk7+kw9PWBy+IZOdg5Ug3mkAATy/t0usovzGeCUWTjCz0B+Sj0ekfdvkZ3abBv+U4GaCtJ1iEm6ANQJ6fEzrG/engcKw/wXQvEKxSEKQxRGKE7Izt+DSiwBJMUSm71rguMYhQKrBygOIRStf4TiFFRBvbRGKiQLWP29yRSHKBTtfdBmHs0BUpgvtgF4yRFR+NUKi0XZcYjCeCG2smkzLAHkbRBmP0/Uk26O5YnUActBp1GsAI+S5nRJJJal5K1aAMrq0d6Tm9uI6zjyf75dAe6tx/SsWeD//o2/Ab6IH3/h25pOAAAAAElFTkSuQmCC";
	$IMAGE_TITLE="[encoded data, 8160 characters]";
		
	switch ($_GET['getimg'])
    {
		case 'folder' :        
			header("Content-type: image/png");
			echo base64_decode($IMAGE_FOLDER);
        break;
		case 'title' :        
			header("Content-type: image/png");
			echo base64_decode($IMAGE_TITLE);
        break;
		case 'favicon' :        
			header("Content-type: image/x-icon");
			echo base64_decode($IMAGE_FAVICON);
        break;
	}
	
	exit();
}

?>

<html>
<head>
<title>UwAmp</title>
<link rel="shortcut icon" type="image/x-icon" href="./?getimg=favicon" /> 
<style type="text/css"> 
body
{
	position:relative;
	background-color: #FFFFFF;		
	font-family:"Trebuchet MS", Verdana;
	font-size: 10pt;
	text-align: left;
	margin: 0px;
	padding: 0px;
}

.mainblock
{
	padding:50px;
	border : solid 1px #DDDDDD;	
	background-color: #F5F5F5;
	width:798px;
	text-align:left;
}

a
{
	color: #014579;
	font-weight: bold;
	text-decoration: none;	
}

.afolder
{
	color: #014579;
	font-weight:bold;
	text-decoration: none;	
	background: url(./?getimg=folder) no-repeat left;
	padding-left:30px;
}

hr
{
	color: #DDDDDD;
	background-color: #DDDDDD;
	height: 1px;
	border: 0;
}

</style> 

</head>
<body>
<center>

<img src="./?getimg=title" />
<div class="mainblock">

<h2>Apache Work Fine!!!</h2>
<hr>
<h2>Configuration Setting</h2>
<li>Apache version : <?php echo $_SERVER['SERVER_SOFTWARE']; ?></li>
<li><a href="/mysql/">PHPMyAdmin</a></li>
<li><a href="/uwamp/phpinfo.php">PHP Info</a></li>
<br><br><hr>

<h2>Alias</h2>
<?php
$apacheconffile=$UWAMPFOLDER."bin/apache/conf/httpd.conf";
if (!file_exists ( $apacheconffile ))
{
	echo "Can't find Apache config file (httpd.conf)";
}
else
{
	$fp = fopen($apacheconffile,'r');
	$data = fread ($fp, filesize ($apacheconffile));
	fclose ($fp);	
	preg_match_all("/Alias[\\t ]*\"([^\"\']+)\"[\\t ]\"([^\"\']+)\"/i",$data,$matches,PREG_SET_ORDER);	
	foreach ($matches as $val)
	{
		echo "<li><a class=\"afolder\" href=\"$val[1]\">$val[1]</a></li>";
	}
}

?>

<h2>Projects</h2>
<?php
$handle=opendir($UWAMPFOLDER."www");
$count=0;
while ($file = readdir($handle)) 
{
	if ($file=="." || $file=="..") continue;
	if (is_dir($file))
	{		
		$count++;
		echo "<li><a class=\"afolder\" href=\"/$file\">$file</a></li>";
	}
}
closedir($handle);
if ($count==0)
{
	echo "No project found";
}
?>

<br><br>
<hr>
<center><a href="http://www.uwamp.com">UwAmp Home</a> - <a href="http://www.uwamp.com/wiki/">UwAmp Wiki</a></center>


</div>
</center>

</body>
</html>