SHARE
TWEET

Untitled

a guest Mar 20th, 2017 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include("config.php");
  3. //Get the name of the input type submit
  4. if(ISSET($_POST['sign_up'])) {
  5.     $username = trim($_POST['user']);
  6.     $password = trim($_POST['pass']);
  7.     $gender=$_POST['gen'];
  8.     $firstname =($_POST['first']);
  9.     $lastname = trim($_POST['last']);
  10.     $y=$_POST['y'];
  11.     $m=$_POST['m'];
  12.     $d=$_POST['d'];
  13.     $dob=$y."-".$m."-".$d;
  14.     $imgpath=$_FILES['file']['name'];
  15.     $imgFile = $_FILES['file']['name'];
  16.     $tmp_dir = $_FILES['file']['tmp_name'];
  17.     $imgExt = strtolower(pathinfo($imgFile,PATHINFO_EXTENSION));
  18.    $valid_extensions = array('jpeg', 'jpg', 'png', 'gif');
  19.    $userpic = rand(1000,1000000).".".$imgExt;      
  20.     if(!empty($username) && !empty($password)) {
  21.     $sql = mysql_query("SELECT * FROM users WHERE user_name = '$username'") or die(mysql_error());
  22.     if(mysql_num_rows($sql) > 0) {
  23.     $msg_error = "Username already registered!";
  24. } else {
  25.     if(in_array($imgExt, $valid_extensions)){
  26.     mysql_query("INSERT INTO users values('','$username','".MD5($password)."', '$gender', '$dob', '$imgpath', 'guest', '$firstname', '$lastname')") or die(mysql_error());  
  27.     $uuid=mysql_query("SELECT * FROM users");
  28.      while ($puid=mysql_fetch_array($uuid)){
  29.         $pid = $puid['user_id'];
  30.    
  31. $_SESSION['sname']=$_POST['user'];
  32.     $msg_success = "You are now registered!";
  33.     }
  34.     else{
  35.         $msg_error = "Invalid image!";
  36.     }
  37. }
  38. }else{
  39.     $msg_error = "All fields are required!";
  40. }
  41. }
  42. ?>
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