View sourcecode

The following files exists in this folder. Click to view.

insertUser.php

14 lines UTF-8 Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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.");