Advertisement
Niko_boy

Untitled

Jan 31st, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.87 KB | None | 0 0
  1.     new //cmd[36],
  2.     newpass[64],oldpass[64];
  3.  // new password[256];
  4.  
  5.     unformat(message,"s[64]s[64]s[64]",cmd,oldpass,newpass);
  6.     if( strlen(cmd) )
  7.     {
  8.         if( !strcmp( cmd , "changepass" , true ) )
  9.         {
  10.             if( !strlen( param ) )
  11.                 return IRC_Say( botid , user , "USAGE: /msg Sonic changepass <oldpass> <password>" );
  12.  
  13.             if(IsLogin == 1)
  14.             {
  15.                 if(IsValidPass(user,oldpass))
  16.                 {
  17.                     new Query[128],string[128];
  18.                     format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `name` = '%s' LIMIT 1",user);
  19.                     mysql_query(Query);
  20.                     mysql_store_result();
  21.  
  22.                     if(!mysql_num_rows())//if number of rows is different from 0 then continue
  23.                     {
  24.                         mysql_free_result();
  25.                         format(string,sizeof(string),"Error:%s , This User Name Does not exists! ",user);
  26.                         IRC_Say(botid,user,string);
  27.                     }
  28.                     else
  29.                     {
  30.                         mysql_free_result();
  31.                         mysql_real_escape_string(newpass, newpass);
  32.                         WP_Hash(password, sizeof(password), newpass);
  33.                        
  34.                         new sql[256];//UPDATE `users` SET `join message`='%s' WHERE `name`='%s'
  35.                         format(sql, sizeof(sql), "UPDATE `users` SET `password`='%s' WHERE `name`='%s';", password, user);
  36.                         SendQuery(sql);//SELECT * FROM `users` WHERE `name` = '%s' AND `Password` = SHA1('%s')
  37.                        
  38.                         format(sql,sizeof(sql),"Successfully Changed Password to [ %s ] , do /hop and re-login to verify if it worked!",newpass);
  39.                         IRC_Say( botid , user ,sql);
  40.                     }
  41.                 }else return IRC_Say( botid , user , "Old Password doesnt matched!");
  42.                
  43.             }else if(IsLogin==0){return IRC_Say( botid , user , "Error: You Need to login before changing Password!" );}
  44.         }
  45.         else if(strfind(cmd, "changepass", true) != -1)
  46.            return IRC_Say( botid , user , "USAGE: /msg Sonic changepass <oldpass> <password>" );
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement