Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. $existance = mysql_query("SELECT username FROM users WHERE username = '" . $username . "'");
  3. if( !$existance ){
  4. $query = "INSERT into `users` (username, password, email, trn_date) VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
  5. $result = mysql_query( $query );
  6. if ( $result ) {
  7. echo "<div class='form'><h3>You are registered successfully.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
  8. }
  9. else{
  10. //unsuccessful insertion
  11. }
  12. } else {
  13. //the user existed already, choose another username
  14. }
  15. ?>
  16.  
  17. if ($num_rows > 1) { $error = 1; } else { $error = 0; }
  18. if ($error == 0) { $query = "INSERT into `users` (username, password, email, trn_date) VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
  19. $result = mysql_query($query);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement