I’m working with the Zend Framework on a project that requires the user to activate their account by checking their email and clicking on the activation link. The activation link works fine and the user can login once their account is set active. My question is how can i display a message when the user clicks on the activation link and get redirected to the home page, acknowledging that their account has been activated.
I was trying to write an if statement to check if HTTP_REFERER = the URL of the activation link. But that didn’t work. Any help would be greatly appreciated.
Here’s the if statement:
<script language="javascript" type="text/javascript">
$(document).ready(function() {
<?php if ($_SERVER['HTTP_REFERER'] == 'activationLinkGoesHere'){ ?>
$("#suc_message").html('<?php echo 'Your account has been activated!';?>');
$("#suc_message").fadeIn(2000);
$("#suc_message").fadeOut(20000);
<?php } ?>
});
</script>
Thanks 🙂
Sorry for the original answer, I did not read this properly.
I personally would just add something on the end of the url:
..and look for the reg part and inject the message if it exists.
edit
Returning to this, I’ll add that it is very important to keep the url addition to something that is a boolean value. For example, you could display multiple messages if you found
?Reg=1or?LoggedIn=1and displayed “You registered OK” and “You logged in OK” respectively.Don’t pass anything in that your javascript then uses for display or otherwise.
Don’t make it fire any actions.
Follow the above and you’ll be safe from people fiddling with the url to have fun with you.