daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. ob_start();
  3.  
  4. session_start();
  5.  
  6. include('connection.php');
  7.  
  8. if(isset($_SESSION['logged'])) die(header("location: index.php"));
  9.  
  10. if(isset($_POST['submitted']) && $_POST['submitted'])
  11. {
  12.     $con = @mysql_connect($MySQLhost, $MySQLuser, $MySQLpass) or die('MySQL error, retry! 1');
  13.     $db = @mysql_select_db($MySQLdata, $con) or die('MySQL error, retry! 2');
  14.    
  15.     if(isset($_POST['username']) && $_POST['username'] && isset($_POST['password']) && $_POST['password'])
  16.     {
  17.    
  18.         $username = $_POST['username'];
  19.         $password = md5(mysql_real_escape_string($_POST['password']));
  20.         $email = $_POST['email'];
  21.         $gamename = $_POST['gamename'];
  22.        
  23.        
  24.         $query = "SELECT * FROM `users` WHERE `username`='" . mysql_real_escape_string($username) ."'";
  25.         $result = @mysql_query($query) or die('MySQL! Error 4...');
  26.        
  27.         if(mysql_num_rows($result)) die("That name is already in use! <a href='register.php'>Go Back</a>");
  28.        
  29.         $query = "SELECT * FROM `users` ORDER BY `id` DESC LIMIT 1";
  30.         $result = @mysql_query($query) or die('MySQL error, retry! 5');
  31.        
  32.         if(mysql_num_rows($result)) $row = @mysql_fetch_assoc($result) or die('MySQL error, retry 6');
  33.        
  34.         if(isset($row)) $nextID = $row['id'] + 1;
  35.         else $nextID = 1;
  36.        
  37.         $query = "INSERT INTO `users` VALUES ('" . $nextID . "', '" . mysql_real_escape_string($username) . "', '" . $password . "', '0', '" . $email . "', '" . $gamename . "', '0', '0', '0', '0', '0')";
  38.         $result = @mysql_query($query) or die('MySQL error, retry! 7');
  39.        
  40.         if($con) @mysql_close($con) or die('MySQL error, retry! 8');
  41.        
  42.         header("location: Account.php");
  43.     }
  44.     else
  45.     {
  46.         die('Invalid input - retry!');
  47.     }
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top