Jump to content

Recommended Posts

I am kind of new to php but recently put together a script using the backtick operator for certain kinds of data delimiters, only to discover it has special meaning in php. Can someone explain exactly what it does, what cautions I should observe in using it in data formatting (I'm thinking security), and whether or not I should just scrap the whole idea and use something different?

 

Thanks in advance

Dan

Link to comment
https://forums.phpfreaks.com/topic/54360-backtick-operator-and-security/
Share on other sites

Well, it's a bit complex. And I use it in several places.  For example I create indexes that look like:

 

SomePage: field1=data`field2=moredata

AnotherPage: field1=data`field2=moredata

...

 

Also the engine converts

 

[if equal a b]some text [if]  to  `true equal a b`some text`true`

 

and then immediately converts that to 'some text' or '' depending on the condition--so the backtick doesn't appear in the final output. But it is parsed by the script.

 

And finally I set up hidden data values on wiki pages (for database like functions) that looks like

 

Main page text...

`data`

field=data

`

field2=more data

`

 

These are all just raw text files parsed by the script engine and it never shows up in the final html output, but these text strings do get manipulated by the php scripts that produce the output...

 

I could switch to some other syntax as I've only JUST released this as pre-beta software, but wanted to understand how it all works, if possible.

 

Cheers,

Dan

Sorry the question was unclear. Am just trying to understand what the risks could be of using the backtick as a delimiter. Specifically, if php is parsing a string that contains it, could something malicious be executed?

 

Actually I've gone through and changed all the code, so it's not so critical now.  But I am really trying to understand security and was hoping for a clearer explanation of how this works. I mean is this something that could cause problems in a simple forms input field? Or does it only work in certain restricted situations.

 

I noticed htmlspecialchars() does not seem to escape this character. But then again, of course it's not a html special char, its a php special char! :)

 

Cheers,

Dan

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.