Login Script

taekwondokid42

New Member
Messages
268
Reaction score
0
Points
0
I have created a login script, but I am having problems with the spaces. Is there any way that I can disallow the space character in my signup forms?

something like

if (username has a space in it){
echo "You cannot have spaces in your username";
}else{

...
 

supajason

Member
Messages
288
Reaction score
2
Points
18
i think this is right?

PHP:
$name = 'supa jason';
$find   = ' ';
$string = strpos($name, $find);

if ($string === false) {
    echo "no spaces'";
} else {
    echo "the string has a space";
}
 

taekwondokid42

New Member
Messages
268
Reaction score
0
Points
0
I like the strpos better.

Let me get this staight.

<?
$username = I made a username!;
$find = ' ';
$string = strpos($username, $find);

if ($string == true) {
echo "You are not allowed to have spaces in your username!!";
} elseif ($string == false) {
//rest of createuser script
}


I just tried it out. This is what I'm looking for :)
 
Last edited:
Top