php repozitar
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
619 B

<?php
session_start();
include("init.php");
$username = $_POST["username"];
$pw1 = $_POST["pw1"];
$pw2 = $_POST["pw2"];
if ($pw1 != $pw2) {
header("Location: reg.php?error=1");
}
$sql = "INSERT INTO nk_users(username,password,role)
VALUES ('$username','$pw1','5')";
if (mysqli_query($conn,$sql)){
$last_id = mysqli_insert_id($conn);
echo "uživatel byl vytvořen, jeho id: ".$last_id ;
$_SESSION["logged"] = 1;
$_SESSION["username"] = $username;
$_SESSION["role"] = "5";
$_SESSION["userid"] = $last_id;
header("Location: /");
} else {
echo "error:" . mysqli_error($conn);
}
?>