Advertisement
Guest User

proses_daftar.php

a guest
Mar 2nd, 2018
1,065
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $conn = new mysqli('localhost','a','q','b_login');
  4.  
  5. $nama = $_POST['nama_lengkap'];
  6. $email = $_POST['email'];
  7. $username = $_POST['username'];
  8. $password = base64_encode($_POST['password']);
  9.  
  10. $query = $conn->query("SELECT username from user WHERE username = '$username' ");
  11. $res = $query->fetch_assoc();
  12.  
  13. if(count($res) >= 1){
  14.     echo "<p style='color:red'>Username Sudah Di Gunakan !!!</p>";
  15.     echo "<a href='daftar.php'> << Kembali </a>";
  16. }
  17. else{
  18.     $impan = $conn->query("INSERT INTO user VALUES(null, '$nama', '$email', '$username', '$password')");
  19.     $_SESSION['username'] = $username;
  20.     header('location:home.php');
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement