Advertisement
kotvalera83

Code-igniter cron

Nov 19th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. #!/usr/local/bin/php -q
  2. <?php
  3.  
  4.  
  5. $system_path = '/home/funder/public_html/system/';
  6.  
  7. $application_folder = '/home/funder/public_html/application';
  8.  
  9. //The default controler
  10. define('DCS', 'none');
  11.  
  12. // The name of THIS file
  13. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  14.  
  15. // The PHP file extension
  16. // this global constant is deprecated.
  17. define('EXT', '.php');
  18.    
  19. // Path to the system folder
  20. define('BASEPATH', str_replace("\\", "/", $system_path));
  21.  
  22. // Path to the front controller (this file)
  23. define('FCPATH', str_replace(SELF, '', __FILE__));
  24.  
  25. // Name of the "system folder"
  26. define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  27.  
  28. define('APPPATH', $application_folder.'/');
  29.  
  30. require_once BASEPATH.'core/CodeIgniter.php';
  31.  
  32. $CI =& get_instance();
  33. $CI->load->model('members_model');
  34. $CI->load->model('projects_model');
  35. $user = $CI->members_model->get_users(array('is_admin' => 1));
  36. $email = array();
  37. $message = '';
  38. foreach ($user as $value) {
  39.     array_push($email, $value->email);
  40. }
  41. $projects = $CI->projects_model->get_completed_project_cron();
  42. if (!empty($projects)) {
  43.     foreach ($projects as $value) {
  44.         $message .= '<a href="'.site_url().'projects/view/'.$value->url.'">'.$value->title.'</a><br />';
  45.     }
  46. }
  47.  
  48. $CI->load->library('email', $CI->config->item('email'));
  49. $CI->email->from('info@funderhut.com', 'FunderHut');
  50. $CI->email->to($email);
  51. $CI->email->subject('Today ends projects');
  52. $CI->email->message($message);
  53. $CI->email->send();
  54. // }
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement