Code restructure push
This commit is contained in:
39
src/pages/auth/verify.php
Normal file
39
src/pages/auth/verify.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$rootPath = dirname(dirname(dirname(__DIR__)));
|
||||
require_once($rootPath . '/src/config/env.php');
|
||||
require_once($rootPath . '/src/config/connection.php');
|
||||
require_once($rootPath . '/src/config/functions.php');
|
||||
|
||||
// Create connection
|
||||
$conn = openDatabaseConnection();
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Verify token
|
||||
if (isset($_GET['token'])) {
|
||||
$token = $conn->real_escape_string($_GET['token']);
|
||||
|
||||
// Prepare and execute query
|
||||
$stmt = $conn->prepare('UPDATE users SET is_verified = 1 WHERE token = ?');
|
||||
$stmt->bind_param('s', $token);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
if ($stmt->affected_rows > 0) {
|
||||
header('Location: login.php');
|
||||
} else {
|
||||
header('Location: login.php');
|
||||
}
|
||||
} else {
|
||||
echo 'Error: ' . $stmt->error;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
} else {
|
||||
echo 'No token provided.';
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in New Issue
Block a user