...

View Full Version : Cms



cheechm
04-28-2008, 09:19 PM
Looking for a simple PHP cms where you just edit an included file. So nothing fancy, just something that edits a file.

oesxyl
04-28-2008, 11:05 PM
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

mlseim
04-29-2008, 02:41 AM
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

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



.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum