The following files exists in this folder. Click to view.
insertUser.php14 lines UTF-8 Unix (LF)
<?php
require_once('check_login.php');
require_once('database_connection.php');
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$sql = "INSERT INTO user (username, password) VALUES (:username, :password);";
$stm = $pdo->prepare($sql);
$stm->execute(array('username' => $username, 'password' => $password));
$lastID = $pdo->lastInsertID();
header("location: admin.php?mess=En användare med id: $lastID har skapats.");