Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case "token":
- if(empty($args[1])){
- return $dAmn->say("$from: Usage:{$tr}token <i>username [password]</i>. If the username is on the list, it'll try using the password. Otherwise, it'll ask for the password.",$c);
- }
- if($user->has($from, 99)){
- $tuser = strtolower($args[1]);
- //Is our username on the list? Let's check.
- if(isset($config['logins']['login'][strtolower($args[1])])){
- //The passwords are encoded.. let's decode the one we'll be using.
- $tpass = base64_decode($config['logins']['login'][strtolower($args[1])]);
- //Perhaps our username isn't on that list. Let's check the secondary one.
- }elseif(isset($config['invisilogins']['login'][strtolower($args[1])])){
- //Found? Declaring password.
- $tpass = $config['invisilogins']['login'][strtolower($args[1])];
- //Perhaps it's not on either list. If a second argument was included, we'll be using that as the password.
- }elseif(!empty($args[2])){
- $tpass = $args[2];
- //If no password was included either, let's see who sent the command.
- }elseif(empty($args[2])){
- //If the owner sent the command, they have the option of putting the password in the bot window.
- if($from == $config['bot']['owner']){
- $dAmn->say("$from: Place password in bot window.",$c);
- print "\nPlease input {$args[1]}'s password below.\n";
- //After they've put the password in.. let's declare our pass found.
- $tpass = trim(fgets(STDIN));
- }else
- //If the owner wasn't the command sender, they can't enter the password into the window. No use killing the bot so, let's kill the command.
- return $dAmn->say("$from: $args[1] is not a stored login. Username and password required for non-stored logins.",$c);
- }
- //Now for the token grabber. Let's send the username and password.
- $tcheck = testlogin($tuser, $tpass);
- //If we got an array returned, there's no authtoken in there. Let's show the error so we know what's wrong.
- if(is_array($tcheck)){
- return $dAmn->say("$from: Error returned. {$tcheck['error']}",$c);
- }
- //Success! We got an authtoken. Mission accomplished.
- if($args[0] == "login"){
- //For the login command, we're gonna set up the config so that when it logs in, it'll be using our new login and token.
- $config['bot']['username'] = $args[1];
- $config['bot']['token'] = $tcheck;
- save_config("bot");
- $dAmn->say("$from: Login accepted. Changing logins, please wait.",$c);
- //With that all set up, we're gonna send the disconnect. The bot will use the stored info to try and login.
- $dAmn->send("disconnect\n".chr(0));
- }else{
- //For token, we're just gonna send the javascript command to the requester.
- $dAmn->say("$from: javascript: dAmn_Login(\"{$args[1]}\",\"{$tcheck}\");",$c);
- }
- }else
- return $dAmn->say("$from: This is an owner-only command.",$c);
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement