Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <?php
  2. class faggots
  3. {
  4.     public function escape($str)
  5.     {
  6.                 $s = array("\\","\0","\n","\r","\x1a","'",'"');
  7.                 $r = array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
  8.                
  9.                 return str_replace($s, $r, $str);
  10.     }
  11.     public function prot($data)
  12.     {
  13.        
  14.           $data = trim(htmlentities(strip_tags($data)));
  15.         if(get_magic_quotes_gpc())
  16.         {
  17.             $data = stripslashes($data);
  18.         }
  19.             $data = $this->escape($data);
  20.  
  21.             return $data;
  22.        
  23.     }
  24. }
  25. $host = '\SQLEXPRESS';
  26. $usr = 'as';
  27. $pwd = '';
  28. $db = 'account_dbf';
  29. $salt = 'serus';
  30.  
  31. if(isset($_POST['submit'])):
  32.     if(!isset($_POST['username']))
  33.     {
  34.         die("Please input your username");
  35.     }else if(!isset($_POST['password']))
  36.     {
  37.         die("Please enter your password");
  38.     }else
  39.     {
  40.         $con = mssql_connect($host, $usr, $pwd) or die("Could not connect to the database");
  41.         $db = mssql_select_db($db, $con) or die("Could not select database");
  42.        
  43.         $core = new faggots;
  44.        
  45.         $username = $core->prot($_POST['username']);
  46.         $password = $core->prot($_POST['password']);
  47.         $password = md5($salt . $password);
  48.        
  49.         $query = mssql_query('UPDATE `account_tbl` SET password="' . $password . '" WHERE account="' . $username . '"');
  50.         if($query)
  51.         {
  52.             echo "Password has been sucessfully updated!";
  53.         }else
  54.         {
  55.             echo "Something went wrong under execution.";
  56.         }
  57.        
  58.     }
  59.  
  60. endif;
  61.  
  62.  
  63. ?>
  64.  
  65. <form method="post">
  66. <table border="0">
  67. <tr><td>Username</td><td><input type="text" name="username" value="" /></td></tr>
  68. <tr><td>New password</td><td><input type="password" name="password" value="" accept="" /></td></tr>
  69. <tr><td></td><td><input type="submit" name="submit" value="Change Password" /></td></tr>
  70. </table>
  71. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement