Moderators: OldWolf, re*s.t.a.r.s.*2
if($nick == moderator ){
header('location:where I want to go');
}
$user_name = "Wordpress database nickname";
if ($user_name =="moderator"){
$params['isadmin'] = TRUE;
}else{
$params['isadmin'] = FALSE;
}
re*s.t.a.r.s.*2 wrote:[...] I thought it would good Idea to test the value the user types in the PROMPT form of the chat and disallow the access if they typed the moderator nick..
require_once('../blog/wp-config.php');//start admin protection
$current_user = wp_get_current_user();
$user_name = addslashes($current_user->display_name);
$nick = $params[0];//original with the chat
if($nick == moderator){
if (empty($user_name)){
return false;
}
}//end protection code
What if I register as a normal user on your wordpress and then connect to your chat with the moderator nick?
$nick == moderator is true but $user_name is set (as I'm a registered user) so it doesn't return false.
Now I can connect to chat with moderator nick...but I'm not your moderator.
You cant because there a previous test that checks if $user_name is empty and if you are registered this wouldnt be empty , will hold your nick and the test do so, so it gives this nickname to the chat, now if empty, then you haven logged in or registered and then will show you the PFC prompt,.
Return to General Support (v1.x)
Users browsing this forum: No registered users and 66 guests