Jump to content

[SOLVED] need help blocking user


dose

Recommended Posts

ok so i have a gamer card script going with help from a few friends, and we noticed a user putting in random junk..

 

main code is excluded but this is how we are grabbing the user name. my question is how could we make the script stop executing if $user = a certain name?

 

if(!empty($_GET['user'])) {

// cache
$user = str_replace(" ", "", strtolower($_GET['user']));	// remove spaces and lower 

}

 

 

ive tried to use

 

if($user = "kipu") {
exit;
}

 

but when i do that it stops working for every name..

Link to comment
https://forums.phpfreaks.com/topic/180280-solved-need-help-blocking-user/
Share on other sites

Hi dose,

 

Using the following will work:

 

if(!empty($_GET['user'])) {

if($_GET['user']=='kipu')
{
exit();
}
else
{
// cache
$user = str_replace(" ", "", strtolower($_GET['user']));	// remove spaces and lower 
}
}

 

 

Or, you could do it using:

 

if(!empty($_GET['user'])) {
// cache
$user = str_replace(" ", "", strtolower($_GET['user']));	// remove spaces and lower 

if($user=='kipu')
{
exit();
}

}

 

The first method performs the check on the username as it is fetched using the $_GET command, the second method performs the check once the username has been fetched and has been stored into the $user variable.

 

Hope this helps.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.