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'; ?>
User accounts are only used to track your progress through levels. Please note that Netsim is still in beta, so we may need to reset the user database from time to time.
=(isset($login_error) ? "".$login_error."
\n" : "")?>