Jump to content

Need HELP !


Dinossauro

Recommended Posts

Posted

Hello

I have a resource login and registration here, but I do not know what is the function to block certain characters and color codes. I wonder what is the function that prevents the creation of accounts with special characters and colors.

Thank you.

Posted

probably use a regular expressions like so

  
username = 'whatever32$#@(*$59' 
if username:match('[a-zA-Z0-9]+') ~= nil then  
    print 'It is alright' 
else  
    print 'It contains illegal characters or is not long enough' 
end 
  

tested for syntax and functionality

the regex I used ([a-zA-Z0-9]+) means: allow any character in range of a-z, A-Z, underscores and 0-9 and require at least one of those with no maximum

check out RegExr to build and test your own regular expression

Posted
probably use a regular expressions like so
  
username = 'whatever32$#@(*$59' 
if username:match('[a-zA-Z0-9]+') ~= nil then  
    print 'It is alright' 
else  
    print 'It contains illegal characters or is not long enough' 
end 
  

tested for syntax and functionality

the regex I used ([a-zA-Z0-9]+) means: allow any character in range of a-z, A-Z, underscores and 0-9 and require at least one of those with no maximum

check out RegExr to build and test your own regular expression

Could add to this script code that prohibits the use of color codes?

Thank you.

Posted

nay dawg you obviously need to change the hardcoded values to shiz like guiGetText and instead of those prints you do the actual handling like draw a popup when its wrong and trigger your server side code to do sql shiz

Posted

Okay, I shall formulate it so it is better to understand or translatable by a machine:

Indeed. The code I have posted won't work instantly. Because you must replace the values I have set manually by functions such as guiGetText. Instead of the lines where I put "print", you must put the actual handling. Such as showing a pop-up window when the check fails. And when the check succeeds, put code so your server does things like SQL "INSERT"-commands. If you are checking if the username is okay in a client-side script, you also must put a trigger for the code on the side of your server (server-side). Because you can not use SQL-commands directly on the client-side.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...