PDA

View Full Version : Is the VB Chat turned OFF??


David Copeland
11-13-2005, 12:04 AM
I went to www.vbulletin.org and click on the upper right link tiltled CHAT. The applet loaded, and although I was logged in with my user name showng, inside the chat box it said:

Looking up your hostname

Found your hostname (cache)

That nickname is erroneus. Enter another one.

Ramsesx
11-13-2005, 12:12 AM
I tried, no problem (from germany)

Brad
11-13-2005, 05:12 AM
Sounds like your username doesn't play well with the irc server. If you get that error type "/nick nicknamehere" (without the quotes, replace nicknamehere with the nick you want to use).

Club3G
11-13-2005, 05:36 AM
I use the same Chat, and on my IRC server (EFNet) from what I can tell names with spaces aren't allowed. The applet is setting your nick as "David Copeland", which is why it's bouncing you.

Brad, if you come up with a way to truncate spaces, I'd be mucho appreciative of seeing how you do it. :)

Marco van Herwaarden
11-13-2005, 06:21 AM
Brad, if you come up with a way to truncate spaces, I'd be mucho appreciative of seeing how you do it.If you mean to remove spaces inside names, you could use simply:
$name = str_replace(" ", "", $name);

eXtremeTim
11-13-2005, 06:52 AM
If you mean to remove spaces inside names, you could use simply:
$name = str_replace(" ", "", $name);

Darn I got beat to it lol.

Club3G
11-13-2005, 07:04 AM
Aah, outstanding, thanks. :D I've no idea how to get php to actually pull the vb name variable and stuff it into $name, but I'll look into doing it. :D

(Sorry for turning this into an impromptu quick hack support discussion, lol)

Dean C
11-13-2005, 09:12 AM
If you mean to remove spaces inside names, you could use simply:
$name = str_replace(" ", "", $name);

Or better yet :D


$name = preg_replace('/[^A-Za-z0-9-_`\[\]]/i', '', $name);

Lea Verou
11-14-2005, 09:17 AM
Or better yet :D


$name = preg_replace('/[^A-Za-z0-9-_`\[\]]/i', '', $name);


Ahh those regular expressions... They are too difficult :(

Brad
11-14-2005, 09:31 AM
At first yes, but once you get the hang of them they become very powerful. :)

Lea Verou
11-14-2005, 09:34 AM
At first yes, but once you get the hang of them they become very powerful. :)

Yes, I can understand that but they are still difficult :p
And my book only talks about the other ones (those that work with ereg_replace :()

Brad
11-14-2005, 09:49 AM
Shame, I notice a lot of them leave out PCRE.

http://www.tote-taste.de/X-Project/regex/

Hopefully you'll find that link of use. ;)

Lea Verou
11-14-2005, 09:51 AM
Shame, I notice a lot of them leave out PCRE.

http://www.tote-taste.de/X-Project/regex/

Hopefully you'll find that link of use. ;)

Thanks, I bookmarked :)
It looks nice-written :)

Marco van Herwaarden
11-14-2005, 09:59 AM
Well by answer was the best for the original question, only to remove the spaces. If you have the choice, a str_replace is much faster. Dean however extended to original question nicely with the removal of some more special characters (although with some limitations that could also be done with str_trplace..

Lea Verou
11-14-2005, 10:02 AM
Well by answer was the best for the original question, only to remove the spaces. If you have the choice, a str_replace is much faster. Dean however extended to original question nicely with the removal of some more special characters (although with some limitations that could also be done with str_trplace..

Yep, why shouldn't that for example be doen with str_replace (many of them for the other characters)? Is it slower?

Marco van Herwaarden
11-14-2005, 10:06 AM
BEcause with a str_replace you can only search for a list of chracters. With regular expressions, you can also deny any character that is not in a list.

David Copeland
11-22-2005, 02:18 AM
Or better yet :D


$name = preg_replace('/[^A-Za-z0-9-_`\[\]]/i', '', $name);



Dean C,

I noticed you are the only one in this thread with a space between first and last name, such as my user name.

So do I have to log out as David Copeland to use this forum's chat?? Or can the webmaster here modify the code to allow anyone with a space to use the live chat?

David

Guest190829
11-22-2005, 02:22 AM
No, once you go into the chat and get the error just type:


/nick NICKNAME

Replace NICKNAME with any other nickname that you want, and that doesn't produce an error. My username isn't allowed either thanks to the period, but I use Danny on the irc.

Chris M
11-22-2005, 02:46 AM
Mine also isn't allowed because of the space - I use ChrisM with no space :)

Chris

Jenta
11-22-2005, 02:55 AM
// bad characters
$cleanchr = preg_replace("/[^ \\\\{}\^`\[\]\|\-\w]/", "", $vbulletin->userinfo['username']);

// leading numbers and dashes
$cleannum = ereg_replace("^[0-9\-]*[0-9\-]", "", $cleanchr);

// convert spaces to underscores
$nick = ereg_replace(" ", "_", $cleannum);

Chris M
11-22-2005, 03:37 AM
// bad characters
$cleanchr = preg_replace("/[^ \\\\{}\^`\[\]\|\-\w]/", "", $vbulletin->userinfo['username']);

// leading numbers and dashes
$cleannum = ereg_replace("^[0-9\-]*[0-9\-]", "", $cleanchr);

// convert spaces to underscores
$nick = ereg_replace(" ", "_", $cleannum);


I'm sure you meant $bbuserinfo[username] ;)

We aren't on 3.5 yet ;);)

Chris