Beispiel #1
0
/**
 * Assume all users are new. Add them to real db with a prefix_
 */
function merge_core(GDO_Database $db_from, GDO_Database $db_to, array &$db_offsets, $prefix, $prevar)
{
    GDO::setCurrentDB($db_to);
    merge_calc_offset($db_from, $db_to, $db_offsets, 'GWF_User');
    merge_gids($db_from, $db_to, $db_offsets, $prefix, $prevar);
    merge_users($db_from, $db_to, $db_offsets, $prefix, $prevar);
    merge_add_offset($db_from, $db_to, 'GWF_UserGroup', 'ug_userid', $db_offsets['GWF_User']);
    merge_use_mapping($db_from, $db_to, 'GWF_UserGroup', 'ug_groupid', $db_offsets['GWF_Group']);
    merge_table($db_from, $db_to, 'GWF_UserGroup');
}
Beispiel #2
0
$email = "";
if (isset($_POST['pass']) && isset($_POST['email'])) {
    $email = $_POST['email'];
    $hashed = hashpass($_POST['pass']);
    $query = "select password, id from users \n    where email='{$_POST['email']}'";
    $result = query_or_die($query, $con);
    $row = mysql_fetch_row($result);
    if (!$row) {
        $no_user = "******";
        $help_text_user = "******";
    } else {
        if ($row[0] == $hashed) {
            $_SESSION['email'] = $email;
            if (isset($_SESSION['user_id'])) {
                //Anon user pattern, merge delete
                merge_users($_SESSION['user_id'], $row[1]);
                delete_user($_SESSION['user_id']);
            }
            $_SESSION['user_id'] = $row[1];
            $_SESSION['msg'] = array("type" => "success", "text" => "Welcome {$email}!");
            go_home();
        } else {
            $bad_pass = "******";
            $help_text_pass = "******";
        }
    }
}
?>
 <!DOCTYPE html>
<html lang="en">
    <head>
Beispiel #3
0
function action_get_recommended_user()
{
    global $context, $user_info, $smcFunc;
    if (empty($user_info['id'])) {
        $context['recommend'] = array();
        return;
    }
    $user_lists = array();
    //add_watched_your_thread_users
    $thread_ids = array();
    $request = $smcFunc['db_query']('', '
        SELECT t.id_topic
        FROM {db_prefix}topics as t
        WHERE t.id_member_started = {int:current_member}
            AND approved = 1', array('current_member' => $user_info['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $thread_ids[] = $row['id_topic'];
    }
    //fix bug:Database error, given array of integer values is empty. (topic_list)
    if (!$thread_ids) {
        $thread_ids[] = '2000000000';
        //impossible big integer
    }
    $request_members = $smcFunc['db_query']('', '
        SELECT
            ln.id_member 
        FROM {db_prefix}log_notify as ln
        WHERE ln.id_topic IN ({array_int:topic_list})', array('topic_list' => $thread_ids));
    while ($row = $smcFunc['db_fetch_assoc']($request_members)) {
        $user_lists = merge_users($user_lists, array($row['id_member'] => 3));
    }
    //add_thread_watch_users
    $request_members = $smcFunc['db_query']('', '
        SELECT
            t.id_member_started
        FROM {db_prefix}log_notify ln 
        LEFT JOIN {db_prefix}topics t ON (ln.id_topic = t.id_topic)
        WHERE ln.id_member = {int:current_member}', array('current_member' => $user_info['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request_members)) {
        if (!empty($row['id_member_started'])) {
            $user_lists = merge_users($user_lists, array($row['id_member_started'] => 3));
        }
    }
    //add_coversation_users
    $request_members = $smcFunc['db_query']('', '
        SELECT pmr.id_member
        FROM {db_prefix}personal_messages pm
        LEFT JOIN {db_prefix}pm_recipients pmr ON (pmr.id_pm = pm.id_pm)
        WHERE pm.id_member_from = {int:current_member}', array('current_member' => $user_info['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request_members)) {
        if (!empty($row['id_member'])) {
            $user_lists = merge_users($user_lists, array($row['id_member'] => 10));
        }
    }
    //add buddy list users
    $request_buddys = $smcFunc['db_query']('', '
        SELECT buddy_list
        FROM {db_prefix}members
        WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request_buddys)) {
        if (!empty($row['buddy_list'])) {
            $users = explode(',', $row['buddy_list']);
        }
        foreach ($users as $user) {
            if (!empty($user)) {
                $user_lists = merge_users($user_lists, array($user => 5));
            }
        }
    }
    $context['recommend'] = $user_lists;
}
Beispiel #4
0
require 'util.php';
$p1 = $_POST['password'];
$p2 = $_POST['confirm_password'];
$password = hashpass($p1);
$email = $_POST['email'];
$con = get_con();
/*TODO:
 * check to make sure email doesn't exist
 * password not emtpy
 * passwords match (password1, password2)
 * sanitize inputs
 */
if ($p1 == $p2 && !email_exists($email, $con)) {
    $uid = add_user($email, $password, $con);
    if ($uid) {
        $_SESSION['msg'] = array("type" => "success", "text" => "Signup Sucessful!");
        $_SESSION['email'] = $_POST['email'];
        if (isset($_SESSION['user_id'])) {
            //Anon user pattern, merge delete
            merge_users($_SESSION['user_id'], $uid);
            delete_user($_SESSION['user_id']);
        }
        $_SESSION['user_id'] = $uid;
        go_home();
    } else {
        die('Error: ' . mysql_error());
    }
} else {
    go_home();
    $_SESSION['msg'] = array("type" => "error", "text" => "Tunnel fire.");
}