More Related Content
Similar to Sample php notification
Similar to Sample php notification (20)
Sample php notification
- 1. Sample PHP Notification
<?php
define('LOG_FILE', 'c:/notification.log');
define('AUTH_USERNAME', 'test');
define('AUTH_PASSWORD', 'pass');
error_reporting ( E_ERROR | E_WARNING | E_PARSE );
$authUserName = $_SERVER['PHP_AUTH_USER'];
$authPassword = $_SERVER['PHP_AUTH_PW'];
if (isset($authUserName)) {
if ($authUserName != AUTH_USERNAME) {
echo 'HTTP basic authentication failure';
exit;
}
if ($authPassword != AUTH_PASSWORD) {
echo 'HTTP basic authentication failure';
exit;
}
}
$id = $_REQUEST['id'];
$uuid = $_REQUEST['uuid'];
$status = $_REQUEST['status'];
if ($status == 'STARTED' || $status == 'ENDED') {
$fp = @fopen(LOG_FILE, 'a');
if ($fp) {
@fwrite($fp, date('Y-m-d H:i:s') . " [INFO] id=$id, uuid=$uuid, status=$status n");