Ejemplo n.º 1
0
require_once 'functions.php';
//Register Gplus Data
if (isset($_SESSION['gplusdata']['id']) && $_SESSION['gplusdata']['id'] != '') {
    $a = json_decode($_SESSION['access_token'], true);
    $data['access_token'] = $a['access_token'];
    $data['email'] = $_SESSION['gplusdata']['emails']['0']['value'];
    $data['gp_etag'] = $_SESSION['gplusdata']['etag'];
    $data['gender'] = $_SESSION['gplusdata']['gender'];
    $data['gp_id'] = $_SESSION['gplusdata']['id'];
    $data['username'] = $_SESSION['gplusdata']['name']['givenName'] . " " . $_SESSION['gplusdata']['name']['familyName'];
    $data['gp_url'] = $_SESSION['gplusdata']['url'];
    $data['prof_pic'] = $_SESSION['gplusdata']['image']['url'];
    $data['gp_isPlusUser'] = $_SESSION['gplusdata']['isPlusUser'];
    $method = 'gp_reg';
    ajax_calls($method, $data);
}
if (!isset($_SESSION['user_id']) && $_SESSION['user_id'] == '') {
    header('location:/');
}
require_once 'classes/geneform.php';
$userId = $_SESSION['user_id'];
if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['submit'])) {
    // Get no of files has been used per day
    $user = new User();
    $noOfFiles = $user->getFormsPerDay();
    if ($noOfFiles == DEMO_MAX_FORM_VALUE_PER_DAY) {
        header('location:dashboard.php');
        echo "<div class='bg-warning'> Your max no of forms are completed. Try again </div>";
    }
    $form = $gform->makeForm($_POST);
Ejemplo n.º 2
0
    require_once CLASS_PATH . $name . '.php';
}
if (isset($_REQUEST['email']) && $_REQUEST['email'] != '') {
    $email = trim($_REQUEST['email']);
}
if (isset($_REQUEST['method']) && $_REQUEST['method'] != '') {
    $method = trim($_REQUEST['method']);
    if ($method == 'email_validation') {
        $user_id = validate($email, $method);
        if ($user_id != '') {
            echo "false";
        } else {
            echo "true";
        }
    } else {
        ajax_calls($method, $_POST);
    }
}
function ajax_calls($method, $data)
{
    $user = new User();
    switch ($method) {
        case 'fb_reg':
            $res = $user->login($data);
            if ($res != 0) {
                unset($_SESSION['gplusdata']);
                $_SESSION['user_id'] = $res;
                $_SESSION['email_id'] = $data['email'];
                $url = 'php_script.php';
            } else {
                $url = '';