473,395 Members | 1,535 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,395 software developers and data experts.

PHP Sanitize

Hello - crossing over from the Dark Side (ASP/Windows) to PHP/NIX.

I have found the PHP Sanitize functions provided by OWASP to be a
useful resource.

First Question:
If I use sanitize_paranoid_string or sanitize_system_string, the output
is enclosed within double quotes.

e.g.
<code>
$string = '"'.preg_replace('/\$/', '\\\$', $string).'"';
//make sure this is only interpretted as ONE argument
</code>

Is there a <em>security</em> reason why this is done? Also, could
someone elaborate on the comment that follows the command, I'm
embarassed to admit, that I'm not sure what it means.

Once, I "sanitize" the data, I don't want it to be enclosed within the
double quotes, so if I do this instead...

<code>
$string = preg_replace('/\$/', '\\\$', $string);
</code>

....is this just as secure? Or should I strip the quotes off afterwards?

T.I.A.

Jan 30 '06 #1
0 4109

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

Similar topics

0
by: Chris McKeever | last post by:
I am trying to modify the Mailman Python code to stop mapping MIME-types and use the extension of the attachment instead. I am pretty much clueless as to what I need to do here, but I think I have...
0
by: Nils Hedström | last post by:
I am looking for a component that scrubs html-code that is entered by users from dangerous-html (javascript etc). Allowed tags (h1, b, p ,br, img, a) should still remain. I realize that img and...
1
by: Brad Baker | last post by:
I have an asp.net page written in C# which provides a search box which updates a gridview control using the following code: protected void search_button_Click(object sender, EventArgs e) {...
5
by: Raistlin Majere | last post by:
with css label is on the left and labelled is on the right without css, label is on the top and labelled is on the bottom If modify.php is: <form action="modify2.php" method="post"> <div...
7
by: Petra Meier | last post by:
Hello, if I use the following function for all my mySql commands in php, am I protected against all SQLinjections and XSS attacks? function sanitize($value){ return...
5
pradeepjain
by: pradeepjain | last post by:
This is the function that i use to remove all quotes and things.But this time its giving error y i dont know. function sanitize($input){ if(is_array($input)){ foreach($input as...
5
Thekid
by: Thekid | last post by:
Hi, I'm using xampplite and I'm trying to make a guestbook and a forms page where you can post to the guestbook with PHP & MySQL. I got the code from a website but it wasn't working so I tinkered...
68
mideastgirl
by: mideastgirl | last post by:
I keep getting this error and I cannot figure it out. My curly brackets are closed, and I am using the correct tags for <?php to open and ?> to close my code. Can someone please help me! Here is...
1
by: mkjame | last post by:
I need to find the best way to efficiently sanitize $_POST, $_GET variables by type of variable (if $_POST then verify if it is really an email, if $_POST; verify if it's a 5 digits number, etc...) ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.