Results 1 to 2 of 2

Thread: ?page=var // stripslashes cmd

  1. #1
    Join Date
    Jan 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ?page=var // stripslashes cmd

    Hi everyone,

    i need some assistance with simple code. First, I am using this script to open txt includes and edit the contents for an easy admin panel. However im having a hard time
    Call stripslashes() on the data before writing it.
    .

    This is the code:
    Code:
    <?
    if($_POST['Submit']){
    $open = fopen("textfile.txt","w+");
    $text = $_POST['update'];
    fwrite($open, $text);
    fclose($open);
    echo "File updated.<br />";
    echo "File:<br />";
    $file = file("textfile.txt");
    foreach($file as $text) {
    echo $text."<br />";
    }
    echo "<p><a href=\"./livepage.php\">click here to view the live updated webpage</a></p>";
    echo "<p><a href=\"./mainadminpage.php\">click here to view the admin menu</a></p>";
    }else{
    $file = file("textfile.txt");
    echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
    echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">";
    foreach($file as $text) {
    echo $text;
    }
    echo "</textarea>";
    echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
    </form>";
    }
    ?>
    oh and if anyone wants to show me how to incorporate a WYSIWYG editor into the txt field so people dont know html to edit that would be great.

    Also, for my admin panel, i want to be able to goto, for example:

    index.php?page=aboutus and that aboutus var would be added to that code to include that txt file. i think its like global vars or something. I used to play around with php awhile ago, but ive seem to forgotten alot

    any help would be greatly appriciated.

    thank you
    Last edited by beau; 01-21-2007 at 12:30 AM. Reason: WYSIWYG call for help

  2. #2
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <?
    if($_POST['Submit']){
    $open = fopen("textfile.txt","w+");
    $text = $_POST['update'];
    fwrite($open, $text);
    fclose($open);
    echo "File updated.<br />";
    echo "File:<br />";
    $file = file("textfile.txt");
    foreach($file as $text) {
    echo $text."<br />";
    }
    echo "<p><a href=\"./livepage.php\">click here to view the live updated webpage</a></p>";
    echo "<p><a href=\"./mainadminpage.php\">click here to view the admin menu</a></p>";
    }else{
    $file = file("textfile.txt");
    }
    ?>
    <head>
    <script language="JavaScript" type="text/javascript" src="Editor/wysiwyg.js">
    </script>
    </head>

    <form action="" method="post">
    <textarea Name="update" id="tid" cols="50" rows="10"></textarea>
    <script language="javascript">
    generate_wysiwyg('tid');
    </script>

    <input name="Submit" type="submit" value="Update" />
    </form>


    in this <script language="JavaScript" type="text/javascript" src="Editor/wysiwyg.js">, here src="Editor/wysiwyg.js"
    is the path i saved that js file. download wysiwyg.js
    In textarea id="tid" and that tid is pass generate_wysiwyg('tid') function

    i am not sure, this is the output you want.


    second part i did'nt get you, but if you explain about that little more, i will try to help you

    Regards
    Vijay

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •