I paid a freelancer to take a look when the site was first moved. He said the code is old and will need to be upgraded. Registered_Globals has to be on. He fixed a few major parts, but there are a few minor issues that I just found. The entire site was written by someone who is no longer available.
So break me in easy, what would have to change in these 2 files to make this simple announcement module to work properly? Hopefully there is some format to follow, so I can apply to the other broken files.
Right now these 2 files don't update the db. Everything looks and acts functional, but the data stays the same.
Code: Select all
<?
if($action == 1) {
$file_open = fopen('../scroller_array.php', 'w+') ;
$file_text = '<?' ;
foreach($_POST[announcement] as $key => $value) {
$file_text .= '$message['.$key.'] = "'.$value . '";' ;
}
$file_text .= '?>' ;
$file_write = fwrite($file_open, $file_text) ;
$file_close = fclose($file_open) ;
}
include('header.php') ;
echo '<h1>Manage Announcements</h1>' ;
include('../scroller_array.php') ;
echo '<form action="announcements.php" method="post">' ;
echo '<input type="hidden" name="action" value="1" />' ;
$ctrl = 0 ;
while($ctrl < 10) {
echo '<textarea name="announcement[]" style="width: 700px ; margin-bottom: 3px" rows="3">' . $message[$ctrl] . '</textarea><br />' ;
++$ctrl ;
}
echo '<input type="submit" value="Update »" />' ;
echo '</form>' ;
include('footer.php') ;
?>Code: Select all
<?
$announcement1 = str_replace("\'", "’", $announcement1) ;
$announcement1 = str_replace('\"', '"', $announcement1) ;
$announcement2 = str_replace("\'", "’", $announcement2) ;
$announcement2 = str_replace('\"', '"', $announcement2) ;
$announcement3 = str_replace("\'", "’", $announcement3) ;
$announcement3 = str_replace('\"', '"', $announcement3) ;
$file1 = fopen('../announcement1.txt', 'w+') ;
$write1 = fwrite($file1, $announcement1) ;
$close1 = fclose($file1) ;
$file2 = fopen('../announcement2.txt', 'w+') ;
$write2 = fwrite($file2, $announcement2) ;
$close2 = fclose($file2) ;
$file3 = fopen('../announcement3.txt', 'w+') ;
$write3 = fwrite($file3, $announcement3) ;
$close3 = fclose($file3) ;
include('header.php') ;
?>
<h1>
Success!</h1>
<p style="text-align: center">
Announcments updated!</p>
<? include('footer.php') ?>