Skip to content
Snippets Groups Projects
Commit 13e39a0f authored by Dinda Yora Islami's avatar Dinda Yora Islami
Browse files

edit register.php

parent caa15a75
No related merge requests found
Pipeline #6878 canceled with stages
<?php
/**
* PHP Version 7
* registrasi
*/
require 'dbConnect.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST'){
$name = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
$registmt = $conn->prepare('select username
from user
where username = ?');
$registmt->bind_param("s", $username);
$registmt->execute();
$registmt->bind_result($user);
$registmt->fetch();
if(!is_null($user)) {
header("Location: admin");
echo '<script language="javascript">';
echo 'alert("Username has already taken")';
echo '</script>';
die();
//exit();
} else {
$stmt = $conn->prepare("INSERT INTO user(username, passwd,name) VALUES (?,?,?)");
$stmt->bind_param("sss", $username, $password, $name);
$stmt->execute();
$stmt->close();
header("Location: admin/home.html");
die();
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment