summaryrefslogtreecommitdiff
path: root/signup/signup.php
diff options
context:
space:
mode:
Diffstat (limited to 'signup/signup.php')
-rwxr-xr-xsignup/signup.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/signup/signup.php b/signup/signup.php
index 5ba3ca8..4300b61 100755
--- a/signup/signup.php
+++ b/signup/signup.php
@@ -17,6 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+define('ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/');
+
+require_once ROOT . '/php/session.php';
+
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
@@ -64,13 +68,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$user_id = $pdo->lastInsertId();
- setcookie('user_id', (string)$user_id, [
- 'expires' => 2147483647,
- 'path' => '/',
- 'secure' => true,
- 'httponly' => true,
- 'samesite' => 'Strict'
- ]);
+ set_user_id((int)$user_id);
} catch (\PDOException $e) {
if ($e->getCode() == 23000) {
echo "Error: Username or email is already taken.";