User.php 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. if( !defined('BASEPATH') )
  3. {
  4. exit( 'No direct script access allowed' );
  5. }
  6. class User extends CI_Model
  7. {
  8. public function __construct()
  9. {
  10. parent::__construct();
  11. if( !defined('IS_ADMIN') )
  12. {
  13. show_404();
  14. exit();
  15. }
  16. return NULL;
  17. }
  18. public function Login($cid = 0)
  19. {
  20. $user_name = get_cookie("user_name");
  21. $user_login = get_cookie("user_login");
  22. $login = false;
  23. if( !empty($user_name) && !empty($user_login) )
  24. {
  25. if( md5(Admin_Name . Admin_Code . "zhw") == $user_login && $user_name == Admin_Name )
  26. {
  27. $login = true;
  28. }
  29. }
  30. if( $cid == 0 && $login == false )
  31. {
  32. header("Location:" . site_url("login/index"));
  33. exit();
  34. }
  35. return $login;
  36. }
  37. }