Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 04:52:06 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Small problem when writing PHP code for a page  (Read 605 times)
mmlr38

Offline Offline

Posts: 4


« on: February 12, 2008, 10:59:56 PM »

I am trying to write a rather complicated page in PHP for websitebaker.  There are places in the code that I am writing that has regular expressions with numbers in brackets after them.  For example:
Code:
eregi("^[a-fA-F0-9]{32}$", $topicID)

Now, when I save the code in WB, for some reason, those numbers in the brackets and the brackets disappear.  Like this:
Code:
eregi("^[a-fA-F0-9]$", $topicID)

Does anyone have an idea why those are getting parsed out and how I can prevent it from happening?  I assume that it has something to do with special characters that WB wants to interpret.  I am hoping that there is a way to escape them so that they aren't pulled out.

Many thanks in advance.
Matt
Logged
mmlr38

Offline Offline

Posts: 4


« Reply #1 on: February 20, 2008, 07:56:12 PM »

Anyone know how to stop this from happening?
Logged
thorn

Offline Offline

Posts: 980


WWW
« Reply #2 on: February 20, 2008, 08:25:37 PM »

Hallo,

see http://projects.websitebaker.org/websitebaker2/ticket/553

thorn.
Logged

mmlr38

Offline Offline

Posts: 4


« Reply #3 on: February 20, 2008, 08:41:21 PM »

Thanks for pointing that out thorn, but that workaround doesn't work for regular expressions.  I get the following error:

Code:
Warning: eregi() [function.eregi]: REG_BADBR in /var/www/justin_paquette/modules/code/view.php(30) : eval()'d code on line 124

I don't think you are allowed to have spaces in the numbers of regular expressions.
Logged
thorn

Offline Offline

Posts: 980


WWW
« Reply #4 on: February 20, 2008, 08:53:02 PM »

Oh, i see -- too bad.

Have a look at http://projects.websitebaker.org/websitebaker2/changeset/569 to fix this problem.
Probably you can make these changes locally.

thorn.

BTW: if you use this code to check a $_GET or $_POST-variable (XSS-prevention), it's better to use the binary-safe preg_match().
« Last Edit: February 20, 2008, 08:59:45 PM by thorn » Logged

mmlr38

Offline Offline

Posts: 4


« Reply #5 on: February 20, 2008, 09:03:59 PM »

thorn,

Yep, those changes fixed it.  Thanks for all the help man.

Matt
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!