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