session_start();
if ($_SESSION['authenticated'] != true) {
die("Access denied");
}
?>
Insert user
$action = $_POST['action'];
if ($action == "Insert User" ) {
$usr = $_POST['username'];
$pwd = $_POST['password'];
$pwd = password_hash($pwd, PASSWORD_BCRYPT);
$mysqli = new mysqli("localhost", "sienasel_sbxusr", "Sandbox@)!&", "sienasel_sandbox");
$sql = "INSERT INTO ????? (username, password) VALUES ('$usr','$pwd')";
if ($mysqli->query($sql)) {
echo ''.$usr. ' was inserted.
Insert Another User
';
die();
}
elseif ($mysqli->errno == 1062) {
echo ''.$usr. ' already exists.
Insert Another User
';
die();
}
else {
die("Error ($mysqli->errno) $mysqli->error");
}
$mysqli->close();
}
?>