<?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 = '8';
include('header.php');

$current_counter = stripslashes($config['counterhtml']);

if(!empty($_POST['submit'])) 
{
	
	if (get_magic_quotes_gpc())
	{
		$htmlcode = stripslashes($_POST['htmlcode']);
	}
	else
	{
		$htmlcode = $_POST['htmlcode'];
	}
	
	//$htmlcode = mysql_real_escape_string($htmlcode);
	$htmlcode = str_replace("'", "\'", $htmlcode);

	$result = update_config('counterhtml', $htmlcode);
	
	if(is_array($result))
	{
		$info_msg = '<div class="info_msg_err">There was a problem while updating your database!<br /><b>'.$result[0].'</b></div>'; 
	}
	else
	{
		$info_msg = '<div class="info_msg_ok">The html code for your counter has been saved.</div>'; 
	}
	$current_counter = stripslashes($htmlcode);

} 
else 
{
	$info_msg = '<div class="info_msg">You can paste in the html code of your favorite counter or website tracking service (Google Analytics, Sitemeter.com, etc.)</div>';
}

?>
<div id="sub_menu">
<li><a href="password.php">Update admin password</a></li>
<li><a href="add_tracking.php">Manage counter</a></li>

<li><a href="sitemap.php" class="hintanchor" onMouseover="showhint('This may take some time. After clicking this link please wait for the sitemap to be generated.', this, event, '250px')">Generate Sitemap</a></li>	
<li><a href="video-sitemap.php">Generate Video Sitemap</a></li>
</div>
<div id="content">
<h2>Add website counter</h2>
<?php echo $info_msg; ?>
<table width="100%" border="0" cellspacing="2" cellpadding="5">
  <tr>
    <td>
	<form name="form" method="post" action="add_tracking.php">
	<textarea name="htmlcode" cols="60" rows="7"><?php echo $current_counter; ?></textarea>
	<br />
	<input type="submit" name="submit" value="Save" class="inputbutton" />
	</form>
	</td>
    </tr>
</table>
<br />
</div>
<?php
include('footer.php');
?>