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.
 
 
 
 
 
 

71 lines
1.5 KiB

  1. <?php
  2. require_once ("config.php");
  3. require_once ("user.php");
  4. require_once ("stats.php");
  5. $unsubscribe_page = new unsubscribe_page;
  6. class unsubscribe_page {
  7. //Properties
  8. var $postcode = "";
  9. var $alert_area_size = 0;
  10. //Constructor
  11. function unsubscribe_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. //Grab the postcode and area
  27. $this->postcode = $user->postcode;
  28. $this->alert_area_size = alert_size_to_meters($user->alert_area_size);
  29. //delete the user
  30. $user->delete();
  31. }else{
  32. header("HTTP/1.0 404 Not Found");
  33. exit;
  34. }
  35. }
  36. //Bind
  37. function bind() {
  38. $form_action = $_SERVER['PHP_SELF'];
  39. //smarty
  40. $smarty = new Smarty;
  41. $smarty->force_compile = true;
  42. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  43. $smarty->assign("stats", stats::get_stats());
  44. $smarty->assign("menu_item", "signup");
  45. $smarty->assign("page_title","Unsubscribed");
  46. $smarty->assign("postcode", $this->postcode);
  47. $smarty->assign("alert_area_size", $this->alert_area_size);
  48. //Render
  49. $smarty->display('unsubscribed.tpl');
  50. }
  51. }
  52. ?>