Automatically exported from code.google.com/p/planningalerts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

76 lines
1.6 KiB

  1. <?php
  2. require_once ("config.php");
  3. require_once ("user.php");
  4. $confirmed_page = new confirmed_page;
  5. class confirmed_page {
  6. //Properties
  7. var $postcode = "";
  8. var $alert_area_size = 0;
  9. //Constructor
  10. function confirmed_page() {
  11. $this->setup();
  12. $this->bind();
  13. }
  14. //Setup
  15. function setup (){
  16. //Grab the user
  17. if(isset($_GET['cid'])){
  18. $confirm_id = $_GET['cid'];
  19. }else{
  20. header("HTTP/1.0 404 Not Found");
  21. exit;
  22. }
  23. $user = new user();
  24. if($user->load_from_confirm_id($confirm_id)){
  25. //Update the confirmed flag
  26. $user->confirmed = true;
  27. //delete any other active alerts for this postcode
  28. $user->remove_existing();
  29. $user->save(false);
  30. //Grab the postcode and area
  31. $this->postcode = $user->postcode;
  32. $this->alert_area_size = alert_size_to_meters($user->alert_area_size);
  33. }else{
  34. header("HTTP/1.0 404 Not Found");
  35. exit;
  36. }
  37. }
  38. //Bind
  39. function bind() {
  40. $form_action = $_SERVER['PHP_SELF'];
  41. //smarty
  42. $smarty = new Smarty;
  43. $smarty->force_compile = true;
  44. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  45. $smarty->assign("menu_item", "signup");
  46. $smarty->assign("page_title","Confirmed");
  47. $smarty->assign("form_action", $form_action);
  48. $smarty->assign("postcode", $this->postcode);
  49. $smarty->assign("alert_area_size", $this->alert_area_size);
  50. //Render
  51. $smarty->display('confirmed.tpl');
  52. }
  53. }
  54. ?>