Help - Search - Members - Calendar
Full Version: Dynamic Signature PHP Problem
RuneCrypt Forum > General Board > Computing & Webdesign
Fishfish0001
Hi,

I recently downloaded the Dynamic Signatures package from here, and after getting everything up and perfect...I realized theres a major bug in it. I doesn't allow usernames with spaces in them.

I found the problem, but don't know what to change it to. Can anyone help?

Heres the problem Lines:
CODE

// Replace underscores with spaces, so we know what we're dealing with.
    $rsn = str_replace("_", " ", $rsn);
    // If it isn't alphanumberic, or it isn't 12 or fewer characters, stop the script.
    if(!ctype_alnum($rsn) || strlen($rsn) > 12) {
        die("You did not enter a valid username!");
    }

Tyranno
This is a serious problem and you should consult your GP immediately.

Do not tell anyone about it, avoid public spaces and wear sunglasses as much as possible - light is fatal.
Fishfish0001
QUOTE(Tyranno @ May 9 2009, 12:15 PM) *

This is a serious problem and you should consult your GP immediately.

Do not tell anyone about it, avoid public spaces and wear sunglasses as much as possible - light is fatal.

Could you be any less helpful?
kreotis
Oh its possible
Cmafai
Sorry bud, Tyranno is a bit odd in the brain! We still love him though wub.gif

Anywho, I wrote that code, and I have no idea what I was thinking smile.gif Try this (I just free coding this I haven't tested it at all, so no guarantees...):

CODE

// Replace underscores with spaces, so we know what we're dealing with.
    $rsn = str_replace("_", " ", $rsn);
    // If it isn't alphanumberic, or it isn't 12 or fewer characters, stop the script.
    if(!ctype_alnum(str_replace(" ","",$rsn)) || strlen($rsn) > 12) {
        die("You did not enter a valid username!");
    }


Basically the ctype_alnum() checks if it is a string that is all alphanumeric, but spaces aren't included in that I guess, so adding a simple str_replace() to remove the spaces while you check it's validity should fix that.

Tell me if that doesn't fix it, and I'll open up the script and actually play with it a bit. Thanks for using it smile.gif

Fishfish0001
Yes it did work. Thank you so much smile.gif
Rob
QUOTE(Fishfish0001 @ May 9 2009, 05:18 PM) *

QUOTE(Tyranno @ May 9 2009, 12:15 PM) *

This is a serious problem and you should consult your GP immediately.

Do not tell anyone about it, avoid public spaces and wear sunglasses as much as possible - light is fatal.

Could you be any less helpful?


Sensible and an efficient error spotter. Feel like becoming a Content Developer?
Tyranno
i love you
Rob
And I would tear you a new one. <3
Tyranno
behave
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.