Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-06-2017, 09:20 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 96,058
Dinocanid is on a distinguished road
Default

I'm not too sure on the date checking, but you should be able to prevent special characters in usernames by adding this under "protected function usernamevalidate" in class_registervalidator.php:
PHP Code:
if(preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/'$username)){

         
$this->seterror("Your username cannot contain special characters!");

         return 
FALSE;

      } 
So it looks like this:
PHP Code:
protected function usernamevalidate($username ""){
      
// The username validator, note its a bit complicate here due to the different mechanism of username check for register and other validators
      
$lang Registry::get("lang");
      if(!
$this->emptyvalidate($username)){
         
$this->seterror("The field Username is Empty.");
         return 
FALSE;
      }
      if(
$username == "SYSTEM"){
         
$this->seterror("Cannot use SYSTEM as username.");
         return 
FALSE;
      }
      if(
preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/'$username)){
         
$this->seterror("Your username cannot contain special characters!");
         return 
FALSE;
      }
      
$username = (empty($username))?$this->value['username']:$username;      
      
$userexist $this->datavalidate("users", array("username"), "username = '{$username}'");
      if(
$userexist == TRUE){
         
$this->seterror($lang->user);
         return 
FALSE;
      }
      else return 
TRUE;
  } 
I haven't tried it, but I got the answer from here:
http://stackoverflow.com/questions/3...characters-php

EDIT: Thought I should say that this won't/can't do anything about users who already registered with special characters; only new ones.
__________________

Last edited by Dinocanid; 05-06-2017 at 09:37 PM.
Reply With Quote
 


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 -5. The time now is 04:56 PM.

Currently Active Users: 10181 (0 members and 10181 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636