<?php
// +------------------------------------------------------------------------+
// | PHP Melody version 1.6.7 ( www.phpsugar.com )
// +------------------------------------------------------------------------+
// | PHP Melody IS NOT FREE SOFTWARE
// | If you have downloaded this software from a website other
// | than www.phpsugar.com or if you have received
// | this software from someone who is not a representative of
// | phpSugar, you are involved in an illegal activity.
// | ---
// | In such case, please contact: support@phpsugar.com.
// +------------------------------------------------------------------------+
// | Developed by: phpSugar (www.phpsugar.com) / support@phpsugar.com
// | Copyright: (c) 2004-2011 PhpSugar.com. All rights reserved.
// +------------------------------------------------------------------------+

$showm = '10';
include('header.php');
?>
<div id="sub_menu">
<ul>
<li><a href="sys_phpinfo.php">PHP Configuration</a></li>
<li><a href="readlog.php">Internal Log</a></li>
<li><a href="db_backup.php?restart=1">Backup Database</a></li>
</ul>
</div>
<div id="content">
<h2>PHP Configuration</h2>
<?php echo $info_msg; ?>
<br />
<?php
ob_start();
phpinfo();
$contents = ob_get_clean();

$phpinfo = array('phpinfo' => array());

if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', $contents, $matches, PREG_SET_ORDER))
{
	foreach($matches as $match)
	{
        if(strlen($match[1]))
            $phpinfo[$match[1]] = array();
        elseif(isset($match[3]))
            $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
        else
            $phpinfo[end(array_keys($phpinfo))][] = $match[2];
	}
}

$phpcore = (array_key_exists('PHP Core', $phpinfo)) ? 'PHP Core' : 'Core';

?>
<div class="info_msg">
	Listed in the table below are some of the most important PHP Configuration directives.	
</div>
<table class="tablesorter" cellspacing="1" cellpadding="0">
 <thead>
  <tr>
   <th width="25%">Directive</th>
   <th>Value</th>
  </tr>
 </thead>
 <tbody>
	<tr>
		<td>System</td>
		<td><?php echo "{$phpinfo['phpinfo']['System']}";?></td>
	</tr>
	<tr>
		<td>Safe Mode</td>
		<td><?php echo "{$phpinfo[$phpcore]['safe_mode'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Allow URL fopen</td>
		<td><?php echo "{$phpinfo[$phpcore]['allow_url_fopen'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Curl Support</td>
		<td><?php echo "{$phpinfo['curl']['cURL support']}"; ?></td>
	</tr>
	<tr>
		<td>Display Errors</td>
		<td><?php echo "{$phpinfo[$phpcore]['display_errors'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Display Startup Errors</td>
		<td><?php echo "{$phpinfo[$phpcore]['display_startup_errors'][0]}"; ?></td>
	</tr>
	<tr>
		<td>File Uploads</td>
		<td><?php echo "{$phpinfo[$phpcore]['file_uploads'][0]}"; ?></td>
	</tr>
	<tr>
		<td>File Post Size (post_max_size)</td>
		<td><?php echo "{$phpinfo[$phpcore]['post_max_size'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Max File Size Upload (upload_max_filesize)</td>
		<td><?php echo "{$phpinfo[$phpcore]['upload_max_filesize'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Server Name</td>
		<td><?php echo "{$phpinfo['Apache Environment']['SERVER_NAME']}"; ?></td>
	</tr>
	<tr>
		<td>Document Root</td>
		<td><?php echo "{$phpinfo['Apache Environment']['DOCUMENT_ROOT']}"; ?></td>
	</tr>
	<tr>
		<td>HTTP Accept charset</td>
		<td><?php echo "{$phpinfo['Apache Environment']['HTTP_ACCEPT_CHARSET']}"; ?></td>
	</tr>
	<tr>
		<td>GD Library</td>
		<td><?php echo "{$phpinfo['gd']['GD Support']}"; ?></td>
	</tr>
	<tr>
		<td>GD Library Version</td>
		<td><?php echo "{$phpinfo['gd']['GD Version']}"; ?></td>
	</tr>
	<tr>
		<td>GIF Read Support</td>
		<td><?php echo "{$phpinfo['gd']['GIF Read Support']}"; ?></td>
	</tr>
	<tr>
		<td>GIF Create Support</td>
		<td><?php echo "{$phpinfo['gd']['GIF Create Support']}"; ?></td>
	</tr>
	<tr>
		<td>JPEG Support</td>
		<td><?php echo "{$phpinfo['gd']['JPEG Support']}"; ?></td>
	</tr>
	<tr>
		<td>PNG Support</td>
		<td><?php echo "{$phpinfo['gd']['PNG Support']}"; ?></td>
	</tr>
	<tr>
		<td>Session Support</td>
		<td><?php echo "{$phpinfo['session']['Session Support']}"; ?></td>
	</tr>
	<tr>
		<td>Session Save Path</td>
		<td><?php echo "{$phpinfo['session']['session.save_path'][0]}"; ?></td>
	</tr>
	<tr>
		<td>Apache mod_rewrite</td>
		<td><?php echo (strstr($phpinfo['apache2handler']['Loaded Modules'],'mod_rewrite')) ? "enabled" : "disabled"; ?></td>
	</tr>
 </tbody>
</table>
</div>
<?php
include('footer.php');
?>