bindValue(':name', $_POST['reg_username']); $res = $userq->execute(); if ($res === false || $res->fetchArray() === false) { $q = $db->prepare("INSERT INTO user (name, password) VALUES (:name, :password)"); $q->bindValue(':name', $_POST['reg_username']); $q->bindValue(':password', password_hash($_POST['reg_password'], PASSWORD_DEFAULT)); if ($q->execute()) { $res->finalize(); $userq->bindValue(':name', $_POST['reg_username']); $res = $userq->execute(); $row = $res->fetchArray(); $_SESSION['cs4g_user_id'] = $row['id']; header('Location: ./'); exit('Registration successful! Continue'); } else $login_error = "Hrm, something happened. Try again! (".$db->lastErrorMsg().")"; } else { $login_error = "Someone has that username already..."; } } include 'header.inc.php'; ?>

Register

".$login_error."

\n" : "")?>

Username:

Password:

Confirm password: