Transfer to git

This commit is contained in:
2026-02-03 19:37:38 -03:00
commit 9ffbd90a82
136 changed files with 5798 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
function username_search(object $pdo, string $username) {
$query = "SELECT username FROM users WHERE username = :username;";
// Prepare and check if user already exists
$stmt = $pdo->prepare($query);
$stmt->bindParam(":username",$username);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = null;
$query = null;
// True if something is found, false if not
return $result;
}
function user_write(object $pdo, string $username, string $pwd) {
$query = "INSERT INTO users (username, pwd) VALUES (:username, :pwd)";
$stmt = $pdo->prepare($query);
$stmt->bindParam(":username",$username);
$stmt->bindParam(":pwd",$pwd);
$stmt->execute();
$stmt = null;
$query = null;
}