Example #1
0
                break;
            case '/remove':
                deleteContact($chatID);
                break;
        }
    }
    $offset = $response['result'][count($response['result']) - 1]['update_id'] + 1;
}
$chats = allChats();
$quotes = readQuotes();
$i = 0;
for ($i; $i < count($chats); $i++) {
    $tg->sendMessage($chats[$i]['chat_id'], $quotes[$chats[$i]['init']]);
    updateInit($chats[$i]['chat_id']);
    if ($chats[$i]['init'] == count($quotes) - 1) {
        resetInit($chats[$i]['chat_id']);
    }
}
function addContact($chatID)
{
    $contactsDB = __DIR__ . DIRECTORY_SEPARATOR . 'contacts.db';
    if (!file_exists($contactsDB)) {
        $db = new \PDO("sqlite:" . $contactsDB, null, null, array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
        $db->exec('CREATE TABLE contacts (`chat_id` TEXT, `init` INT)');
    } else {
        $db = new \PDO("sqlite:" . $contactsDB, null, null, array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
    }
    $sql = 'SELECT chat_id FROM contacts WHERE chat_id = :chat_id';
    $query = $db->prepare($sql);
    $query->execute(array(':chat_id' => $chatID));
    $chat = $query->fetchAll();
Example #2
0
    }
    echo $data;
}
//task login
if ($task == "register") {
    $firstname = $request->firstname;
    $lastname = $request->lastname;
    $email = $request->email;
    $userpass = $request->password;
    $data = register($firstname, $lastname, $email, $userpass);
    echo $data;
}
//task register
if ($task == "resetInit") {
    $email = $request->email;
    $data = resetInit($email);
    echo $data;
}
//task resetInit
if ($task == "resetDo") {
    $email = $request->email;
    $confirmationcode = $request->confirmationcode;
    $password = $request->password;
    $data = resetDo($email, $confirmationcode, $password);
    echo $data;
}
//task resetInit
if ($task == "saveSingle") {
    $amount = $request->amount;
    $weeklyid = $request->weeklyid;
    $timeid = $request->timeid;