NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is ten + ten?

Go back

Topic review (newest first)

Waccoon
09-17-2005 04:48:12

First, in edfooter.php, you need to change the import from this:

Code:

$contents = get_datafile('notice.php');

to this:

Code:

$contents = get_datafile('footer.txt');

Second, you have a name conflict in edfooter.php.  Two input tags are named "edfooter".  Change it to this:

Code:

<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.

Code:

/* 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;
}
Pinkie
09-16-2005 13:38:58

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:

Code:

/* 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:

Code:

<?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.

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB