WowUltra Forums Home 
Search     Members Calendar Help Home
Search by username
Not logged in - Login | Register 

 Moderated by: Jim
New Topic Reply Printer Friendly
& in a username - Bug Reports - News and Announcements - WowUltra Forums
AuthorPost
 Posted: Sat Jun 7th, 2008 10:50 am
PMQuoteReply  
1st Post
jefe
Member


Joined: Wed Nov 21st, 2007
Location: Padul Granada, Spain
Posts: 12
Status: 
Offline
Mana: 
Hi jim & Di
Is there a way to stop users using the '&' in a user name as we have quite a few members that register E.G. ron&judy  when it shows in the new member, who's on line & in the profile it comes out like this  ron&judy
jefe

Back To Top PMQuoteReply

 Posted: Sat Jun 7th, 2008 06:12 pm
PMQuoteReply  
2nd Post
wingnutter
Forever Learning


Joined: Wed May 14th, 2008
Location: Ireland
Posts: 582
Status: 
Offline
Mana: 
This used to work in WOW 1.7, but don't try it until Jim gives it the green light as I don't know if it works in Ultra;


Preventing & being used in usernames, V1.7 or higher (meaning not tested in previous versions)

It will prevent the listed special characters from being used in a username.

In login.php, you can insert the following line:

if (preg_match('/(\'|"|\|)+/', $user_info["user_name"]))
      error("invalid_username", array("user_names" => stripslashes($user_info["user_name"])));



right above:

$user_info["user_theme"] = THEME;


All credit to whoever thought it up for WOW, I just copied and saved it.

Back To Top PMQuoteReply

 Posted: Sat Jun 7th, 2008 08:02 pm
PMQuoteReply  
3rd Post
Jim
Administrator


Joined: Wed Apr 11th, 2007
Location:  
Posts: 1511
Status: 
Online
Mana: 
I thought that was for apostrophes? I don't see the & char in that statement, I'll try it and add it. I believe Aycan did that and Marty posted it.

The apostrophe fix is already part of Ultra, however I really should fix the problem eventually so any character can be used.

Back To Top PMQuoteReply

 Posted: Sat Jun 7th, 2008 09:13 pm
PMQuoteReply  
4th Post
wingnutter
Forever Learning


Joined: Wed May 14th, 2008
Location: Ireland
Posts: 582
Status: 
Offline
Mana: 
Just as well you had a look at it Jim. ;)

Back To Top PMQuoteReply

 Posted: Sat Jun 7th, 2008 09:42 pm
PMQuoteReply  
5th Post
Jim
Administrator


Joined: Wed Apr 11th, 2007
Location:  
Posts: 1511
Status: 
Online
Mana: 
OK I was right, that is for quotes and apostrophes. To add this "&" replace that exact line above that is already part of Ultra with this:

if (preg_match('/(\'|"|&|\|)+/', $user_info["user_name"]))
      error("invalid_username", array("user_names" => stripslashes($user_info["user_name"])));


I will have a fix in the next version where we will be able to use special characters without excluding them.

Jim

Back To Top PMQuoteReply

 Posted: Sun Jun 8th, 2008 05:10 pm
PMQuoteReply  
6th Post
wingnutter
Forever Learning


Joined: Wed May 14th, 2008
Location: Ireland
Posts: 582
Status: 
Offline
Mana: 
Thanks Jim. If I read that right, Ultra already excludes "&" from usernames?

Back To Top PMQuoteReply

 Posted: Sun Jun 8th, 2008 07:35 pm
PMQuoteReply  
7th Post
Jim
Administrator


Joined: Wed Apr 11th, 2007
Location:  
Posts: 1511
Status: 
Online
Mana: 
No not yet, but I'll put it in on yours since I'm upgrading you tonight. Ultra makes it impossible to include an apostrophe in a name, I didn't even know till this post that the & was a problem! The alternate code I posted will work for excluding the & as well as the apostrophe.

Back To Top PMQuoteReply

 Posted: Mon Jun 9th, 2008 12:19 pm
PMQuoteReply  
8th Post
wingnutter
Forever Learning


Joined: Wed May 14th, 2008
Location: Ireland
Posts: 582
Status: 
Offline
Mana: 
That's excellent Jim, thanks.

Back To Top PMQuoteReply

 Posted: Tue Jun 10th, 2008 07:09 am
PMQuoteReply  
9th Post
jefe
Member


Joined: Wed Nov 21st, 2007
Location: Padul Granada, Spain
Posts: 12
Status: 
Offline
Mana: 
Have replaced:

if (preg_match('/('|"||)+/', $user_info["user_name"]))
      error("invalid_username", array("user_names" => stripslashes($user_info["user_name"])));

with:
if (preg_match('/('|"|&||)+/', $user_info["user_name"]))
      error("invalid_username", array("user_names" => stripslashes($user_info["user_name"])));


that seems to have stoped  the problem
thanks

Last edited on Tue Jun 10th, 2008 07:09 am by jefe

Back To Top PMQuoteReply

Current time is 02:52 am  
WowUltra Forums > News and Announcements > Bug Reports > & in a username



WowUltra 1.15 Copyright © 2007-2008 by Jim Hale
Page processed in 0.2286 seconds (12% database + 88% PHP). 20 queries executed.