diff --git a/scripts/checkin.php b/scripts/checkin.php index 98fbed561a..85893eb633 100644 --- a/scripts/checkin.php +++ b/scripts/checkin.php @@ -22,8 +22,7 @@ require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); # Make sure this script doesn't run via the webserver -/** @todo This is a hack to detect php-cgi, there must be a better way. */ -if( isset( $_SERVER['SERVER_PORT'] ) ) { +if( php_sapi_name() != 'cli' ) { echo "checkin.php is not allowed to run through the webserver.\n"; exit( 1 ); } diff --git a/scripts/send_emails.php b/scripts/send_emails.php index 16722843c8..534005fc06 100644 --- a/scripts/send_emails.php +++ b/scripts/send_emails.php @@ -25,8 +25,7 @@ require_once( 'email_api.php' ); # Make sure this script doesn't run via the webserver -/** @todo This is a hack to detect php-cgi, there must be a better way. */ -if( isset( $_SERVER['SERVER_PORT'] ) ) { +if( php_sapi_name() != 'cli' ) { echo "send_emails.php is not allowed to run through the webserver.\n"; exit( 1 ); }