<?
include "header.php";
if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "settings"; }
$results = "";

if($task == "settings_do") {
$user_head1 = str_replace("</textarea>", "&lt;/textarea>", $_POST['user_head1']);
$user_head2 = str_replace("</textarea>", "&lt;/textarea>", $_POST['user_head2']);
$user_foot = str_replace("</textarea>", "&lt;/textarea>", $_POST['user_foot']);

mysql_query("UPDATE ims_admin SET
user_head1 = '$user_head1',
user_head2 = '$user_head2',
user_foot = '$user_foot'
");

$admin_info = mysql_fetch_assoc(mysql_query("SELECT * FROM ims_admin"));
$results = "<b><br>Your changes have been saved.<br></b>";
}


echo $header;

echo "
<b>HTML Settings</b><br>
Use this page to modify your header/footer HTML.
If you would like to change the CSS stylesheet (styles.css),
please locate it inside your base directory and edit it manually.
<br>$results<br>

<table cellpadding='0' cellspacing='0' width='500'>
<form action='settings_html.php' method='POST'>
<tr>
<td NOWRAP width='200' valign='top'><b>Header (HTML)</b><br>(between the &#060;head&#062;&#060;/head&#062; tags)</td>
<td><textarea name='user_head1' rows='15' cols='45'>$admin_info[user_head1]</textarea></td>
</tr>
<tr>
<td NOWRAP width='200' valign='top'><b>Header (HTML)</b><br>(just after the &#060;body&#062 tag)</td>
<td><textarea name='user_head2' rows='15' cols='45'>$admin_info[user_head2]</textarea></td>
</tr>
<tr>
<td NOWRAP width='200' valign='top'><b>Footer (HTML)</b><br>(just before the &#060;/body&#062; tag)</td>
<td><textarea name='user_foot' rows='15' cols='45'>$admin_info[user_foot]</textarea></td>
</tr>
</table>

<br>

<table cellpadding='0' cellspacing='0'>
<tr><td>
<input class='button' type='submit' value='Save Changes'>
<input type='hidden' name='task' value='settings_do'>
</td>
</tr>
</form>
</table>
";

echo $footer;
?>