示例#1
0
<?php

include_once './dbInstance.php';
include_once './dbConfig.php';
if (isset($_POST[DB_REGID]) && isset($_POST[DB_GROUP])) {
    $regId = $_POST[DB_REGID];
    $group = $_POST[DB_GROUP];
    $mDbInstance = new dbInstance();
    $mDbInstance->dbConnect();
    $newReferId = $mDbInstance->dbInsert($regId, $group);
    $mDbInstance->dbDisconnect();
} else {
    echo 'No input data';
}
<?php

include_once './dbInstance.php';
include_once './gcmInstance.php';
// If there is only one input argument, it would be a message to notify to every user
if ($argc == 2) {
    $message = $argv[1];
    $gcmSuccess = false;
    $mDbInstance = new dbInstance();
    $mDbInstance->dbConnect();
    // Get all 'registration IDs' from database
    $userRegIds = $mDbInstance->dbGetAllUsers();
    $mGcmInstance = new gcmInstance();
    for ($i = 0; $i < mysqli_num_rows($userRegIds); $i++) {
        $userArray = mysqli_fetch_row($userRegIds);
        // Send message to devices and getting back a new 'registration ID' in case it has been updated by the GCM server
        $gcmSuccess = $mGcmInstance->sendNotification($userArray, $message);
        if ($gcmSuccess) {
            // If the return value is not '', the entry has to be updated ('dbInsert' with a third argument)
            if ($mGcmInstance->newId != '') {
                //echo 'From dbInstance, result: ' . $mGcmInstance->newId . PHP_EOL;
                $resultQuery = $mDbInstance->dbInsert($mGcmInstance->newId, "", $userArray[0]);
                echo 'Update query result: ' . $resultQuery . PHP_EOL;
                // If '0' is retrieved, no update has been performed, and therefore the entry is repeated
                if ($resultQuery == 0) {
                    $resultQuery = $mDbInstance->dbDelete($userArray[0]);
                    echo 'Entry deleted' . PHP_EOL;
                }
            }
        } else {
            if ($mGcmInstance->error != '') {
示例#3
0
<?php

include_once './dbInstance.php';
include_once './dbConfig.php';
$mDbInstance = new dbInstance();
$mDbInstance->dbConnect();
$mDbInstance->dbUpdate(19, 'mariajo');
$mDbInstance->dbDelete(15);
$mDbInstance->dbDisconnect();
示例#4
0
        }
        if (isset($_GET['login'])) {
            $login = $_GET['login'];
        } elseif (isset($_POST['login'])) {
            $login = $_POST['login'];
        } else {
            $login = '';
        }
        if (isset($_GET['password'])) {
            $password = $_GET['password'];
        } elseif (isset($_POST['password'])) {
            $password = $_POST['password'];
        } else {
            $password = '';
        }
        $dbInstance = new dbInstance($dbInstanceId);
        $dbInstance->updateCredentials($login, $password, '', '');
        // TODO - add result
        echo '<script>location.reload();</script>';
        break;
    default:
        echo '
<form id="">
<label for="text-basic">Title:</label>
<input name="text-basic" id="text-basic" value="" type="text">
<label for="text-basic">Subtitle:</label>
<input name="text-basic" id="text-basic" value="" type="text">

</form>
<div class="mini-flags icon-libflags-mh"></div>
		';