<?php
require_once('../redd/lib/table-traits.php');
require_once('../redd/lib/basic-function.php');
require_once('../' . $basicFunctn->admin_url . '/lib/mailing/emails.php');
require_once('../' . $basicFunctn->admin_url . '/lib/user-functions.php');




if (isset($_POST['sign_in_email']) && isset($_POST['sign_in_password'])) {
    // print_r(json_encode($_POST['sign_in_email']));return;
    $msg = $basicFunctn->OneWayLoginAuth($_POST['sign_in_email'], $_POST['sign_in_password'], $user->user_session, $basicFunctn->user_tb);
    print_r(json_encode($msg));
}

if (isset($_POST['user_full_name']) && isset($_POST['user_email'])) {
    $msg = $user->create($_POST['user_full_name'], $_POST['user_email'], $_POST['user_referrer'], $_POST['user_password'], $_POST['user_confirm_pass']);
    print_r(json_encode($msg));
}

if (isset($_POST['forgot_pass_email'])) {
    $user_exist = $user->forgot_password($_POST['forgot_pass_email']);
    if ($user_exist['error'] == 1) {
        print_r(json_encode($user_exist));
        return;
    } else {
        // print_r(json_encode($user_exist));return;
        $msg = $user->passwordRecovery($_POST['forgot_pass_email'], $user_exist['user_id']);
        print_r(json_encode($msg));
    }
}

if (isset($_POST['reset_password_user_id'])) {
    $msg = $user->reset_password($_POST['reset_password_user_id'], $_POST['password'], $_POST['c_password']);
    print_r(json_encode($msg));
}
