Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-28-2008, 09:19 PM   PM User | #1
cheechm
Regular Coder

 
Join Date: Jan 2007
Posts: 123
Thanks: 20
Thanked 1 Time in 1 Post
cheechm is an unknown quantity at this point
Cms

Looking for a simple PHP cms where you just edit an included file. So nothing fancy, just something that edits a file.
cheechm is offline   Reply With Quote
Old 04-28-2008, 11:05 PM   PM User | #2
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
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
oesxyl is offline   Reply With Quote
Old 04-29-2008, 02:41 AM   PM User | #3
mlseim
Master Coder

 
mlseim's Avatar
 
Join Date: Jun 2003
Location: Cottage Grove, Minnesota
Posts: 9,046
Thanks: 8
Thanked 1,029 Times in 1,020 Posts
mlseim has a spectacular aura aboutmlseim has a spectacular aura aboutmlseim has a spectacular aura about
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..
mlseim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:07 AM.


Advertisement
Log in to turn off these ads.