A PHP function to add backslashes (\) in front of each quote characters (" and ') and backslash characters (\).
Questions tagged [addslashes]
82 questions
1
vote
2 answers
how can i use replace function in JSP to escape single quote
i just want to ask how to use REPLACE function in JSP to escape single quote
like addslashes() in PHP
my code is
String task_name= request.getParameter("task_name");
String rep_task_name=task_name.replace("\'","\\\'");
st2 =…

mansoor Sntli
- 19
- 2
1
vote
3 answers
Should I escape characters in my GET and POST requests?
I have just read that PHP escapes incoming GET and POST requests on its own for some time. Double escaping does no good. Should I escape the strings at all?
For example I process a simple input like this:
$contact =…

Viktor Sec
- 2,756
- 1
- 24
- 31
1
vote
5 answers
Antidote for magic_quotes_gpc()?
I've seen dozens of PHP snippets that go like this:
function DB_Quote($string)
{
if (get_magic_quotes_gpc() == true)
{
$string = stripslashes($string);
}
return mysql_real_escape_string($string);
}
What happens if I call…

Alix Axel
- 151,645
- 95
- 393
- 500
1
vote
3 answers
Userinput reaches sensitive sink due to insecure usage of addslashes() without quotes
I'm using the PHP program RIPS (http://rips-scanner.sourceforge.net/) to scan my PHP scripts for vulnerabilities and it's coming back the the message
Userinput reaches sensitive sink due to insecure usage of addslashes() without quotes Userinput…

user1398287
- 5,245
- 5
- 21
- 25
1
vote
3 answers
fgetcsv is not splition data properly
i am importing csv file to upload data into database. But in some products the description is not going through properly.
the description is like
TSD/UHC Model UG-132, 6\" gas revolver with plastic shells. Shells:
MUG131 & MUG131BRASS. 290-320…

Ritesh
- 11
- 2
1
vote
2 answers
preg_match, addslashes,mb_substr not working for long strings
I am parsing an html file. I have a big string which is basically a script.
The string looks likes this:
var spConfig = new
…

Mani_Mauu
- 11
- 1
1
vote
2 answers
How to insert backslashes(\) to a string with special characters in it before saving to the mysql DB
I tried to use addslashes() command in my php script. But this function is not appending backslash() before special characters in the string.
Is there any other way to insert \ before special characters in string?
Here is my code:
function…

Mani
- 23
- 6
1
vote
2 answers
Memory leak in php
I am having a problem understanding why this part of my code is causing a memory leak:
for($i=0; $i

Dany Khalife
- 1,850
- 3
- 20
- 47
0
votes
1 answer
I need to convert the file path in windows say from c:\abc\efg\mmm.txt to c:\\abc\\mm.txt?
how do i change a file path which is in the form of `
c:\abc\efg\mmm.txt
to
c:\\abc\\mm.txt ?
and what can i do to change the
.txt
extension to, let's say .doc?
`
EDIT:
These paths are just for illustration.
The actual paths are composed…

John
- 794
- 2
- 18
- 34
0
votes
1 answer
Are there any server settings to fix addslashes behaviour on calls to file_get_contents
Up until about a week ago, wordpress websites on our host showed no issues.
However, since this morning we noticed an issue whereby admin pages failed to load in wordpress. On other sites on the same server one page of one site was being displayed…

MyStream
- 2,533
- 1
- 16
- 33
0
votes
1 answer
0
votes
3 answers
Escaping Double Quotes in PHP (Wordpress)
I'm having difficulties escaping double quotes using the PHP addslashes function. If I run:
$name = addslashes(get_the_title());
And the title has double quotes in it, the output still has double quotes without any escape characters.
eg. “Welcoming…

Dave Hunt
- 691
- 2
- 10
- 23
0
votes
2 answers
Addslashes not escaping properly
Not quite sure what I'm doing wrong. I have
$description = addslashes($description);
echo "";
An example of the…

Nicole
- 123
- 3
- 16
0
votes
1 answer
add slashes to escape javascsript array
How do I update the below code to escape HTML and strings in JavaScript arrays. I am trying to use a function escapeHtml to add the slashes but it won't execute as intended. Thanks