Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP script for updating HTML page?

Status
Not open for further replies.

jfgonzalez

Technical User
Apr 16, 2002
36
US
Hi,

Is it possible to utilize a PHP script for the purposes of allowing a user with limited or no technical background to update simple text/graphics on a website coded in HTML?

Would it be something similar to classic ASP or ASP.NET? I've worked on pages utilizing both, with SQL as the database. Can I do something similar with PHP? If so, is it the same approach, or easier?


Thanks,
JFG
 
sure. just use a form with either a text area or a javascript wysiwyg plugin.

then either store the result in a database or a flatfile or edit the html directly.

or just use any of the content management systems that exist.
 
Thanks, jpadie. I don't think the website host will allow me to install a CMS system (I've successfully used Joomla in the past for other clients), hence the need for something. I need something similar (ideally for the client to be able to log in to a back end admin area and do updates to all the pages as needed.
 
Hi, it's very easy..

I've used both

in the past.
They are quite easy to implement (I prefer the tinymce for small projects).

You need to config the wysiwyg script, so that it only shows the buttons you wish to use, and also implement it as per the guidelines.

When that is done, you also should secure your scripting with functions like strip_tags (remember to pass the parameter with allowed tags too!, eg. like "<br><p><b>").

Also you should do as in example 1:

(prevents sql injection).

You will also want to run the function nl2br() on the variable, before inserting into the db.

eg.
Code:
$strFoo = htmlentities(strip_tags(nl2br($_GET['txtFoo']), "<p><b><img><a><hr>"));

You will of course need the html_entity_decode(), when parsing out from the db :)

Olav Alexander Mjelde
 
joomla and drupal are just a set of php script. there is no reason why a host should object to you using them.
 
You could also use fckeditor, load the page to a variable and push the page as default value. Once form is submitted, proceed to write content back to disk.

Kind of risky since you mention a "non-experienced" users so they could potentially destroy the page and/or its content.

As other mentioned, joomla or cakephp could be used for this.

Regards,


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top