Raised This Month: $12 Target: $400
 3% 

Replace quotes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 03-25-2013 , 04:33   Replace quotes
Reply With Quote #1

I'm trying to insert safe data in my data base and I have written a function which replaces a few invalid symbols, I don't know why but I'm getting interesting strings which I can't copy+paste here because It can't be copied !

PHP Code:
public client_putinserver(id){
    static 
name[32]

    
get_user_name(idname31)
    
formatex(name31safe_string(name))

    
server_print(name)
}

public 
safe_string(string[]){
    new 
buffer[32]
    
    
copy(buffer31string)
    
replace_all(buffercharsmax(buffer), "^'""")
    
replace_all(buffercharsmax(buffer), "^"", "")
    replace_all(buffer, charsmax(buffer), "
\", "")
    replace_all(buffer, charsmax(buffer), "
/", "")
    
    return buffer

killergirl is offline
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 03-25-2013 , 09:25   Re: Replace quotes
Reply With Quote #2

I dont really understand your problem. This works fine for me :
Code:
new name[32];     get_user_info(id, "name", name,31);     server_print("unsecured namex: %s",name);     //secure it     replace_all(name, 31, "\", "");     replace_all(name, 31, "'", "");     replace_all(name, 31, "`", "");     server_print("secured namex: %s",name);
Podarok is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-25-2013 , 12:29   Re: Replace quotes
Reply With Quote #3

Se advanced bans code its have a good method to replace insecure chars from an string

>> http://forums.alliedmods.net/showthread.php?t=80858
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode