Пример #1
0
<?php

require_once "praveen.php";
$respjson = array("status" => "unprocessed", error => 1);
$keys = array("userid", "password", "repassword");
$prn = new praveen();
$password = $prn->safePost("password");
$repassword = $prn->safePost("repassword");
if ($prn->checkPOST($keys)) {
    if (strcmp($password, $repassword) == 0) {
        $con = $prn->getConnection();
        if ($con) {
            $userid = $prn->safePost("userid");
            $sql = "select password from registered_users where id='{$userid}' limit 1";
            if ($result = $prn->query($sql)) {
                $usercount = $result->num_rows;
                if ($usercount == 1) {
                    $sql = "update  hawabaaz.registered_users set password='******' where id='{$userid}'";
                    $prn->query($sql);
                    $respjson[error] = 0;
                    $respjson['status'] = "success";
                } else {
                    $respjson["status"] = "Authentication Failure";
                    $respjson[error] = 5;
                }
            } else {
                $respjson["status"] = "SQL querry error";
                $respjson["SqlError"] = $conn->error;
                $respjson[error] = 4;
            }
        } else {
Пример #2
0
<?php

require_once "praveen.php";
$app = new praveen();
$keys = array("phone", "email");
$app->checkPOST($keys);
$phone = $app->escapedPost($keys[0]);
$email = $app->escapedPost($keys[0]);
if (is_numeric($phone)) {
    $sql = "select (id) from registered_users where phone='{$phone}' or email='{$email}' limit 1";
    $result = $app->query($sql);
    $userCount = $result->num_rows;
    if ($userCount == 0) {
        $password = $app->generateRandomString(8);
        if ($phone == "") {
            $sql = "insert into registered_users(email, password) values ('{$email}','{$password}')";
        } else {
            if ($email == "") {
                $sql = "insert into registered_users(email,password) values ('{$phone}','{$password}')";
            } else {
                $sql = "insert into registered_users(phone, email, password) values ('{$phone}','{$email}','{$password}')";
            }
        }
        $result = $app->query($sql);
        $resp[error] = 0;
        if (debug) {
            $resp['status'] = "success";
        }
    } else {
        if (debug) {
            $resp["status"] = "Already registered";
Пример #3
0
<?php

require_once "praveen.php";
$app = new praveen();
$keys = array("orderid");
$app->checkPOST($keys);
$orderid = $app->escapedPost($keys[0]);
$sql = "insert into cancel_request (order_id) values ('{$orderid}')";
$app->query($sql);
$resp[error] = 0;
if (debug) {
    $resp['status'] = "success";
}
echo json_encode($resp);