Advertisement
Guest User

Untitled

a guest
Nov 4th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2.    
  3.     if(isset($_POST["register"])){
  4.    
  5.     if(!empty($_POST['full_name']) && !empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password'])) {
  6.   $full_name= htmlspecialchars($_POST['full_name']);
  7.     $email=htmlspecialchars($_POST['email']);
  8.  $username=htmlspecialchars($_POST['username']);
  9.  $password=htmlspecialchars($_POST['password']);
  10.  $query=mysql_query("SELECT * FROM usertbl WHEREusername='".$username."'");
  11.   $numrows=mysql_num_rows($query);
  12. if($numrows==0)
  13.    {
  14.     $sql="INSERT INTO usertbl
  15.  (full_name, email, username,password)
  16.     VALUES('$full_name','$email', '$username', '$password')";
  17.   $result=mysql_query($sql);
  18.  if($result){
  19.     $message = "Account Successfully Created";
  20. } else {
  21.  $message = "Failed to insert data information!";
  22.   }
  23.     } else {
  24.     $message = "That username already exists! Please try another one!";
  25.    }
  26.     } else {
  27.     $message = "All fields are required!";
  28.     }
  29.     }
  30.     ?>
  31.  
  32.     <?php if (!empty($message)) {echo "<p class=\"error\">" . "MESSAGE: ". $message . "</p>";} ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement