Advertisement
gitlez

Untitled

Jun 27th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2.  
  3. if($_SERVER['REQUEST_METHOD'] === 'POST'){ // Page was POSTed to. Typically from a form
  4.     mysql_connect("localhost", "root", "") or die("Unable to connect to MySQL");
  5.     echo "Connected!!<br>";
  6.  
  7.     mysql_select_db("login") or die ("No such Database Found");
  8.  
  9.     $fname = $_POST['fname']; //fname is a field in table named log_details
  10.     $lname = $_POST['lname']; //lname is a field in table named log_details
  11.     $mail = $_POST['mail']; //mail is a field in table named log_details
  12.     $cid = $_POST['cid']; //cid is a field in table named log_details
  13.     $psswrd = $_POST['psswrd']; //psswrd is a field in table named log_details
  14.     $cpsswrd = $_POST['cpsswrd']; //cpsswrd is a field in table named log_details
  15.  
  16.     //checking if data is already available or not
  17.     $query = mysql_query("SELECT fname,lname FROM login_details WHERE fname='{$fname}' AND lname='{$lname}' AND mail='{$mail}'" );
  18.  
  19.     //tells the no of rows for which the data matched
  20.     $rows = mysql_num_rows($query);
  21.  
  22.     //if data already present
  23.     if($rows>0)    {
  24.         echo "data already present fill again";}
  25.         //if data is not in database checks if the password and confirm password matches then insert value or else not
  26.     }else{ if($psswrd==$cpsswrd){
  27.         echo "value inserted";
  28.     }else{
  29.         echo "hell";
  30.     }
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement