PDA

View Full Version : Problems registering with Unicode


Mike Sullivan
Mon 16th Jun '03, 4:17pm
This is all in register.php. Find:if (strpos($_POST['username'], ';') !== false)

Replace it with:

if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $_POST['username']))

You will also want to remove the code in red from the line below:

$_POST['username'] = trim(preg_replace('#\s+#si', ' ', unhtmlspecialchars($_POST['username'])));

Now in admincp/user.php you want to find:

if (strpos($user['username'], ';') !== false)

Replace it with:

if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $user['username']))

Mike Sullivan
Mon 16th Jun '03, 4:21pm
All in private.php. Find:
else if (strpos($pm['recipients'], ';') !== false) // multiple recipients attempted
Replace with:
else if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $pm['recipients'])) // multiple recipients attempted
Now find: (about 2 lines down)
$users = explode(';', $pm['recipients']);
Replace with:
$users = preg_split('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $pm['recipients'], -1, PREG_SPLIT_NO_EMPTY);

Chris M
Mon 16th Jun '03, 5:47pm
Cheers Ed:)

Satan

Marco
Tue 17th Jun '03, 8:43am
Now I see why you're the resident regex master ;)

squawell
Tue 17th Jun '03, 2:49pm
does is fix this error

""Semi-colons are not allowed in usernames. ""

if yes,after i try it and still get that error when i use japenese word to

registe...any idea?

Mike Sullivan
Tue 17th Jun '03, 3:11pm
Paste what you're trying to register with here.

squawell
Wed 18th Jun '03, 1:19am
Paste what you're trying to register with here.this is what i try to do in my 3.0 test forum -- ""おのずと""....

Mike Sullivan
Wed 18th Jun '03, 12:42pm
this is what i try to do in my 3.0 test forum -- ""おのずと""....
Ahh right, those are 5 digit unicode characters. Let me see what I can do.

squawell
Wed 18th Jun '03, 12:51pm
Ahh right, those are 5 digit unicode characters. Let me see what I can do.
thankz that!!

and that also happen in acp when i try to use that add a user....

Mike Sullivan
Wed 18th Jun '03, 1:20pm
Code updated. Let me know if it doesn't work.

squawell
Wed 18th Jun '03, 2:00pm
Code updated. Let me know if it doesn't work.
thankz Ed....

but it only work in register part.....after regiter...it mess-up in main page

おのずと become to JnZhand if u logot try to login u will get

this message

You have entered an invalid username or password. Please press the back button, enter the correct details and try again. Don't forget that the password is case sensitive. Forgotten your password? Click here (http://www.squawellfunclub.pcbbs.com.tw/vbb3/login.php?s=&do=lostpw)!

You have used 1 out of 5 login attempts. After all 5 have been used, you will be unable to login for 15 minutes.


any idea fix this??

Mike Sullivan
Thu 19th Jun '03, 4:44pm
I couldn't reproduce the error of the text being changed with a different set of unicode. I was able to register with a unicode name and my name was displayed correctly on the main page.

The login issue is from client-side md5'ing. I'm not sure how to resolve it right now; we're looking into it.

Mike Sullivan
Thu 19th Jun '03, 7:51pm
Ok, Scott created a nice JS function that converts the unicode characters to the proper format for client-side md5'ing. It'll be in beta 4. :)

squawell
Fri 20th Jun '03, 1:11am
Ok, Scott created a nice JS function that converts the unicode characters to the proper format for client-side md5'ing. It'll be in beta 4. :)
glad to hear that.......thankz Ed&Scott....:)