Advertisement
Guest User

Untitled

a guest
Aug 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. public function action_index(){
  2.  
  3. $html = new Template();
  4.  
  5. if(Session::get("logged_in")){
  6.  
  7. Response::redirect('/test-newsletter');
  8.  
  9. exit(0);
  10. }
  11. // die("in ifss");
  12. if(Input::post()){
  13.  
  14. $username = Input::post('username','');
  15. $password = Input::post('password','');
  16.  
  17. if($username === "username" && $password === "password") {
  18.  
  19. Session::set('logged_in', true);
  20.  
  21. Response::redirect('/test-newsletter');
  22.  
  23. }else{
  24. $html->assign('message','Wrong username or password');
  25. }
  26.  
  27. }
  28.  
  29. return $html->fetch('login.tpl');
  30.  
  31. }
  32.  
  33. <?php
  34.  
  35. return array(
  36.  
  37. "_root_" => "default/index",
  38. "logout" => "default/logout",
  39. "_404_" => "default/404",
  40. "time" => "default/time",
  41. "test" => "default/test",
  42.  
  43. "birthdays" => "backstage/birthdays",
  44. "earned-status" => "backstage/earned_status",
  45. "nearly-new-status" => "backstage/nearly_new_status",
  46. "placed-order" => "backstage/placed_order",
  47. "user-history" => "backstage/user_history",
  48. "test-newsletter" => "backstage/test_newsletter",
  49. "preview-email" => "backstage/preview_email",
  50.  
  51. "view-email/:id" => "backstage/view_email",
  52.  
  53. "api/set-date" => "backstage/api_set_date"
  54. );
  55.  
  56. public function action_test_newsletter(){
  57. die("here");
  58. $submitted = Input::post("submit", false);
  59. $points = Input::post("points", "");
  60. $email = Input::post("email", "");
  61. $type = Input::post("type", "");
  62.  
  63. $html = new Template();
  64. $html->assign("points", $points);
  65. $html->assign("email", $email);
  66. $html->assign("type", $type);
  67. $html->assign("message", "");
  68.  
  69. if($submitted){
  70. $testService = new TestService(trim($type), trim($email), trim($points));
  71.  
  72. if($testService->isValid()){
  73. $testService->processEmail();
  74. $html->assign("message", "Email Sent!");
  75.  
  76. }else{
  77. $html->assign("message", $testService->getErrorMesssage());
  78. }
  79. }
  80.  
  81. return $html->fetch("test_newsletter.tpl");
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement