Advertisement
Guest User

Untitled

a guest
Jul 10th, 2016
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2.     include("database.php"); //$db=new PDO...
  3.     $fname=$_POST["fname"];
  4.     $lname=$_POST["lname"];
  5.     $email=$_POST["email"];
  6.     $username=$_POST["username"];
  7.     $password=$_POST["password"];
  8.     $password_confirm=$_POST["password_confirm"];
  9.  
  10.     if($password!=$password_confirm) die("Passwords not identical!");
  11.  
  12.     $default_profile_picture=file_get_contents("user_default.png");
  13.     $default_profile_picture=base64_encode($default_profile_picture);
  14.  
  15.     $stmt = $db->prepare("insert into utilizatori
  16.        values( :id ,
  17.                :username,
  18.                :password,
  19.                :lname,
  20.                :fname,
  21.                :email,
  22.                :user_type,
  23.                :description,
  24.                :profile_pic,
  25.                :show_profile_pic,
  26.                :show_email,
  27.                :is_active ,
  28.                :data )");
  29.     $stmt->execute(array(
  30.         ':id' => null,
  31.         ':username' => $username,
  32.         ':password' => $password,
  33.         ':lname' => $lname,
  34.         ':fname' => $fname,
  35.         ':email' => $email,
  36.         ':user_type' => 'utilizator',
  37.         ':descrption' => '',
  38.         ':profile_pic' => $default_profile_picture,
  39.         ':show_profile_pic' => 1,
  40.         ':show_email' => 1,
  41.         ':is_active' => 1,
  42.         ':data' => date("Y-m-d")));
  43.  
  44.     die("Account created!");
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement