39 lines
869 B
PHP
39 lines
869 B
PHP
<?php
|
|
require_once("env.php");
|
|
require_once("connection.php");
|
|
require_once("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();
|
|
?>
|