Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Username limitation  (Read 3291 times)

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Username limitation
« on: August 25, 2007, 12:30:18 pm »

Hello,

I was hoping it is possible to make the username limitation of characters larger than 8 (to, say, 10 or 12).

How is this done, if possible?
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: Username limitation
« Reply #1 on: August 25, 2007, 04:35:17 pm »

There is this function in snews.php:
Code: [Select]
// USER/PASS CHECK
function checkUserPass($input) {
$output = clean(cleanXSS($input));
$output = strip_tags($output);
if (ctype_alnum($output) === true && strlen($output) > 3 && strlen($output) < 9) {return $output;}
else {return null;}
}

Replace that 9 with whatever You need ;)
Logged

lessismore

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 67
Re: Username limitation
« Reply #2 on: August 25, 2007, 07:23:40 pm »

The GUI will let you change the pwd length without changing the code, but thanks for pointing out that code tidbit as I was looking to enable periods and your post paved the way.

So far, so good - hope it doesn't break something (sorry I couldn't figure out how to use fancy colors - used crazy formatting to show the changes instead:
Code: [Select]
// USER/PASS CHECK
function checkUserPass($input) {
$output = clean(cleanXSS($input));
$output = strip_tags($output);
$orig_output = $output;
$output = str_replace(".","",$output);
if (ctype_alnum($output) === true && strlen($output) > 3 && strlen($output) < 9) {
return $orig_output;}
else {return null;}
}

Not perfect though ... the msgs to the users about lengths are going to be off by one.
Btw, that string replace was a period replaced with nothing ...

« Last Edit: August 25, 2007, 07:25:11 pm by lessismore »
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
Re: Username limitation
« Reply #3 on: August 25, 2007, 07:54:10 pm »

The GUI will let you change the pwd length without changing the code, but thanks for pointing out that code tidbit as I was looking to enable periods and your post paved the way.
What exactly are You talking about? Default sNews without modifications has no control over password length except in quoted function.
Logged

lessismore

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 67
Re: Username limitation
« Reply #4 on: August 25, 2007, 10:20:11 pm »

The GUI will let you change the pwd length without changing the code, but thanks for pointing out that code tidbit as I was looking to enable periods and your post paved the way.
What exactly are You talking about? Default sNews without modifications has no control over password length except in quoted function.
It's in the MU version - sorry for the confusion and thanks for all your contributions - this forum has some gurus.
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Re: Username limitation
« Reply #5 on: August 25, 2007, 10:34:22 pm »

No no no... with multiusers, you CAN change the length of the password allowed through the admin panel, as the code is this:
Code: [Select]
// USER/PASS CHECK
function checkUserPass($input) {
$output = clean(cleanXSS($input));
$output = strip_tags($output);
if (ctype_alnum($output) === true && strlen($output) > 3 && strlen($output) < s('length_password')) {return $output;}
else {return null;}
}

But I'm looking to change the limitations for the USER NAME itself.
Logged

lessismore

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 67
Re: Username limitation
« Reply #6 on: August 25, 2007, 10:51:45 pm »

But I'm looking to change the limitations for the USER NAME itself.

The only two limitations in the if statement are alnum and length (min/max).
This thread shows how to change both - what are the limitations you wish to change?
Logged

ens

  • Sr. Member
  • ****
  • Karma: 12
  • Posts: 279
    • http://www.meatysite.info
Re: Username limitation
« Reply #7 on: August 26, 2007, 02:23:45 am »

Oh boy do I feel stupid... never mind. Thanks.

(I didn't realize that that password limitation also was the same thing for the username!)
« Last Edit: August 26, 2007, 02:27:01 am by ens »
Logged

perk1z

  • Newbie
  • *
  • Karma: 0
  • Posts: 12
Re: Username limitation
« Reply #8 on: September 02, 2007, 07:14:07 pm »

and how to change keyword limitation?
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Username limitation
« Reply #9 on: September 02, 2007, 08:41:45 pm »

perk1z -- the Search function  is your friend. See this thread for answer: http://snewscms.com/forum/index.php?PHPSESSID=2af7a03dd6d1ccf62919cc2030e3d114&topic=5778.0

Actually, it can be simplified even further: [assuming you're using PHPMyAdmin] Access your database, click "Settings" in the table list, click the pen tool on field "Value", to edit it. In Value, change the default "60" to "255". Save the change. You now have 255 characters to play with in all settings that use character limit -- including keywords and description.

As noted in the thread mentioned above, I don't know what the max limit is or even if there is a max limit, but 255 characters is a substantial amount for these things (they should be kept short, succinct and to the point).
Logged

perk1z

  • Newbie
  • *
  • Karma: 0
  • Posts: 12
Re: Username limitation
« Reply #10 on: September 03, 2007, 06:44:45 am »

thx Fred K (agentsmith), its worked now  :)
Logged