Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Cms

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    123
    Thanks
    20
    Thanked 1 Time in 1 Post

    Cms

    Looking for a simple PHP cms where you just edit an included file. So nothing fancy, just something that edits a file.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by cheechm View Post
    Looking for a simple PHP cms where you just edit an included file. So nothing fancy, just something that edits a file.
    probably you must build your own, I don't find one I like it.
    I'm curios what other poster suggest.

    regards

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,466
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Create some simple plain text files,
    perhaps you call them p0.db, p1.db, p2.db

    Chmod them to 777 (so you can write to them).

    Wherever you want them to appear on your pages,
    you would do this:

    <?php include("p0.db")?>

    Then, the PHP script below can be used to edit
    those files online. Perhaps you call this script, "edit.php" ...
    Either keep it secret or use a sessions login to activate.

    call it like: edit.php?p=0 (where 0 is p0.db ... edit.php?p=1 would be p1.db )
    PHP Code:
    <?php

    $action
    =$_POST['action'];
    $textarea=$_POST['textarea'];
    $page=$_REQUEST['p'];

    // Where to return after changes are made
    $rpage="index.php";

    // Get page
    $url "p".$page.".db";
    $data implode(""file($url)); 

    if(
    $action=="save"){
    $newtext=stripslashes($textarea);
    $newtext str_replace("<?"""$newtext);
    $newtext str_replace("?>"""$newtext);
    $newtext nl2br($newtext);
    $fh fopen($url'w') or die("can't open file");
    fwrite($fh$newtext);
    fclose($fh);
    header ("location: edit.php?p=$page");
    }
    else{
    echo
    "
    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
    <html xmlns=\"http://www.w3.org/1999/xhtml\">
    <head>
    <title>My Simple Text Editor</title>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
    <meta name=\"keywords\" content=\" \" />
    <meta name=\"description\" content=\" \" />
    <link rel=\"stylesheet\" href=\"style.css\" id=\"folio\" type=\"text/css\" media=\"all\" />
    </head>
    <body>
    "
    ;

    $ta=br2nl($data);

    echo
    "
    <a href='$rpage'><-- Return to Page</a><br /><br />
    "
    ;

    echo
    "
    Make Changes and click \"Save Changes\" at the very bottom ...<br />
    <form action='edit.php' method='post'>
    <input type='hidden' name='action' value='save'>
    <input type='hidden' name='p' value='$page'>
    <textarea name='textarea' rows='30' cols='80'>$ta</textarea>
    <br />
    <input type='submit' name='submit' value='Save Changes'>
    </form>
    </body>
    </html>
    "
    ;
    }

    function 
    br2nl($str) {
    return 
    preg_replace('=<br */?>=i'""$str);
    }

    ?>

    Doesn't get much simpler than that ... add your own
    security (PHP sessions). Also know that the person can
    add their own HTML to the text (p0.db) ... it does take
    out any PHP scripting <? and ?>

    I love this little script for allowing clients to update their
    own content without any MySQL database. The clients
    like to be able to add their own HTML, like <b>bold</b>
    <i>italics</i> etc. They can even do <a href ...> <img src ...>



    .
    Last edited by mlseim; 04-29-2008 at 02:54 AM.


  •  

    Posting Permissions

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