/app/app_controller.php

https://bitbucket.org/udeshika/fake_twitter · PHP · 18 lines · 10 code · 4 blank · 4 comment · 1 complexity · ad11c79129fb8000fdc57d27190369d4 MD5 · raw file

  1. <?php
  2. class AppController extends Controller {
  3. function check_users() {
  4. // get user data from session
  5. $user = $this->Session->read('User');
  6. // if empty
  7. if(empty($user)) {
  8. // set a flash message
  9. $this->Session->setFlash('ERROR: You must be logged to access the admin area.', 'flash_bad');
  10. // redirect user
  11. $this->redirect('index');
  12. }
  13. }
  14. }