escaping

Shouldn't mysql_real_escape_string() leave slashes in Database?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 20:17:13
Im using smarty and mysql_real_escape_string() for user input, and when I insert some code with ' or " , and lookup in phpmyadmin it shows without backslashes. When I get record from DB i doesn't have backslashes also. But when I just pass escaped string without inserting into the db it is backslashed. Shouldn't it add slashes, insert with them and then I would strip them when i would output? Or am I missing something? You're missing it - escaping with backslashes is meant to ensure that queries aren't malformed, e.g. something like this will surely break and possibly risk SQL injections:

Is there a security risk in leaving ampersands unescaped in user-submitted data?

社会主义新天地 提交于 2019-12-01 20:12:06
Is there any security risk in escaping other special characters but leaving ampersands untouched when displaying user-generated/submitted information? I'd like to let my user input html entities, hex, and decimal special characters freely without adding unnecessary complexity to my sanitizer. tldr; Leaving in ampersands (or other "special characters") is not a security issue if coded correctly . That is, the output/use is of importance, not the input . It all depends on how the data is used in the end. Doing a <input value="<? echo $input ?>" /> is not correctly coded , for arbitrary input,

LESS CSS Escape entire CSS rule with different prefixes?

纵饮孤独 提交于 2019-12-01 19:54:11
How do i escape the following: .prefix(@rule, @prop) { -webkit-@{rule}: @{prop}; -moz-@{rule}: @{prop}; -o-@{rule}: @{prop}; -ms-@{rule}: @{prop}; @{rule}: @{prop}; } I've tried a bunch of different ways, wrapping it in ~"stuff" , wrapping the variables in @{var} , backslashing the - 's... no success! Edit: There's a pull req for it on Github: https://github.com/cloudhead/less.js/pull/698 Update for LESS 1.6+ Your original plan almost works with the LESS 1.6 update . This is the syntax needed: LESS .prefix(@rule, @prop) { -webkit-@{rule}: @prop; -moz-@{rule}: @prop; -o-@{rule}: @prop; -ms-@

Python escape delimiter in configuration file using ConfigParser

可紊 提交于 2019-12-01 19:50:11
I'd like to escape ":" and/or "=" as the name in a configuration file. Does anyone know how to achieve this? I try backslash "\", it does not work. skrrgwasme If you're using Python 3, you don't need to. Look at the Python docs section on Customizing Parser Behavior . By default, configparser uses ":" and "=" as delimiters, but you can specify different delimiters when you create the configparser object: import configparser parser = configparser.ConfigParser(delimiters=('?', '*')) In this example, the default delimiters have been replaced with a question mark and an asterisk. You can change

Escaping \ in string or paths in R

白昼怎懂夜的黑 提交于 2019-12-01 19:47:48
问题 Windows copies path with \ which R does not accept. So, I wanted to write a function which would convert '\' to '/'. For example: chartr0 <- function(foo) chartr('\','\\/',foo) Then use chartr0 as... source(chartr0('E:\RStuff\test.r')) But chartr0 is not working. I guess, I am unable to escape '/'. I guess escaping / may be important in many other occasions. Also, is there a way in R such that I do not have to use chartr0 every time but convert all path automatically by creating an

Is it possible to “escape” a method name in PHP, to be able to have a method name that clashes with a reserved keyword?

喜你入骨 提交于 2019-12-01 19:23:28
I'm doing MVC in PHP, and i'd like to have a list() method inside my Controller, to have the URL /entity/list/parent_id, to show all the "x" that belong to that parent. However, I can't have a method called list(), since it's a PHP reserved keyword. In VB.Net, for example, if I need to have something with a name that clashes with a reserved keyword, I can wrap it in [reserved_name]. In SQL, you can do the same thing. In MySQL, you use the backtick ` Is there some syntax in PHP that specifies "treat this as an identifier, not as a keyword"? (NOTE: I know I can use routes to do this without

Escape Number 9 in p:inputmask

↘锁芯ラ 提交于 2019-12-01 19:06:09
问题 I want to prepend +90 (Turkey's phone code) to every phone numbers a user enters. For that reason I am using a mask like this: <p:inputMask id="homePhone" value="#{personController.model.homePhone}" mask="+90 (999) 999-9999" size="20" converter="converterPhone" /> But displays it like this: +_0 (___) ___-____ However, I want it to look like this: +90 (___) ___-____ <!-- pay attention to 9 --> Is there a way to escape the first 9 like this: mask="+\90 (999) 999-9999" ? Thank you all... 回答1:

Un-escape JavaScript escaped value in Java

雨燕双飞 提交于 2019-12-01 18:43:30
In our web service we set a cookie through JavaScript wich we read again in Java (Servlet) However we need to escape the value of the cookie because it may contain illegal characters such as '&' which messes up the cookie. Is there a transparent way to escape (JavaScript) and unescape again (Java) for this? Valentin Rocher In java you got StringEscapeUtils from Commons Lang to escape/unescape. In Javascript you escape through encodeURIComponent , but I think the Commons component I gave to you will satisfy your needs. Client JavaScript/ECMAScript: encodeURIComponent(cookie_value) // also

How to decode a reserved escape character in a request URI on a web server?

这一生的挚爱 提交于 2019-12-01 18:22:15
It is pretty clear that a web server has to decode any escaped unreserved character (such as alphanums, etc.) to do the URI comparison. For example, http://www.example.com/~user/index.htm shall be identical to http://www.example.com/%7Euser/index.htm . My question is, what are we gonna do with the escaped reserved characters? An example would be %2F , or / . If there is an %2F in the request URI, should the parser of web server replace it with a / ? In the above example, it would mean that http://www.example.com/~user%2Findex.htm would be the same as http://www.example.com/~user/index.htm ?

CKEditor and escaping elements

妖精的绣舞 提交于 2019-12-01 18:09:48
I've using CKEditor for updating CMS content on my website. I also using FontAwesome, which includes set of fancy icons, that can be displayed like this <i class="icon-envelope"></i> The problem is that CKEditor escapes this i tag on client side, and I can't see it in source mode. How I can allow this tag? I have tried CONFIG.removeFormatTags = '' , but it dies not help. It is removed because it is empty. Put some non-breaking space   or zero-width space ​ within it to preserve your tag. You can also remove i from CKEDITOR.dtd.$removeEmpty object. This may, however, break other empty <i> tags