Furry stuff, oekaki stuff, and other stuff.
You are not logged in.
Ok, I'm kinda stuck here.....I want to implement an 'edit footer page' onto my Wax poteto.
I've gotten this far:
-- I've created edfooter.php
-- I've created a 'footer.txt' file and CHMODed it to 666.
I basically want a page that allows easy edit of this footer.txt for these oekaki boards I'm hosting. I now very well how to use the php include....so I can easily use that to include footer.txt in footer.php. I have doe this bacause I do not want people removing credits, ect.
In edfooter.php (a file I created which is the page where everything can be edited).
In functions.php I've added:
/* Edit footer */ if ($edfooter=='Edit') { $fd = fopen ('footer.txt', 'w'); fwrite($fd, $edfooter); fclose ($fd); @mysql_close ($dbconn); header ('Location: edfooter.php'); exit; }
In edfooter.php I've added:
<?php /* OekakiPoteto 5.x ©Copyright 2000-2002 RanmaGuy (Theo Chakkapark, http://suteki.nu) and Marcello Bastéa-Forte (http://marcello.cellosoft.com). Modification to the files are permitted as long as my name remains on the files. Wax Poteto by Marc "Waccoon" Leveille, http://www.NineChime.com/products/ Version 5.5.0 - Last modified 5/9/2005 */ include_once('globals.php'); include('dbconn.php'); include('flagchk.php'); $result = mysql_query("SELECT usrname, usrflags FROM ".$OekakiPoteto_MemberPrefix."oekaki WHERE usrname='$OekakiU'"); extract(mysql_fetch_array($result)); if ((!check_flag('O')) && (!check_flag('S')) && (!check_flag('A'))) { header('Location: error.php?error='.urlencode('You do not have the credentials to edit news.')); exit; } mysql_close($dbconn); // Waccoon: Test files before modifying function get_datafile($myfile) { if (file_exists($myfile)) { if (!is_writable($myfile)) { echo $myfile.' is locked! CHMOD the file so it is writable.'; exit; } return file_get_contents($myfile); } } $contents = get_datafile('notice.php'); ?> <html> <? include('header.php'); ?> <table width="<?=$hWidth?>" cellpadding="<?=$hCellPadding?>" align="center" cellspacing="2" class="infotable"> <tr> <td> <form name="form1" method="post" action="functions.php"> <table width="75%" border="0" cellspacing="0" cellpadding="0" align="center" class="infotable"> <tr> <td class="header"> <strong>Edit footer<strong> </td> </tr> <tr> <td> <div align="center"> Use this to edit the footer. <br /><br /> <textarea name="edfooter" cols="80" rows="10" class="multiline"><?= htmlspecialchars($contents); ?></textarea> <br /><br /> <input type="submit" name="edfooter" value="Edit" class="submit" /> </div> </td> </tr> </table> </form> </td> </tr> </table> <br /> <br /> <? include('footer.php'); ?>
(edited off notice.php)
Result: It's showing the content of the notice in the box. What have I done wrong? I'm sure this is very simple....it's just thatmy php knowledge is like almost 'non existant'. Not that I ever had good php knowledge. Help would be appreiated.
Offline
First, in edfooter.php, you need to change the import from this:
$contents = get_datafile('notice.php');
to this:
$contents = get_datafile('footer.txt');
Second, you have a name conflict in edfooter.php. Two input tags are named "edfooter". Change it to this:
<textarea name="newfooter" cols="80" rows="10" class="multiline"><?= htmlspecialchars($contents); ?></textarea> <br /><br /> <input type="submit" name="edfooter" value="Edit" class="submit" />
Third, for compatibility, you need to use a superglobal instead of a registered global to write the footer file. Superglobals are the "$_POST" variables that pop up all over the place in Wacintaki, but haven't been fully fixed in Wax. This code also accounts for the name conflict mentioned above.
/* Edit footer */ if ($_POST['edfooter'] == 'Edit') { if (!empty ($_POST['newfooter'])) { $fd = fopen ('footer.txt', 'w'); fwrite ($fd, $_POST['newfooter']); fclose ($fd); } @mysql_close ($dbconn); header ('Location: edfooter.php'); exit; }
Offline