Current location: Hot Scripts Forums » Programming Languages » PHP » Sanitizing data

Sanitizing data

  #1 (permalink)  
Wannabe Coder
Join Date: Jul 2010
Posts: 137
Thanks: 2
Thanked 0 Times in 0 Posts
Sanitizing data

Hi guys i am trying to sanitizing the data entry.. but for some reason it does not happen... help

PHP Code:



   if (isset(
$_POST['name'])) {


$query "INSERT INTO eventogaleria (galleria_id,name,texto)" .
" VALUES ('$galleria_id','$name','$texto')";

$result mysql_query($query) or die('Unable to add product');
   if (

"<h2>Una Nueva Foto ha sido anadida al album</h2>\n";

"<h2>Ha habido un problema andaidiendo tu foto.</h2>\n";
sanitize data function

PHP Code:

function sanitize($data)
// remove whitespaces (not a must though)
$data trim($data);

// apply stripslashes if magic_quotes_gpc is enabled
$data stripslashes($data);

// a mySQL connection is required before using this function
$data mysql_real_escape_string($data);


Reply With Quote

Featured Marketplace Scripts (view more)

  #2 (permalink)  
DanielVS's Avatar
Newbie Coder
Join Date: Jan 2010
Location: Vancouver, BC, Canada
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Seems right. But is happening that should not be happening, or what is not happening that should be happening? Say that five times fast =)
Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

All times are GMT -5. The time now is 05:00 PM.
vBulletin® Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.