<?php

include_once 'bigtable.php';
include_once 'balgorithm.php';
if (isset($_POST['user_id'])) {
    $id = $_POST['user_id'];
    $key = $_POST['user_key'];
    $request_id = $_POST['request_id'];
    if ($key == Generate_key($id)) {
        $get = mysqli_query($con, "select * from popcorn_users where user_id ='{$request_id}'");
        while ($data = $get->fetch_array()) {
            $getstatus = mysqli_query($con, "select * from user_status  where user_id='{$request_id}'");
            $status = $getstatus->fetch_array();
            $response = array("user_id" => $data['user_id'], "user_name" => $data['user_name'], "user_status" => $status['user_status'], "user_gender" => $data['user_gender'], "user_age" => $data['user_age'], "user_joined" => $data['user_joined']);
            echo json_encode($response);
        }
    }
}
Esempio n. 2
0
<?php

include 'bigtable.php';
include 'balgorithm.php';
if (isset($_POST['user_id'])) {
    $userid = $_POST['user_id'];
    $userkey = $_POST['user_key'];
    //AUTENTICATION USER ID AND USER KEY
    if ($userkey == Generate_key($userid)) {
        $status = $_POST['user_status'];
        mysqli_query($con, "update user_status set user_status = '{$status}' where user_id = '{$userid}'");
        $response = array("response" => "true");
        echo json_encode($response);
    }
}
Esempio n. 3
0
error_reporting(0);
include_once 'bigtable.php';
include_once 'balgorithm.php';
if (isset($_POST['user_id'])) {
    $user_id = $_POST['user_id'];
    $user_name = $_POST['user_name'];
    $user_email = $_POST['user_email'];
    $user_gender = $_POST['user_gender'];
    $user_age = $_POST['user_age'];
    $user_joined = $_POST['user_joined'];
    $user_status = "Hi there! i am eating Popcorn.";
    //CHECKKING IF USERNAME IF ALREADY REGISTERED
    $get = mysqli_query($con, "select * from ofUser where username = '******'");
    if ($data = $get->fetch_array()) {
        $response = array("response" => "true", "password" => $data['plainPassword']);
        echo json_encode($response);
    } else {
        //TIMESTAMP FOR REGISTERING USER TIME
        $time = round(microtime(true) * 1000);
        //GENERATING PASSSWORD
        $response_key = Generate_key($user_id);
        mysqli_query($con, "insert into ofUser(username,plainPassword,name,creationDate,modificationDate) values('{$user_id}','{$response_key}','{$user_name}','{$time}','{$time}')");
        //REGISTERING IN THE OPENFIRE OFUSER TABLE
        mysqli_query($con, "insert into popcorn_users(user_id,user_name,user_email,user_gender,user_age,user_joined) values('{$user_id}','{$user_name}','{$user_email}','{$user_gender}','{$user_age}','{$user_joined}')");
        //REGISTERING USERS IN POPCORN TABLE
        mysqli_query($con, "insert into user_status (user_id,user_status) values('{$user_id}','{$user_status}')");
        //INSERTING USER_STATUS FIRST TIME IN TABLE
        $response = array("response" => "true", "password" => $response_key);
        echo json_encode($response);
    }
}