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.
 
 
 
 
 
 

78 lines
1.7 KiB

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