GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-Dec-2003, 10:48
Dunc Dunc is offline
New Member
 
Join Date: Nov 2003
Location: West Mids, UK
Posts: 5
Dunc is on a distinguished road
Question

PHP security


Hi all. I'm learning PHP purely as a hobby, but I intend to write scripts such as a guestbook and tagboard and a basic blog. The problem is, if someone enters some malicious code in their guestbook entry. I know its possible to strip HTML tags out of the text in PHP, but is there anything more that can be done to eliminate someone trying to do such a thing? I imagine that it would involve regular expressions?
Obviously, BBcodes are the best technique for allowing people to format text in a guestbook, and I'm able to do a simple version using str_replace() which is great for converting [b] to <b> but not so good for say, anchor tags, where the content is variable.
I would apprecaite any help, pointers etc

Many thanks

Dunc
  #2  
Old 28-Dec-2003, 11:19
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Hello Dunc,

There are 2 basic 'rules' you should always remember with user input data
  • mysql_escape_string( $input ); when inserting input data into a db table
  • htmlentities( $row['stored_input'] ); before displaying the user supplied data onto a web page
  #3  
Old 01-Jan-2004, 11:14
Dunc Dunc is offline
New Member
 
Join Date: Nov 2003
Location: West Mids, UK
Posts: 5
Dunc is on a distinguished road

Thanks


Thanks J. I'm currently writing a 'tag board' script as a starter and will use this code in that.
This is a very useful forum; keep up the good work
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimizing your web server with Turck MMCache for PHP JdS Web Hosting Forum 2 07-Jan-2004 08:48
apache2 - php cgi fehler - schleife inna Apache Web Server Forum 8 27-Nov-2003 10:55
Automate a data change php form mjfmn MySQL / PHP Forum 4 20-Oct-2003 10:37
[Linux] Installing PHP --with-mcrypt JdS Web Hosting Forum 0 20-Aug-2003 09:40
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 17:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:33.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.