Skip to content

Commit

Permalink
add ip to registration
Browse files Browse the repository at this point in the history
  • Loading branch information
svenbledt committed Jan 30, 2023
1 parent d999fe9 commit 96efbc6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ function register($conn, $email, $password, $username)
$password = sha256($password);
$timestamp = getTimestamp();
try {
$sql = "INSERT INTO users (email, password_sha256, username, created_at) VALUES (:email, :password, :username, :created_at)";
$sql = "INSERT INTO users (email, password_sha256, username, created_at, ip) VALUES (:email, :password, :username, :created_at, :ip)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $email, PDO::PARAM_STR);
$stmt->bindParam(':password', $password, PDO::PARAM_STR);
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->bindParam(':created_at', $timestamp);
$stmt->bindParam(':ip', getrealip(), PDO::PARAM_STR);
$stmt->execute();
} catch (PDOException $e) {
echo $e->getMessage();
Expand Down

0 comments on commit 96efbc6

Please sign in to comment.