Advertisement
Guest User

PHP file

a guest
Mar 28th, 2015
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. <?php
  2.  define('DB_HOST', 'localhost');
  3.  define('DB_NAME', 'housemaker');
  4.  define('DB_USER','root');
  5.  define('DB_PASSWORD','');
  6.  $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
  7.  $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
  8.  
  9.  function NewUser() {
  10.  
  11.  $fullname = $_POST['name'];
  12.  $category = $_POST['cat'];
  13.  $email = $_POST['email'];
  14.  $phone = $_POST['phone'];
  15.  $address1 = $_POST['address1'];
  16.  $address2 = $_POST['address2'];
  17.  $address3 = $_POST['address3'];
  18.  $location=$_POST['location'];
  19.  $pincode = $_POST['pincode'];
  20.  $city = $_POST['city'];
  21.  $password = $_POST['password'];
  22.  $password = md5($password);
  23.  $query = "INSERT INTO `temp-registration`(`name`, `cat`, `email`, `phno`, `add_line1`, `add_line2`, `add_line3`, `location`, `pincode`, `city`, `password`) VALUES ('$fullname','$category','$email','$phone','$address1','$address2','$address3','$location','$pincode','$city','$password')";
  24.  $data = mysql_query ($query)or die(mysql_error());
  25.  if($data) {
  26.  echo "YOUR REGISTRATION IS COMPLETED. PLEASE WAIT UNTIL ADMIN VERIFIES YOUR DETAILS";
  27.  header("refresh:5;url=index.php");
  28.  }
  29.  }
  30.  function SignUp() {
  31.  if(!empty($_POST['email'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text
  32.  {   
  33.  $email = $_POST['email'];
  34.  $query = "SELECT * FROM `provider-registration` WHERE email = '$email'";
  35.  $query_exe=mysql_query($query) or die(mysql_error());
  36.  //echo $query;
  37.  if(!$row = mysql_fetch_array($query_exe) or die(mysql_error())) {
  38.  newuser();
  39.  
  40.  }
  41.  else {
  42.  echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; }
  43.  }
  44.  }
  45.  if(isset($_POST['submit'])) { SignUp(); }
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement