Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Accounts (http://www.mysidiaadoptables.com/forum/showthread.php?t=3914)

Nieth 12-11-2012 06:07 PM

Accounts
 
Alright, quick question;

Is there a way to limit the characters on a the account creation in the Mysidia script? Because someone on our website made a username with a semi-colon in it and it looks like it's interfering with the script. When the user's name comes up in a friend request box or something like that, their name appears blank! As if there is nothing there.

So is there a way to fix this, or a way to limit what characters users are able to use when creating an account?

Hall of Famer 12-11-2012 09:26 PM

It is not difficult to fix. I dont wish to touch the UserValidator class though since its way too messy and likely to be replaced in future. For now, just go to register.php file and find this line:

PHP Code:

elseif($mysidia->input->action() == "register"){
  
// First of all, lets examine if the user register session is set
  
$mysidia->session->validate("register"); 

add below:

PHP Code:

$pattern '#^[A-Z0-9 ]+$#i';
if(!
preg_match ($pattern$mysidia->input->post("username"))){
    throw new 
Exception("Error: Invalid Username Specified, it can only contain alphanumeric characters and blank space!");    



Nieth 12-12-2012 06:15 AM

Thanks Hall of Famer. Much appreciated.

Hall of Famer 12-12-2012 12:16 PM

No worries, glad it worked out. Thought it wouldnt be a long term solution to throw an exception like that, but for now its the easiest way to fix this thing up.

Nieth 12-12-2012 12:44 PM

Yeah, the only thing wrong with it is that it leads to a white page with a 'fatal error' instead of appearing on the website, but it's alright for now.


All times are GMT -5. The time now is 11:31 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.