473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

COMMENT FORM

I know how to take data from a form and insert it into MySql. For a
comment form on something like a blog or news article, is using
addslashes() all that is needed to prevent unwanted malicious user data?
There's got to be something more right? Can anyone tell me what I need
to do or point me to some tutorial and/or articles?

Thanks
Zach W.
Aug 1 '07 #1
4 1665
..oO(zach)
>I know how to take data from a form and insert it into MySql. For a
comment form on something like a blog or news article, is using
addslashes() all that is needed to prevent unwanted malicious user data?
No. addslashes() is hardly ever necessary. Of course its counterpart
stripslahes() is required to get the "raw" data if magic quotes are
enabled on the server.
There's got to be something more right? Can anyone tell me what I need
to do or point me to some tutorial and/or articles?
Use mysql_real_escape_string() or - even better - prepared statements,
as provided by the PDO extension. And google for "SQL injection".

Micha
Aug 1 '07 #2
Michael Fesser wrote:
.oO(zach)
>I know how to take data from a form and insert it into MySql. For a
comment form on something like a blog or news article, is using
addslashes() all that is needed to prevent unwanted malicious user data?

No. addslashes() is hardly ever necessary. Of course its counterpart
stripslahes() is required to get the "raw" data if magic quotes are
enabled on the server.
> There's got to be something more right? Can anyone tell me what I need
to do or point me to some tutorial and/or articles?

Use mysql_real_escape_string() or - even better - prepared statements,
as provided by the PDO extension. And google for "SQL injection".

Micha
I don't believe my host has magic quotes on, I use media temple's grid
server if anyones familiar with that. So if I use the
mysql_real_escape_string() on the data being inserted into the database
that's it? I thought it was more complicated than that...Will I need to
use stripslashes() before printing to the screen?
Aug 1 '07 #3
Rik
Excuse the typos and bad grammar. Time for bed now....
--
Rik Wasmus
Aug 2 '07 #4
Rik wrote:
Excuse the typos and bad grammar. Time for bed now....
--Rik Wasmus
Thank you very much guys, I'll mess with it this weekend after my tests
at school:)

zach
Aug 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Noud Aldenhoven | last post by:
Hello everyone, I was wondering how to remove comments away form a file. So that's why I made this script. =============================== #!/usr/bin/env python import sys import string
4
by: Jacob Lyles | last post by:
Hello All, I'm trying to make a comment section on my website. However, I don't want to set up a MYSQL database to do so because I want to make it really simple, just a form that asks for their...
3
by: Ticool | last post by:
Hello, I found this site to be very helpful in learning perl, but now I seem to be stumped and wonder if one of experts could assit me with this little problem.... On my web form I have a...
11
Louis8
by: Louis8 | last post by:
I would be very appreciative of anyone who could show me a better way to do what I did. Complete newbee here. I have a comment form sidebar of blog. I wanted to Name & Comment fields required and...
1
by: karen987 | last post by:
I have a comment form, on a news website, ASP page, which users fill in and it adds comments to a news article. The reader clicks on a headline and the comments open up in a new window. It already...
4
by: Guillaume Dargaud | last post by:
Hello All, I'm looking for a way to add a list of user comments at the bottom of a web page, in PHP. I've looked and played with several available tools but they don't fit my needs which are:...
8
by: rotorio | last post by:
Hi, I am new to php and I am trying to edit one free comment script to fit my needs. The last thing left is to make a word wrapping in comment <div>. It musn't be hard but because I lack...
1
by: 1adeniyi | last post by:
hello, i haven't done alot of MS access so i am lost trying to build an application. the application i am creating will allow student users to comment about any of the colleges they have visited in...
2
by: barry Callahan | last post by:
Hello. Recently I decided to add a contact section to my site. I have added a form with text areas and submit button, but cannot seem to figure out how to make it work / send the data. I would...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.