nb Core Community
September 09, 2010, 04:33:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: 1.2.2 +nb is now final and released

@new registrations. I will not allow any new registrations here as there are more (real person) spambots here than ever.... captcha proved to be ineffective.

After your registration, mail me at ( admin AT shinobilegends.com ) from the mail address you want to register. Provide some text about you and possibly your game.
 
   Home   Help Search Calendar Downloads Login Register  
Pages: [1]
  Print  
Author Topic: lib/safeescape.php  (Read 949 times)
Harthas
Newbie
*

Karma: +0/-0
Posts: 25



View Profile
« on: April 07, 2008, 12:42:00 PM »

Also this function could abctually be enhanced.
I for myself would simply use following code.

Code:
function safeescape( $input ){
   $return = addcslashes( $input , '"\'' );
   
   return $return;
}

Probably we could also use addslashes for the whole system (I've just chosen addcslashes to do exactly the same than safeescape did). So we actually do not need a safeescape() anymore (seems to be a relict out of those PHP3 times).

I haven't recognized any problems so far with just addslashes instead of safeescape.


So long - And thanks for all the fish.
Logged

Always aim at complete harmony of thought and word and deed. Always aim at purifying your thoughts and everything will be well.
Mahatma Gandhi
Orogan
Newbie
*

Karma: +0/-0
Posts: 29


View Profile
« Reply #1 on: April 07, 2008, 12:57:30 PM »

You have a vaild point there Harthas, PHP3 should be replaced by OOP. 

On DP i remember reading through something about / & \ at output and input though for the life of me i cannot remember who posted it.
Logged
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 302



View Profile WWW
« Reply #2 on: April 07, 2008, 01:06:36 PM »

Orogan, the point here is to keep people from doing mysql injections ^^ that can break stuff.

$gold=httppost('gold'); //this is NOT in the allowed navs array

$sql="Update accounts set gold='".$gold."' WHERE acctid=3";
db_query($sql);

and you can manipulate that. You can make ANY sql query possible.

normally I just use

$gold=(int)httppost('gold');

how often does safeescape get used anyway Oo I did not know that function still existed.
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Harthas
Newbie
*

Karma: +0/-0
Posts: 25



View Profile
« Reply #3 on: April 07, 2008, 01:12:05 PM »

About 5 times (In systemmail.php and clan_membership.php
Logged

Always aim at complete harmony of thought and word and deed. Always aim at purifying your thoughts and everything will be well.
Mahatma Gandhi
Nightborn
Administrator
Sr. Member
*****

Karma: +20/-0
Posts: 302



View Profile WWW
« Reply #4 on: April 07, 2008, 01:26:15 PM »

hm, I might check up  the difference to the current php core function, but I believe " and ' are already both escaped.
Logged

It should be fixed, but it won't be easy and it won't be fast. If you want
to help - wonderful. But keep in mind that it will take months of wading
through the ugliest code we have in the tree. If you've got a weak stomach -
stay out. I've been there and it's not a nice place.

   - Al Viro
Harthas
Newbie
*

Karma: +0/-0
Posts: 25



View Profile
« Reply #5 on: April 07, 2008, 07:20:56 PM »

Of course, for MySQL-data mysql_real_escape_string is the best ;-)

Escaped in PHPcore by Default? That would be nice of course. Or is it a setting in the php.ini?
Logged

Always aim at complete harmony of thought and word and deed. Always aim at purifying your thoughts and everything will be well.
Mahatma Gandhi
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!