Reputation: 3
I have this code my friend sent me through a tutorial for a project;
<?php include 'includes/menu.php'; ?>
<h1>Activate your account</h1>
<?php
if (isset($_GET['success']) === true && empty ($_GET['success']) === true) {
?>
<h3>Thank you, we've activated your account. You're free to log in!</h3>
<?php
} else if (isset ($_GET['email'], $_GET['email_code']) === true) {
$email =trim($_GET['email']);
$email_code =trim($_GET['email_code']);
if ($users->email_exists($email) === false) {
$errors[] = 'Sorry, we couldn\'t find that email address';
} else if ($users->activate($email, $email_code) === false) {
$errors[] = 'Sorry, we have failed to activate your account';
}
if(empty($errors) === false){
echo '<p>' . implode('</p><p>', $errors) . '</p>';
} else {
header('Location: activate.php?success');
exit();
}
} else {
header('Location: index.php');
exit();
}
?>
Basically it activates your acc based on email and email code obviously, the email is; [email protected]
and code is; code_536203131f86d3.07314347
how would i activate. Something like domain.com/activate?code_536203131f86d3.07314347
or?
Upvotes: 0
Views: 48
Reputation: 20486
PHP's $_GET
variables are sent through the HTTP request's query string. So, your URL would be something like this:
domain.com/[email protected]&email_code=code_536203131f86d3.07314347
Your two variables would then be accessible through the superglobal:
$_GET['email']
$_GET['email_code']
Upvotes: 2