<?php
$user_id= $_POST['user_id'];
$username = $_POST['username'];
$email = $_POST['email'];
If ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = new SQLite3('users.db');
$stmt = $db->prepare('SELECT * FROM user WHERE
LOWER(username)=:username');
// case insensitive usernames
$stmt->bindValue(':username', strtolower($username));
$result = $stmt->execute();
$row = $result->fetchArray();
If ($row) {
echo 'Username already exists.';
exit;
}
else {
$insert = "INSERT INTO user (user_id, username, email) VALUES (Null,:username,:email)";
$stmp=$users-prepare($insert);
$stmt->bindParam(':user_id',Null);
$stmt->bindParam(':username',strtolower($username));
$stmt->bindParam(':email', $email);
echo 'Registration successful. Please check your email.';
exit;
Comments
Post a Comment