added option for cronjob,  include authenticate.php and remove return in stages (thx @opicron)