Automatically exported from code.google.com/p/planningalerts
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

confirmed.php 1.7 KiB

17 年前
17 年前
17 年前
17 年前
17 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. ?>