LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Auto-escaping text (https://www.linuxquestions.org/questions/linux-general-1/auto-escaping-text-769153/)

adamlucansky 11-14-2009 01:51 PM

Auto-escaping text
 
Hello guys, this time, another problem.

Text
Code:

'LDAP_Object_Classes' => array("top", "inetOrgPerson"),
... If I enter this text into variable, its fine, but when variable is used, for example entering into /usr/bin/mysql ... -c "INSERT ... $text", it makes troubles, is there any kind of echo which automatically escape all characters ?

Something like mysql_real_escape_string in php

janoszen 11-15-2009 08:19 AM

LDAP
 
A more appropriate choice of topic title would have been helpful. Anyway, unfortunately there is no LDAP escape function in PHP, you'll have to write your own.

adamlucansky 11-16-2009 06:45 AM

No No , that was just example text, i mean, something like mysql_real_escape_string which escape all quote characters.

Example:
Code:

/usr/bin/somecommand 'LDAP_Object_Classes' => array("top", "inetOrgPerson"),
\'LDAP_Object_Classes\' => array(\"top\", \"inetOrgPerson\"),


janoszen 11-16-2009 03:00 PM

escapeshellarg
 
Is it possible, you're looking fog escapeshellarg()?

adamlucansky 11-17-2009 05:14 AM

I mean, like command echo in bash, not PHP, that was like example. Same like /bin/echo , but it return same text but escaped


All times are GMT -5. The time now is 03:03 PM.