Ejemplo n.º 1
0
function save_user($fbuid, $user_object)
{
    global $mongo;
    $db = $mongo->combined;
    $users = $db->users;
    $users->save($user_object);
    $users->ensureIndex(array('id' => 1), array("unique" => true));
    $user_exists = check_user_exist($fbuid);
    if (!$user_exists) {
        $user_object_id = set_object('user', $fbuid, $fbuid);
        $res->status = 'new';
        return $res;
    } else {
        return get_user_data($fbuid);
    }
}
Ejemplo n.º 2
0
<?php

define('DarkCoreCMS', TRUE);
include 'config.php';
include 'functions/global_functions.php';
$_error = '';
if (!isset($_POST['Username']) || !isset($_POST['Password']) || !isset($_POST['RepeatPassword']) || !isset($_POST['Email']) || !isset($_POST['RepeatEmail']) || !isset($_POST['Country']) || !isset($_POST['Age']) || !isset($_POST['foundus']) || !isset($_POST['robot1']) || !isset($_POST['robot2'])) {
    $_error = $_error . 'regerror=1&errtype=';
    header('Location: ../register?' . $_error);
} else {
    if (check_user_exist($_POST['Username']) > 0) {
        $_error = $_error . 'A';
    }
    if (strlen($_POST['Username']) < 3) {
        $_error = $_error . 'B';
    }
    if (strlen($_POST['Password']) < 8) {
        $_error = $_error . 'C';
    }
    if (check_email_exist($_POST['Email']) > 0) {
        $_error = $_error . 'D';
    }
    if (strlen($_POST['Email']) < 10) {
        $_error = $_error . 'E';
    }
    if (strlen($_POST['Country']) < 2) {
        $_error = $_error . 'F';
    }
    if (strlen($_POST['Age']) < 2) {
        $_error = $_error . 'G';
    }
Ejemplo n.º 3
0
function register_user($username, $_new_password, $re_password, $email, $re_email, $country, $age, $foundus, $robot1, $total = 0, $robot2, $checktext = NULL)
{
    $_error = '';
    if (check_user_exist($username) > 0) {
        $_error = $_error . 'A';
    }
    if (strlen($username) < 3) {
        $_error = $_error . 'B';
    }
    if (strlen($_new_password) < 8) {
        $_error = $_error . 'C';
    }
    if (check_email_exist($email) > 0) {
        $_error = $_error . 'D';
    }
    if (strlen($email) < 10) {
        $_error = $_error . 'E';
    }
    if (strlen($country) < 2) {
        $_error = $_error . 'F';
    }
    if (strlen($age) < 2) {
        $_error = $_error . 'G';
    }
    if (strlen($foundus) < 5) {
        $_error = $_error . 'H';
    }
    if (strlen($robot1) < 1) {
        $_error = $_error . 'I';
    }
    if (strlen($robot2) < 1) {
        $_error = $_error . 'J';
    }
    if ($_new_password != $re_password) {
        $_error = $_error . 'K';
    }
    if ($email != $re_email) {
        $_error = $_error . 'L';
    }
    if ($robot1 != $total) {
        $_error = $_error . 'M';
    }
    if (strtoupper($robot2) != $checktext) {
        $_error = $_error . 'N';
    }
    if (strlen($_error) > 0) {
        echo "<script> window.location.href = 'register?regerror=1&errtype={$_error}';</script>";
    } else {
        $encr_password = encrypt($username, $_new_password);
        global $DB_HOST, $DB_USERNAME, $DB_PASSWORD, $DB_AUTH;
        $con = connect($DB_HOST, $DB_USERNAME, $DB_PASSWORD);
        $sql = "INSERT INTO " . $DB_AUTH . ".account (username, sha_pass_hash, email, country, age, foundus) VALUES (?,?,?,?,?,?)";
        if ($stmt = $con->prepare($sql)) {
            $stmt->bind_param("ssssss", $username, $encr_password, $email, $country, $age, $foundus);
            $stmt->execute();
            $stmt->close();
        }
        $con->close();
        //echo "<script> window.location.href = 'inc/success?page=register&user=$username';</script>";
        header('Location: register?success');
    }
}
function register_user($username, $email, $password, $repassword, $humtst = 0, $total = 0)
{
    if ($password != $repassword) {
        echo "<font color='#ff0000;'>Passwords does not match <br></font>";
    } else {
        $new_password = encrypt($username, $password);
    }
    $sql = "INSERT INTO `account` (`username`, `sha_pass_hash`, `email`) VALUES (?,?,?)";
    global $db_ip, $db_user, $db_password, $db_auth;
    $con = connect($db_ip, $db_user, $db_password, $db_auth);
    if (check_user_exist($username) > 0) {
        echo "<font color='#ff0000;'>This username is already in use<br></font>";
    }
    if (check_email_exist($email) > 0) {
        echo "<font color='#ff0000;'>This email is already in use<br></font>";
    }
    if (validate_email($email) == false) {
        echo "<font color='#ff0000;'>This email is not valid, using a valid email will help us to aid you in case of a problem related to your account<br></font>";
    }
    if ($total > 0) {
        if ($humtst != $total) {
            echo "<font color='#ff0000;'>Human verification failed <br></font>";
        } else {
            if (check_user_exist($username) == 0 && check_email_exist($email) == 0) {
                if ($stmt = $con->prepare($sql)) {
                    $stmt->bind_param("sss", $username, $new_password, $email);
                    $stmt->execute();
                    $stmt->close();
                    echo "<script type='text/javascript'>window.location.href = '?success={$username}';</script>";
                }
            } else {
                echo "<font color='#ff0000;'>Please fix the errors and try again</font>";
            }
        }
    } else {
        if (check_user_exist($username) == 0 && check_email_exist($email) == 0 && validate_email($email) != false) {
            if ($stmt = $con->prepare($sql)) {
                $stmt->bind_param("sss", $username, $new_password, $email);
                $stmt->execute();
                $stmt->close();
                echo "<script type='text/javascript'>window.location.href = '?success={$username}';</script>";
            }
        } else {
            echo "<font color='#ff0000;'>Please fix the errors and try again</font>";
        }
    }
    $con->close();
}