Ejemplo n.º 1
0
    $email = $_POST["email"];
    $pass = $_POST["password"];
    $phone_number = $_POST["phone_number"];
    $msg = $_POST["msg"];
    //מוודא אורך טלפון
    if (strlen($phone_number) != 10) {
        echo 'יש שגיאה בטלפון, כמה ספרות הקלדת?';
        die;
    }
    //מוודא תקינות קידומת
    if (substr($phone_number, 0, 2) != "05") {
        echo "בעיה בקידומת? " . $phone_number . "  " . substr($phone_number, 0, 2);
        die;
    }
    //מחפש קוד מזהה
    $db = new DB_functions();
    if (($regId = $db->GetUser($email, md5($pass . SALT))) === false) {
        echo "שגיאה באימייל או בסיסמא";
        die;
    }
    //מוודא תקינות אורך הודעה
    if (strlen($msg) > 160) {
        echo "הודעה ארוכה מידי";
        die;
    }
    $gcm = new gcm();
    $gcm->send2phone($regId, array("num" => $phone_number, "msg" => $msg));
    echo "נשלח בהצלחה";
} else {
    echo "שגיאה. האם מילאת את כל הפרטים?";
}
Ejemplo n.º 2
0
<?php

if (isset($_POST['tag']) && $_POST['tag'] != '') {
    // get tag
    $tag = $_POST['tag'];
    // include db handler
    require_once 'DB_functions.php';
    $db = new DB_functions();
    // response Array
    $response = array("tag" => $tag, "error" => FALSE);
    // check for tag type
    if ($tag == 'login') {
        // Request type is check Login
        $pseudo = $_POST['pseudo'];
        $password = $_POST['password'];
        // check for user
        $user = $db->getUserByPseudoAndPassword($pseudo, $password);
        if ($user != false) {
            $response["error"] = FALSE;
            $response["utilisateur"]["pseudo"] = $user["pseudo"];
            $response["utilisateur"]["email"] = $user["email"];
            echo json_encode($response);
        } else {
            // user not found
            // echo json with error = 1
            $response["error"] = TRUE;
            $response["error_msg"] = "Incorrect email or password!";
            echo json_encode($response);
        }
    } else {
        if ($tag == 'register') {
Ejemplo n.º 3
0
<?php

include_once '../Database/DB_functions.php';
include_once '../config.php';
if (isset($_POST["email"]) && isset($_POST["regId"]) && isset($_POST["salt"]) && isset($_POST["password"])) {
    //השמת ערכי שנשלחו במשתנים
    $email = $_POST["email"];
    $regId = $_POST["regId"];
    $salt = $_POST["salt"];
    $pass = $_POST["password"];
    //בדיקת salt
    if (SALT != $salt) {
        die("salt error");
    }
    //מאתחל
    $db = new DB_functions();
    //מוחק משתמשים קודמים עם אותו אימייל אם יש
    $db->DeleteUser($email);
    //מכניס פרטים למסד
    $db->StoreNewUser($email, $regId, $pass);
} else {
    echo 'error';
}