Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new //cmd[36],
- newpass[64],oldpass[64];
- // new password[256];
- unformat(message,"s[64]s[64]s[64]",cmd,oldpass,newpass);
- if( strlen(cmd) )
- {
- if( !strcmp( cmd , "changepass" , true ) )
- {
- if( !strlen( param ) )
- return IRC_Say( botid , user , "USAGE: /msg Sonic changepass <oldpass> <password>" );
- if(IsLogin == 1)
- {
- if(IsValidPass(user,oldpass))
- {
- new Query[128],string[128];
- format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `name` = '%s' LIMIT 1",user);
- mysql_query(Query);
- mysql_store_result();
- if(!mysql_num_rows())//if number of rows is different from 0 then continue
- {
- mysql_free_result();
- format(string,sizeof(string),"Error:%s , This User Name Does not exists! ",user);
- IRC_Say(botid,user,string);
- }
- else
- {
- mysql_free_result();
- mysql_real_escape_string(newpass, newpass);
- WP_Hash(password, sizeof(password), newpass);
- new sql[256];//UPDATE `users` SET `join message`='%s' WHERE `name`='%s'
- format(sql, sizeof(sql), "UPDATE `users` SET `password`='%s' WHERE `name`='%s';", password, user);
- SendQuery(sql);//SELECT * FROM `users` WHERE `name` = '%s' AND `Password` = SHA1('%s')
- format(sql,sizeof(sql),"Successfully Changed Password to [ %s ] , do /hop and re-login to verify if it worked!",newpass);
- IRC_Say( botid , user ,sql);
- }
- }else return IRC_Say( botid , user , "Old Password doesnt matched!");
- }else if(IsLogin==0){return IRC_Say( botid , user , "Error: You Need to login before changing Password!" );}
- }
- else if(strfind(cmd, "changepass", true) != -1)
- return IRC_Say( botid , user , "USAGE: /msg Sonic changepass <oldpass> <password>" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement