QUOTE
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, server@xisto.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, server@xisto.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
This only happens when I am trying to submit my new announcement to my mysql database. All of my other queries seem to work perfectly fine on the site, so I was wondering if it could perhaps be a coding error on my part? (Although it does work fine on my home computer, when tested.)
Below is a snippet of the code for the announcement changing:
CODE
<?php
session_start();
/*
*
* My Includes
*
*
*/
$PAGE_OUT = Linkage();
// "Linkage()" is just a function that returns navigation links for the logged-in user
Login_Only();
/*
* Just a function that destroys an existing session
* and re-directs user to login page if the user is
* not logged in (determined by a $_SESSION variable)
*/
if (@$_POST['announce_submit'] != "") {$_POST['status'] = "new announcement";}
if (@$_POST['announce_exec'] != "") {$_POST['status'] = "exec announcement";}
// $_POST['status'] keeps track of the actions performed on my pages
// If the "Change Announcement" submit was clicked, it
// loads a textarea to enter a new announcement in.
//
// If the "Submit New Announcement" in that page was clicked,
// it enters the new announcement into the database.
if ($_POST['status'] == "exec announcement")
{
/*
* If a new announcement was submitted, first check to see if the
* line breaks are to be changed to HTML Line Break elements.
* "_Announcement_Insertion()" takes the submission and adds line
* breaks and escapes the entire string.
* Finally, update the table that holds the Admin/Default information.
*/
if (@$_POST['f_line_breaks'] == "TRUE") {$breaks = TRUE;} else {$breaks = FALSE;}
$_announcement = _Announcement_Insertion($_POST['f_announcement'], $breaks);
$update_query = "UPDATE admin SET announcement='$_announcement'";
$update_result = mysql_query($update_query) or die ("Couldn't execute query:<BR>$update_query");
$_POST['message'] = "Announcements have been Updated";
}
if ($_POST['status'] == "new announcement")
{
/*
* Get the old announcement from the database and display it in the TEXTAREA.
* Display a submit button.
* --($COLUMN1 is part of what later gets assigned to my $PAGE_OUT variable,
* -- which is echoed near the end of the script to the browser.)
*/
$get_announce_query = "SELECT * FROM admin";
$get_announce_result = mysql_query($get_announce_query) or die ("Couldn't execute query:<BR>$get_announce_query");
$get_announce_row = mysql_fetch_array($get_announce_result, MYSQL_ASSOC);
extract($get_announce_row);
$COLUMN1_OUT .= "
<FORM NAME='Announcement' METHOD='POST' ACTION='index.php'>
<TEXTAREA NAME='f_announcement' COLS='42' ROWS='12'>$announcement</TEXTAREA>
<INPUT TYPE='checkbox' NAME='f_line_breaks' VALUE='TRUE'>Blank lines to <BR> elements<BR>
<INPUT TYPE='submit' NAME='announce_exec' VALUE='Submit New Announcement'>
</FORM>";
}
$PAGE_OUT .= $COLUMN1; // (and other stuff)
echo Write_HTML($PAGE_OUT);
// Write_HTML() is in my main include to give default values on title, background, etc.
// -- $PAGE_OUT, again, is the actual HTML outputted.
function _Announcement_Insertion($value, $breaks)
{
$value = Escape($value);
if ($breaks) {$value = Line_Breaks_to_HTML($value);}
return $value;
}
// unrelated functions
?>
session_start();
/*
*
* My Includes
*
*
*/
$PAGE_OUT = Linkage();
// "Linkage()" is just a function that returns navigation links for the logged-in user
Login_Only();
/*
* Just a function that destroys an existing session
* and re-directs user to login page if the user is
* not logged in (determined by a $_SESSION variable)
*/
if (@$_POST['announce_submit'] != "") {$_POST['status'] = "new announcement";}
if (@$_POST['announce_exec'] != "") {$_POST['status'] = "exec announcement";}
// $_POST['status'] keeps track of the actions performed on my pages
// If the "Change Announcement" submit was clicked, it
// loads a textarea to enter a new announcement in.
//
// If the "Submit New Announcement" in that page was clicked,
// it enters the new announcement into the database.
if ($_POST['status'] == "exec announcement")
{
/*
* If a new announcement was submitted, first check to see if the
* line breaks are to be changed to HTML Line Break elements.
* "_Announcement_Insertion()" takes the submission and adds line
* breaks and escapes the entire string.
* Finally, update the table that holds the Admin/Default information.
*/
if (@$_POST['f_line_breaks'] == "TRUE") {$breaks = TRUE;} else {$breaks = FALSE;}
$_announcement = _Announcement_Insertion($_POST['f_announcement'], $breaks);
$update_query = "UPDATE admin SET announcement='$_announcement'";
$update_result = mysql_query($update_query) or die ("Couldn't execute query:<BR>$update_query");
$_POST['message'] = "Announcements have been Updated";
}
if ($_POST['status'] == "new announcement")
{
/*
* Get the old announcement from the database and display it in the TEXTAREA.
* Display a submit button.
* --($COLUMN1 is part of what later gets assigned to my $PAGE_OUT variable,
* -- which is echoed near the end of the script to the browser.)
*/
$get_announce_query = "SELECT * FROM admin";
$get_announce_result = mysql_query($get_announce_query) or die ("Couldn't execute query:<BR>$get_announce_query");
$get_announce_row = mysql_fetch_array($get_announce_result, MYSQL_ASSOC);
extract($get_announce_row);
$COLUMN1_OUT .= "
<FORM NAME='Announcement' METHOD='POST' ACTION='index.php'>
<TEXTAREA NAME='f_announcement' COLS='42' ROWS='12'>$announcement</TEXTAREA>
<INPUT TYPE='checkbox' NAME='f_line_breaks' VALUE='TRUE'>Blank lines to <BR> elements<BR>
<INPUT TYPE='submit' NAME='announce_exec' VALUE='Submit New Announcement'>
</FORM>";
}
$PAGE_OUT .= $COLUMN1; // (and other stuff)
echo Write_HTML($PAGE_OUT);
// Write_HTML() is in my main include to give default values on title, background, etc.
// -- $PAGE_OUT, again, is the actual HTML outputted.
function _Announcement_Insertion($value, $breaks)
{
$value = Escape($value);
if ($breaks) {$value = Line_Breaks_to_HTML($value);}
return $value;
}
// unrelated functions
?>
Any help, thoughts, or comments would be appreciated. It's not a "OMG I MUST HAVE THIS DONE BY TOMORROW OR I'LL DIE" type of thing, either, so I'm really in no hurry.
Sarteck



