<?php
//EDIT SINGLE NOTE
require("../config/config.php");
require("../includes/check_login.inc.php");
require("../includes/mysql_db_connect.inc.php");
require("../includes/get_group_info.inc.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title><?php echo($title); ?></title>
<link href="../global_elements/athena.css" rel="stylesheet" media="screen">
<meta http-equiv="expires" CONTENT="1996-01-01">
</head>
<body bgcolor="#FFFFFF">
<table width="100%" border="0">
<tr>
<td>
<?
//echo("<p>" . $_SESSION["userGROUPID"] . "</p>");
$itemID = $_GET["id"];
if ($_GET["type"] == "note"){
//BEGIN CHECK OWNER
$getNOTEgroup = mysql_query("SELECT * FROM ath_notes WHERE ath_notes_id=$itemID");
if (!$getNOTEgroup){
echo("<p class=\"red\">getNOTEgroup failed in editSINGLE.php</p>");
echo(mysql_error());
exit();
}
$ROWgetNOTEgroup = mysql_fetch_array($getNOTEgroup);
//END CHECK OWNER
if ($ADMINISTRATE == 1 or $ROWgetNOTEgroup["ath_notes_ownerGROUP"] == $_SESSION["userGROUPID"]){ //VERIFY OWNERSHIP
if ($_POST["update"] == "Submit changes"){
$text = addslashes(nl2br($_POST["text"]));
$heading = addslashes(nl2br($_POST["heading"]));
$sql = mysql_query( "UPDATE ath_notes SET " .
"ath_notes_heading='$heading', " .
"ath_notes_text='$text' " .
"WHERE ath_notes_id=$itemID");
if (!$sql){
echo("<p class=\"red\">update failed in editSINGLEnote.php</p>");
echo(mysql_error());
exit();
}
//GET NOTE DATA
$getNOTES = mysql_query("SELECT * FROM ath_notes WHERE ath_notes_id=$itemID");
if (!$getNOTES){
echo("<p class=\"red\">getNOTES failed in editSINGLEnote.php</p>");
echo(mysql_error());
exit();
}
$ROWgetNOTES = mysql_fetch_array($getNOTES);
echo("<p class=\"green\">Changes done.</p>");
//echo("<p><b>" . strip_tags(stripslashes($ROWgetNOTES["ath_notes_heading"])) . "</b></p>");
//echo("if updated");
echo("<form action=\"editSINGLE.php?type=" . $_GET["type"] . "&id=" . $itemID . "\" method=\"post\">");
echo("<input type=\"text\" maxsize=\"255\" size=\"33\" name=\"heading\" value=\"" . $ROWgetNOTES["ath_notes_heading"] . "\" size=\"24\" border=\"0\"><br><br>");
echo("<textarea name=\"text\" rows=\"12\" cols=\"45\">" . strip_tags(stripslashes($ROWgetNOTES["ath_notes_text"])) . "</textarea>");
echo("<p><input type=\"submit\" name=\"update\" value=\"Submit changes\" border=\"0\"> <input type=\"button\" name=\"close\" value=\"Close\" onClick=\"window.close();\" border=\"0\"></p>");
echo("</form>");
}
else{
//GET NOTE DATA
$getNOTES = mysql_query("SELECT * FROM ath_notes WHERE ath_notes_id=$itemID");
if (!$getNOTES){
echo("<p class=\"red\">getNOTES failed in editSINGLEnote.php</p>");
echo(mysql_error());
exit();
}
$ROWgetNOTES = mysql_fetch_array($getNOTES);
//echo("<p><b>" . strip_tags(stripslashes($ROWgetNOTES["ath_notes_heading"])) . "</b></p>");
//echo("just showing");
echo("<form action=\"editSINGLE.php?type=" . $_GET["type"] . "&id=" . $itemID . "\" method=\"post\">");
echo("<input type=\"text\" maxsize=\"255\" size=\"33\" name=\"heading\" value=\"" . $ROWgetNOTES["ath_notes_heading"] . "\" size=\"24\" border=\"0\"><br><br>");
echo("<textarea name=\"text\" rows=\"12\" cols=\"45\">" . strip_tags(stripslashes($ROWgetNOTES["ath_notes_text"])) . "</textarea>");
echo("<p><input type=\"submit\" name=\"update\" value=\"Submit changes\" border=\"0\"> <input type=\"button\" name=\"close\" value=\"Close\" onClick=\"window.close();\" border=\"0\"></p>");
echo("</form>");
}
}
else{
echo("<p class=\"red\">You are not allowed to view this item!</p>");
}
}
if ($_GET["type"] == "resrc"){
echo("resrc");
}
?>
</td>
</tr>
</table>
</body>
</html>