Пример #1
0
function messages_compose($user_id, $user_name, $title = null)
{
    $user_name = htmlspecialchars($user_name);
    $user_id = htmlspecialchars($user_id);
    $title = str_replace('"', '\\"', stripslashes($title));
    if ($user_id < 1 && strlen($user_name) > 0) {
        $query = 'SELECT id FROM login WHERE username LIKE "' . str_replace('_', '\\_', $user_name) . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query));
        $data = mysql_fetch_assoc($result);
        $user_id = $data['id'];
    }
    if (strlen($user_name) < 1 && $user_id > 0 && is_numeric($user_id)) {
        $query = 'SELECT username FROM login WHERE id = "' . $user_id . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query));
        $data = mysql_fetch_assoc($result);
        $user_name = $data['username'];
    }
    if ($user_id < 1 || strlen($user_name) < 1) {
        return false;
    }
    $fetch['login'] = array('id', 'username', 'regtimestamp', 'regip', 'lastlogon', 'lastip', 'lastaction', 'lastusernamechange', 'lastusername');
    $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'forum_signature', 'forum_posts');
    $fetch['traffa'] = array('firstname', 'profile_modules', 'guestbook_entries');
    $userinfo = login_load_user_data($user_id, $fetch);
    traffa_draw_user_div($user_id, $userinfo);
    echo '<div class="grey_faded_div">';
    echo '<h2>Skickar meddelande till ' . $user_name . '</h2>';
    echo '<p>';
    echo '<form name="compose" action="' . $_SERVER['PHP_SELF'] . '?action=send" method="post">';
    echo '<div style="float: right; width: 65px;">';
    echo '<strong>Infoga smilies</strong><br />';
    echo listSmilies('document.compose.message');
    echo '</div>';
    $title = htmlspecialchars(stripslashes($title));
    echo '<strong>Rubrik:</strong> <input type="text" name="title" class="textbox" style="width: 502px;" value="' . $title . '" maxlength="' . MESSAGES_MAX_TITLE_STRLEN . '"/><br />';
    echo '<input type="hidden" name="recipient" value="' . $user_id . '" />';
    echo '<textarea name="message" class="textbox" style="width: 550px; height: 200px;"></textarea><br />';
    echo '</div>';
    echo '<input type="submit" class="button" value="Skicka" />';
    echo '</form>';
    return true;
}
Пример #2
0
$output .= '<div class="repeat">' . "\n";
$output .= '<div class="top">' . "\n";
$output .= '<div class="bottom">' . "\n";
$output .= profile_presentation_parse(profile_presentation_load(array('user_id' => $user_id)));
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
if ($user_id == $_SESSION['login']['id']) {
    $output .= '<a href="/installningar/profilesettings.php" id="profile_change_presentation">Gå till inställningar för din presentation &raquo;</a>';
}
// This is Lef damping on Joel for never fixing new_visitors. So he copypasted from the old profile. Joel will have to change this later on.
if (isset($user_id) && $user_id > 0 && is_numeric($user_id) && $user_id != $_SESSION['login']['id']) {
    $fetch['login'] = array('id', 'username', 'regtimestamp', 'regip', 'lastlogon', 'lastip', 'lastaction', 'lastusernamechange', 'lastusername', 'password', 'session_id');
    $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'forum_signature', 'forum_posts');
    $fetch['traffa'] = array('firstname', 'profile_modules', 'color_theme');
    $userinfo = login_load_user_data($user_id, $fetch);
}
if ($_SESSION['login']['id'] != $user_id && isset($_SESSION['login']['id'])) {
    if (!isset($_SESSION['profile_visits'])) {
        $_SESSION['profile_visits'][] = array('id' => $user_id, 'username' => $userinfo['login']['username'], 'timestamp' => time());
    } else {
        $add_to_list = true;
        foreach ($_SESSION['profile_visits'] as $current) {
            if ($current['id'] == $user_id) {
                $add_to_list = false;
            }
        }
        if ($add_to_list == true) {
            array_unshift($_SESSION['profile_visits'], array('id' => $user_id, 'username' => $userinfo['login']['username'], 'timestamp' => time()));
        }
    }
Пример #3
0
		</fieldset>' . "\n";
$highlights[] = '<strong>%VALUE%</strong>';
$highlights[] = '<em>%VALUE%</em>';
$highlights[] = '<span style="color: green; font-weight: bold;">%VALUE%</span>';
$highlights[] = '<span style="color: red; font-weight: bold;">%VALUE%</span>';
$highlights[] = '<span style="color: blue; font-weight: bold;">%VALUE%</span>';
$highlights[] = '<span style="color: #ababab; font-weight: bold;">%VALUE%</span>';
$highlights[] = '<span style="color: green;">%VALUE%</span>';
$highlights[] = '<span style="color: red;">%VALUE%</span>';
$highlights[] = '<span style="color: blue;">%VALUE%</span>';
$highlights[] = '<span style="color: #ababab;">%VALUE%</span>';
$highlights[] = '<span style="color: #9b0ca0; font-weight: bold;">%VALUE%</span>';
$highlights[] = '<span style="color: #9b0ca0;">%VALUE%</span>';
if (isset($_GET['user_id'])) {
    $fetch['login'] = array('username');
    $user_info = login_load_user_data($_GET['user_id'], $fetch, __FILE__, __LINE__);
    $out .= '<h1>Visar inloggningar från användare #' . $_GET['user_id'] . ' (' . $user_info['login']['username'] . ')</h1>';
    $query = 'SELECT * FROM login_log WHERE user_id = "' . $_GET['user_id'] . '" ORDER BY logon_time DESC LIMIT 500';
    $result = mysql_query($query);
    $out .= '<table style="width: 100%;">';
    while ($data = mysql_fetch_assoc($result)) {
        $ip = long2ip($data['ip']);
        if (!isset($assigned[$ip])) {
            if (count($highlights) > 0) {
                $assigned[$ip] = array_pop($highlights);
            } else {
                $assigned[$ip] = '%VALUE%';
            }
        }
        $display_ip = str_replace('%VALUE%', $ip, $assigned[$ip]);
        $out .= '<tr>' . "\n";
Пример #4
0
function login_dologin($options)
{
    if (!isset($options['method'])) {
        throw new Exception('No login method specified.');
    }
    if (isset($options['username']) && strtolower($options['username']) == 'borttagen') {
        header('Location: http://disneyworld.disney.go.com/wdw/index?bhcp=1');
        throw new Exception('Username CANNOT be "borttagen"!');
    }
    $query = 'SELECT id FROM login WHERE is_removed = 0';
    switch ($options['method']) {
        case 'ghost':
            if (isset($options['username'])) {
                $query .= ' AND username = "******"';
            } else {
                throw new Exception('No username was set!');
            }
            break;
        case 'username_and_password':
            if (isset($options['username']) && isset($options['password'])) {
                $options['password'] = utf8_decode($options['password']);
                $query .= ' AND password_version = 4 AND username = "******" AND password = "******"';
            } else {
                throw new Exception('No username or password was set!');
            }
            break;
        default:
            throw new Exception('Invalid login method.');
    }
    $query .= ' LIMIT 1';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    if (mysql_num_rows($result) > 0) {
        $data = mysql_fetch_assoc($result);
        $user_id = $data['id'];
        // * Fetch neccessary data from login, userinfo, preferences and traffa-tables and unserialize...
        $_SESSION = array_merge($_SESSION, login_load_user_data($user_id, array('login' => array('id', 'lastlogon', 'username', 'password', 'userlevel', 'regtimestamp', 'lastusernamechange', 'session_id', 'lastaction', 'lastip', 'regip', 'quality_level', 'quality_level_expire'), 'userinfo' => array('contact1', 'contact2', 'gender', 'birthday', 'image', 'image_ban_expire', 'forum_signature', 'zip_code', 'forum_quality_rank', 'parlino_activated', 'cell_phone', 'firstname', 'surname', 'email', 'streetaddress', 'msn', 'visible_level', 'phone_ov', 'user_status', 'gbrss'), 'preferences' => array('bubblemessage_visitors', 'allow_hotmessages', 'activate_current_action', 'enable_hetluft', 'randomizer', 'left_login_module', 'enable_shoutbox', 'module_states', 'module_order', 'forum_enable_smilies', 'forum_subscribe_on_create', 'forum_subscribe_on_post', 'gb_anti_p12'), 'traffa' => array('firstname', 'profile_modules')), __FILE__, __LINE__));
        $_SESSION['module_states'] = unserialize($_SESSION['preferences']['module_states']);
        $_SESSION['module_order'] = unserialize($_SESSION['preferences']['module_order']);
        //$_SESSION['preferences']['forum_favourite_categories'] = unserialize($_SESSION['preferences']['forum_favourite_categories']);
        // * Update fields in logon related to the login...
        if ($options['method'] != 'ghost') {
            $login_time = time();
            $query = 'UPDATE login SET lastlogon = ' . $login_time . ', lastip = "' . $_SERVER['REMOTE_ADDR'] . '", session_id = "' . session_id() . '" WHERE id = "' . $user_id . '" LIMIT 1';
            mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            $_SESSION['login']['lastlogon'] = $login_time;
            $_SESSION['login']['lastip'] = $_SERVER['REMOTE_ADDR'];
            $_SESSION['login']['session_id'] = session_id();
            event_log_log('user_log_on');
            if ($_SESSION['login']['lastlogon'] < strtotime(date('Y-m-d'))) {
                event_log_log('user_unique_log_on');
            }
        }
        // * Set some special/initial parametrers...
        $_SESSION['cache']['lastupdate'] = 0;
        switch ($options['method']) {
            case 'ghost':
                $_SESSION['ghost'] = true;
                break;
            case 'username_and_password':
                $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
                $_SESSION['login']['lastlogon'] = time();
                break;
        }
        // * Fetch guestbook notices...
        $guestbook_query = 'SELECT COUNT(id) AS unread FROM traffa_guestbooks WHERE recipient = ' . $user_id . ' AND `read` =  0 AND deleted = 0';
        $guestbook_result = mysql_query($guestbook_query) or report_sql_error($guestbook_query, __FILE__, __LINE__);
        $guestbook_data = mysql_fetch_assoc($guestbook_result);
        $_SESSION['notices']['unread_gb_entries'] = $guestbook_data['unread'];
        // * Fetch group notices...
        $_SESSION = array_merge($_SESSION, login_load_group_data($user_id, array('groups_members' => array('groupid'))));
        // * Fetch friends notices...
        $_SESSION['friends'] = friends_fetch_online_smart(array('user_id' => $user_id));
        // * Fetch visitors from "my visitors"
        $query = 'SELECT DISTINCT(uel.remote_user_id) AS id, uel.timestamp, l.username';
        $query .= ' FROM user_event_log AS uel, login AS l, userinfo AS u';
        $query .= ' WHERE uel.action = "profile_visit" AND uel.user = "******" AND l.id = uel.remote_user_id AND (u.image = 1 OR u.image = 2) AND u.userid = uel.remote_user_id';
        $query .= ' GROUP BY uel.remote_user_id ORDER BY timestamp DESC LIMIT 8';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        $_SESSION['visitors_with_image'] = array();
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['visitors_with_image'][] = $data;
        }
        // * Fetch privilegies...
        $query = 'SELECT privilegie, value FROM privilegies WHERE user = "******"';
        $result = mysql_query($query);
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['privilegies'][$data['privilegie']][is_numeric($data['value']) ? intval($data['value']) : $data['value']] = true;
        }
        // * Log the logon to the database...
        $query = 'INSERT INTO login_log (user_id, logon_time, impressions, ip, ghost)';
        $query .= ' VALUES(' . $user_id . ', ' . time() . ', 0, ' . ip2long($_SERVER['REMOTE_ADDR']) . ', "' . ($options['method'] == 'ghost' ? 'YES' : 'NO') . '")';
        mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        // * Cache some info about the users visits to categories. This is used to calculate new threads and category-subscriptions
        $query = 'SELECT * FROM forum_category_visits WHERE user_id = "' . $user_id . '"';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['forum']['categories'][$data['category_id']] = $data;
        }
    } else {
        if ($options['method'] == 'username_and_password') {
            $query = 'SELECT id FROM login WHERE password_version = 3 AND username = "******" AND password = "******" LIMIT 1';
            $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            if (mysql_num_rows($result) == 1) {
                throw new Exception('<h2>Du använder ett lösenord baserat på det gamla lösenordssystemet. Av säkerhetsskäl måste du byta, det gör du <a href="/installningar/renew_password.php" style="font-weight: bold">på den här sidan &raquo;</a></h2>');
            } else {
                throw new Exception('Det gick inte att logga in med de uppgifter du angav. Detta beror antingen på att du inte angivit korrekt användarnamn och lösenord, eller att användarnamnet inte finns.<br /><br />Har du glömt ditt lösenord? Då finns det inte mycket att göra :(');
            }
        } else {
            throw new Exception('Login failed: User not found or password incorrect.');
        }
    }
}
Пример #5
0
$ui_options['javascripts'] = array('scripts.js');
$ui_options['stylesheets'] = array('profile.css', 'amuse.css');
ui_top($ui_options);
if (isset($_GET['create_photo_album']) && $_GET['id'] == $_SESSION['login']['id']) {
    create_photo_album($_GET['id']);
    header('location: ' . $_SERVER['PHP_SELF'] . '?id=' . $_GET['id']);
}
$userid = $_GET['id'];
$fetch['login'] = array('username', 'regtimestamp', 'lastlogon', 'userlevel', 'lastusernamechange', 'lastusername', 'session_id', 'lastaction', 'id');
if ($_SESSION['login']['userlevel'] >= 4) {
    $fetch['login'] = array_merge($fetch['login'], array('regip', 'lastip'));
}
$fetch['userinfo'] = array('homepage', 'contact1', 'contact2', 'gender', 'birthday', 'geo_municipal', 'geo_location', 'image');
$fetch['traffa'] = array('firstname', 'presentation', 'personality', 'bgimage', 'photos', 'irl', 'height');
$fetch['preferences'] = array('bubblemessage_visitors');
$userdata = login_load_user_data($userid, $fetch);
if ($userdata['login']['username'] == 'Borttagen') {
    echo '<p class="error">Denna användare existerar inte!</p>';
    ui_bottom();
    exit;
}
/* Fix municipal/city info */
if (strlen($userdata['userinfo']['geo_location']) > 0 && $userdata['userinfo']['geo_location'] != $userdata['userinfo']['geo_municipal']) {
    $userdata['userinfo']['geo_municipal'] = $userdata['userinfo']['geo_municipal'] . ' (' . $userdata['userinfo']['geo_location'] . ')';
}
if ($userdata['login']['lastusernamechange'] > time() - 604800) {
    echo '<div class="pink_faded_div" style="font-weight: bold;">Denna användare hette tidigare ' . $userdata['login']['lastusername'] . '</div>';
}
traffaDrawUserDiv($userid, $userdata['login']['username'], $userdata['userinfo']['gender'], $userdata['userinfo']['birthday'], $userdata['login']['lastaction'], $userdata['userinfo']['geo_municipal'], $userdata['login']['lastip']);
echo '<div class="contentPostbox" style="background-image: url(\'/images/traffatablebg.png\'); height: 110px;">';
if ($userdata['userinfo']['image'] == 1 || $userdata['userinfo']['image'] == 2) {
Пример #6
0
function login_dologin($username, $password, $options = array())
{
    $ghost = isset($options['ghost']) && $options['ghost'] == true;
    if (strtolower($username) == 'borttagen') {
        header('Location: http://disneyworld.disney.go.com/wdw/index?bhcp=1');
        exit;
    }
    if ($ghost) {
        $query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "******" LIMIT 1';
        $loginquery = mysql_query($query) or report_sql_error($query);
    } elseif ($username && $password) {
        $password = utf8_decode($password);
        // Test for SHA1 with hash
        $query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "******" AND password_hash = "' . sha1($password . PASSWORD_SALT) . '" LIMIT 1';
        $loginquery = mysql_query($query) or report_sql_error($query);
        if (mysql_num_rows($loginquery) == 0) {
            // SHA1 not found, try the old MD5
            $md5_query = 'SELECT id FROM login WHERE username = "******" AND password = "******" LIMIT 1';
            $md5_result = mysql_query($md5_query) or report_sql_error($md5_query);
            if (mysql_num_rows($md5_result) == 1) {
                // MD5 found, update to SHA1
                $data = mysql_fetch_assoc($md5_result);
                $md5_to_sha1_query = 'UPDATE login SET password = "", password_hash = "' . sha1($password . PASSWORD_SALT) . '" WHERE id = "' . $data['id'] . '" LIMIT 1';
                mysql_query($md5_to_sha1_query);
                // Load data using the SHA1-hash
                $query = 'SELECT id, lastaction, lastlogon, session_id FROM login WHERE username = "******" AND password_hash = "' . sha1($password . PASSWORD_SALT) . '" LIMIT 1';
                $loginquery = mysql_query($query) or die('Query failed: ' . mysql_error());
            }
        }
    } else {
        return 2;
    }
    if (mysql_num_rows($loginquery) > 0) {
        $tempdata = mysql_fetch_assoc($loginquery);
        if ($tempdata['lastlogon'] < strtotime(date('Y-m-d'))) {
            event_log_log('user_unique_log_on');
        }
        if ($tempdata['lastaction'] > time() - 600 && false) {
            $old_session = session_load($tempdata['session_id']);
            session_destroy();
            session_id($tempdata['session_id']);
            session_start();
            $_SESSION = $old_session;
            if (isset($_SESSION['login']['id'])) {
                if ($ghost) {
                    $_SESSION['ghost'] = true;
                }
                return true;
            }
        }
        if ($ghost) {
            $_SESSION['ghost'] = true;
        }
        $uid = $tempdata['id'];
        $ip = $_SERVER['REMOTE_ADDR'];
        $_SESSION['cache']['lastupdate'] = 0;
        $_SESSION['userid'] = $uid;
        $_SESSION['login']['id'] = $uid;
        $guestbook_sql = 'SELECT COUNT(id) AS unread FROM traffa_guestbooks WHERE recipient = ' . $_SESSION['login']['id'] . ' AND `read` =  0 AND deleted = 0';
        $guestbook_result = mysql_query($guestbook_sql) or die('Ett fel inträffade!' . mysql_error() . $guestbook_sql);
        $guestbook_data = mysql_fetch_assoc($guestbook_result);
        $_SESSION['notices']['unread_gb_entries'] = $guestbook_data['unread'];
        require_once $hp_includepath . 'message-functions.php';
        $message_status = messages_count_unread($_SESSION['login']['id']);
        $_SESSION['notices']['unread_messages'] = $message_status;
        $fetch['login'] = array('id', 'lastlogon', 'username', 'password_hash', 'userlevel', 'regtimestamp', 'lastusernamechange', 'session_id', 'lastaction', 'lastip', 'regip', 'quality_level', 'quality_level_expire');
        $fetch['preferences'] = array('bubblemessage_visitors', 'allow_hotmessages', 'activate_current_action', 'enable_hetluft', 'randomizer', 'left_login_module', 'enable_shoutbox', 'module_states', 'module_order', 'forum_enable_smilies', 'forum_subscribe_on_create', 'forum_subscribe_on_post');
        $fetch['traffa'] = array('firstname', 'profile_modules');
        $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'image_ban_expire', 'forum_signature', 'zip_code', 'forum_quality_rank', 'parlino_activated', 'cell_phone', 'firstname', 'surname', 'email', 'streetaddress', 'msn', 'visible_level', 'phone_ov', 'user_status', 'gbrss');
        $userinfo = login_load_user_data($uid, $fetch, __FILE__, __LINE__);
        $_SESSION = array_merge($_SESSION, $userinfo);
        //				$_SESSION['preferences']['forum_favourite_categories'] = unserialize($_SESSION['preferences']['forum_favourite_categories']);
        $_SESSION['module_states'] = unserialize($_SESSION['preferences']['module_states']);
        $_SESSION['module_order'] = explode('|', $_SESSION['preferences']['module_order']);
        /* Notes in the note-module */
        $query = 'SELECT text FROM notes WHERE id = "' . $_SESSION['login']['id'] . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        $data = mysql_fetch_assoc($result);
        $_SESSION['note'] = $data['text'];
        /* groups-start-here */
        $group_data['groups_members'] = array('groupid');
        $groups = login_load_group_data($uid, $group_data);
        $_SESSION = array_merge($_SESSION, $groups);
        if (!$ghost) {
            $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
        }
        /* Friends start here */
        $options['user_id'] = $_SESSION['login']['id'];
        $_SESSION['friends'] = friends_fetch_online_smart($options);
        $query = 'SELECT DISTINCT(uel.remote_user_id) AS id, uel.timestamp, l.username ';
        $query .= 'FROM user_event_log AS uel, login AS l, userinfo AS u';
        $query .= ' WHERE uel.action = "profile_visit" AND uel.user = "******" AND l.id = uel.remote_user_id AND (u.image = 1 OR u.image = 2) AND u.userid = uel.remote_user_id';
        $query .= ' GROUP BY uel.remote_user_id ORDER BY timestamp DESC LIMIT 8';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['visitors_with_image'][] = $data;
        }
        /* Fetch the latest posts, the posts antiflood system will use this */
        $query = 'SELECT MD5(content), timestamp FROM posts WHERE author = "' . $_SESSION['login']['id'] . '" ORDER BY id DESC LIMIT 50';
        $result = mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['posts']['latest'][] = $data;
        }
        /* Fetch privilegies */
        $query = 'SELECT privilegie, value FROM privilegies WHERE user = "******"';
        $result = mysql_query($query);
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['privilegies'][$data['privilegie']][is_numeric($data['value']) ? intval($data['value']) : $data['value']] = true;
        }
        /* Log the logon to database */
        $query = 'INSERT INTO login_log (user_id, logon_time, impressions, ip, ghost) VALUES(' . $_SESSION['login']['id'] . ', ' . time();
        $query .= ', 0, ' . ip2long($_SERVER['REMOTE_ADDR']) . ', "' . ($ghost ? 'YES' : 'NO') . '")';
        mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
        if (!$ghost) {
            $sql = 'UPDATE login SET lastlogon = ' . time() . ', lastip = "' . $ip . '", session_id = "' . session_id() . '" WHERE id = "' . $uid . '" LIMIT 1';
            mysql_query($sql) or die('Query failed: ' . mysql_error());
            $_SESSION['login']['lastlogon'] = time();
        }
        /* Cache some info about the users visits to categories. This is used to calculate new threads and category-subscriptions */
        $query = 'SELECT * FROM forum_category_visits WHERE user_id = "' . $_SESSION['login']['id'] . '"';
        $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        while ($data = mysql_fetch_assoc($result)) {
            $_SESSION['forum']['categories'][$data['category_id']] = $data;
        }
        return 1;
    } else {
        return 0;
    }
}
Пример #7
0
            //Spara uppgifter
            $query = 'UPDATE userinfo SET';
            $query .= ' firstname="' . $_POST['firstname'] . '"';
            $query .= ', surname="' . $_POST['surname'] . '"';
            $query .= ', email="' . $_POST['email'] . '"';
            $query .= ', msn="' . $_POST['msn'] . '"';
            $query .= ', streetaddress="' . $_POST['streetaddress'] . '"';
            $query .= ', zip_code="' . $_POST['zip_code'] . '"';
            $query .= ', birthday="' . $_POST['birthday'] . '"';
            $query .= ', phone_ov="' . $_POST['phone_ov'] . '"';
            $query .= ', visible_level="' . $_POST['visible_level'] . '"';
            $query .= ' WHERE userid ="' . $_SESSION['login']['id'] . '"';
            mysql_query($query) or die(report_sql_error($query, __FILE__, __LINE__));
            echo '<h2>Dina uppgifter är sparade</h2>';
            $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'image_ban_expire', 'forum_signature', 'zip_code', 'forum_quality_rank', 'parlino_activated', 'cell_phone', 'firstname', 'surname', 'email', 'streetaddress', 'msn', 'visible_level', 'phone_ov');
            $userinfo = login_load_user_data($_SESSION['login']['id'], $fetch, __FILE__, __LINE__);
            $_SESSION = array_merge($_SESSION, $userinfo);
        }
    }
    echo '
	<h1>Kontaktuppgifter för ordningsvakter</h1>
	<p>För att vi ska kunna komma i kontakt med ordningsvakter som kan ha hanterat
pedofiler, eventuellt brutit mot våra regler eller om vi snabbt behöver reda
ut något behöver vi kontaktuppgifter.
I krissituationer, som när Flashback kör spammattacker, skulle
kontaktuppgifter göra det lättare att mobilisera en OV-styrka</p>
	<form method="post" action="/admin/ov_reg.php">';
    $items['firstname'] = 'Förnamn';
    $items['surname'] = 'Efternamn';
    $items['email'] = 'E-post';
    $items['msn'] = 'MSN';
Пример #8
0
function traffa_draw_user_div($userid, $info = null)
{
    /* If you already have information from the database, please pass it on in the $info
    	   parameter. The information should be formatted like this:
    	   $info['login']['username'] = '******';
    	   $info['userinfo']['birthday'] = '1970-01-01';
    	   Note that it isn't necessary to have complete info, the script will fetch all info
    	   not sent.
    	   Please note that this function returns all the data used, you may use it further in your script.
    	   Return will look like this:
    	   $return['status'] = 'success'/'fail';
    	   $return['reason'] = null or error explanation.
    	   $return['login']['lastaction'] = 118371272;
    	*/
    /* $info is unset further down and the snyggve-info isn't fetched in this function. */
    if ($info['snyggve'] == 1) {
        $snyggve = 1;
    }
    if ($userid < 1) {
        to_logfile('error', __FILE__, __LINE__, 'traffa_draw_user_div() was called without userid', print_r(debug_backtrace(), true));
    }
    $fetch['login'] = array('username', 'lastaction', 'lastrealaction', 'lastlogon', 'regtimestamp', 'userlevel');
    $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'zip_code', 'image', 'current_action', 'cell_phone', 'user_status');
    $fetch['traffa'] = array('firstname', 'color_theme');
    $fetch['preferences'] = array('activate_current_action');
    /* Remove already known fields from the fetch array */
    foreach ($info as $table) {
        foreach ($table as $row) {
            unset($fetch[$table][$row]);
        }
    }
    $userinfo = login_load_user_data($userid, $fetch);
    if (!is_array($userinfo)) {
        to_logfile('error', 'userinfo was not an array, as expected.', __FILE__, __LINE__);
        die('<p class="error">Ett internt fel orsakades. Visningen av sidan har stoppats och hamsterpajs utvecklingsavdelning har underrättats.</p>');
    }
    /* Inject already known fields to the userinfo array */
    foreach ($info as $table) {
        foreach ($table as $row) {
            $userinfo[$table][$row] = $info[$table][$row];
        }
    }
    unset($info);
    switch ($userinfo['traffa']['color_theme']) {
        case '1':
            $profile_colors['light'] = '#edf4fd';
            $profile_colors['background'] = '#c9ddf9';
            $profile_colors['dark'] = '#7ba0cf';
            $profile_colors['border'] = '#3f5879';
            break;
        case '2':
            $profile_colors['light'] = '#f1edfd';
            $profile_colors['background'] = '#d1c9f9';
            $profile_colors['dark'] = '#897bcf';
            $profile_colors['border'] = '#493f79';
            break;
        case '3':
            $profile_colors['light'] = '#faedfd';
            $profile_colors['background'] = '#efc9f9';
            $profile_colors['dark'] = '#bb7bcf';
            $profile_colors['border'] = '#6b3f79';
            break;
        case '4':
            $profile_colors['light'] = '#fdedf7';
            $profile_colors['background'] = '#f9c9e7';
            $profile_colors['dark'] = '#cf7bb0';
            $profile_colors['border'] = '#793f64';
            break;
        case '5':
            $profile_colors['light'] = '#fdeeed';
            $profile_colors['background'] = '#f9c9c9';
            $profile_colors['dark'] = '#cf7b7d';
            $profile_colors['border'] = '#793f40';
            break;
        case '6':
            $profile_colors['light'] = '#fdf7ed';
            $profile_colors['background'] = '#f9e6c9';
            $profile_colors['dark'] = '#cfaa7b';
            $profile_colors['border'] = '#79603f';
            break;
        case '7':
            $profile_colors['light'] = '#fafded';
            $profile_colors['background'] = '#f0f9c9';
            $profile_colors['dark'] = '#c1cf7b';
            $profile_colors['border'] = '#6f793f';
            break;
        case '8':
            $profile_colors['light'] = '#f0fded';
            $profile_colors['background'] = '#d4f9c9';
            $profile_colors['dark'] = '#8dcf7b';
            $profile_colors['border'] = '#4b793f';
            break;
        case '9':
            $profile_colors['light'] = '#edfdf4';
            $profile_colors['background'] = '#c9f9dc';
            $profile_colors['dark'] = '#7bcf9a';
            $profile_colors['border'] = '#3f7954';
            break;
        case '10':
            $profile_colors['light'] = '#edfdfd';
            $profile_colors['background'] = '#c9f9f8';
            $profile_colors['dark'] = '#7bcfcd';
            $profile_colors['border'] = '#3f7978';
            break;
        default:
            $profile_colors['light'] = '#edf4fd';
            $profile_colors['background'] = '#c9ddf9';
            $profile_colors['dark'] = '#7ba0cf';
            $profile_colors['border'] = '#3f5879';
            break;
    }
    if ($userinfo['userinfo']['image'] == 1 || $userinfo['userinfo']['image'] == 2) {
        $image_code = ui_avatar($userid, array('style' => 'float: left; margin: 5px; border: 1px solid #3f657a;'));
    } elseif ($userid == $_SESSION['login']['id']) {
        $image_code = '<div class="avatar" style="float: left;"><img src="http://images.hamsterpaj.net/images/noimage.png" /><input type="button" class="button" value="Fixa bild" onclick="window.location=\'/avatar-settings.php\';" /></div>' . "\n";
    } else {
        $image_code = '<img src="http://images.hamsterpaj.net/images/noimage.png" class="avatar" style="float: left; margin: 5px;" />';
    }
    $gender = '';
    if ($userinfo['userinfo']['gender'] == 'm') {
        $gender = 'pojke ';
    } elseif ($userinfo['userinfo']['gender'] == 'f') {
        $gender = 'flicka ';
    }
    $location = strlen($userinfo['userinfo']['geo_location']) > 0 ? 'från ' . $userinfo['userinfo']['geo_location'] : '';
    if ($_SESSION['userinfo']['x_rt90'] > 0 && $userinfo['userinfo']['x_rt90'] > 0 && $userinfo['userinfo']['zip_code'] != $_SESSION['userinfo']['zip_code']) {
        $location .= ', ' . rt90_readable(rt90_distance($_SESSION['userinfo']['x_rt90'], $_SESSION['userinfo']['y_rt90'], $userinfo['userinfo']['x_rt90'], $userinfo['userinfo']['y_rt90']));
    }
    if ($userinfo['userinfo']['x_rt90'] > 0) {
        /* Note RT90 Y and X values are flipped, due to a "bug" at hitta.se */
        /* Reference: daniel.eklund@hitta.se */
        $hittapunktse_url = 'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&pointY=' . $userinfo['userinfo']['x_rt90'] . '&z=4&name=' . $userinfo['login']['username'];
        $hittapunktse_url .= '&cy=' . $userinfo['userinfo']['x_rt90'] . '&cx' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url = 'http://www.hitta.se/LargeMap.aspx?ShowSatellite=false&pointX=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&pointY=' . $userinfo['userinfo']['x_rt90'] . '&cx=' . $userinfo['userinfo']['y_rt90'];
        $hittapunktse_url .= '&cy=' . $userinfo['userinfo']['x_rt90'] . '&z=6&name=' . $userinfo['login']['username'];
        $location_button = '<input type="button" value="Visa på karta" class="button_90" onclick="';
        $location_button .= "window.open('{$hittapunktse_url}', 'user_map_{$userid}', 'location=false, width=750, height=500');";
        $location_button .= '" style="float: right;"/>' . "\n";
    }
    if ($userid == 20702) {
        $location = 'från Internet ';
    }
    $age = '';
    if ($userinfo['userinfo']['birthday'] != '0000-00-00') {
        $age = date_get_age($userinfo['userinfo']['birthday']) . ' år ';
    }
    $status = login_onlinestatus($userinfo['login']['lastaction'], $userinfo['login']['lastrealaction']);
    //	$onlinestatus = '<span style="color: grey;">Offline</span>';
    //	$onlinestatus = '<span style="font-size: 14px;">Loggade senast in ' . fix_time($userinfo['login']['lastlogon']) . '</span>' . "\n";
    switch ($status['handle']) {
        case 'offline':
            if ($userinfo['login']['lastrealaction'] == 0) {
                $onlinestatus = '<span style="font-size: 14px;">Sågs senast ' . fix_time($userinfo['login']['lastlogon']) . '</span>' . "\n";
            } else {
                $onlinestatus = '<span style="font-size: 14px;">Sågs senast ' . fix_time($userinfo['login']['lastrealaction']) . '</span>' . "\n";
            }
            break;
        case 'online':
            $hours = floor(($userinfo['login']['lastaction'] - $userinfo['login']['lastlogon']) / 3600);
            $minutes = floor(($userinfo['login']['lastaction'] - $userinfo['login']['lastlogon'] - $hours * 3600) / 60);
            $onlinestatus = '<span style="color: green; font-size: 14px;">Online </span><span style="font-size: 14px;"> sedan ';
            $onlinestatus .= $hours > 0 ? $hours . ' timmar och ' : null;
            $onlinestatus .= $minutes . ' minuter</span>';
            break;
        case 'idle':
            $onlinestatus = $status['label'] . ' sedan ' . date('H:i', $userinfo['login']['lastrealaction']);
            break;
    }
    $contact1 = strlen($userinfo['userinfo']['contact1']) > 0 ? parseContact($userinfo['userinfo']['contact1']) : array('label' => 'Kontaktsätt', 'link' => '-');
    $contact2 = strlen($userinfo['userinfo']['contact2']) > 0 ? parseContact($userinfo['userinfo']['contact2']) : array('label' => 'Kontaktsätt', 'link' => '-');
    $firstname = strlen($userinfo['traffa']['firstname']) > 0 ? $userinfo['traffa']['firstname'] : '-';
    $right_now = strlen($userinfo['userinfo']['current_action']) > 0 ? $userinfo['userinfo']['current_action'] : 'Okänt';
    if ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d'))) {
        $lastlogon = 'Idag ' . date('H:i', $userinfo['login']['lastlogon']);
    } elseif ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d')) - 86400) {
        $lastlogon = 'Igår ' . date('H:i', $userinfo['login']['lastlogon']);
    } elseif ($userinfo['login']['lastlogon'] > strtotime(date('Y-m-d')) - 518400) {
        $weekdays = array('Söndags', 'Måndags', 'Tisdags', 'Onsdags', 'Torsdags', 'Fredags', 'Lördags');
        $lastlogon = 'I ' . $weekdays[date('w', $userinfo['login']['lastlogon'])] . ' klockan ' . date('H:i', $userinfo['login']['lastlogon']);
    } else {
        $lastlogon = date('Y-m-d H:i', $userinfo['login']['lastlogon']);
    }
    echo '<div style="height: 120px; margin: -3px; margin-bottom: 3px; background: ' . $profile_colors['background'] . '; border-bottom: 1px solid ' . $profile_colors['border'] . '; padding: 3px;">' . "\n";
    if (strlen($userinfo['userinfo']['user_status']) > 0) {
        echo '<h3>' . $userinfo['userinfo']['user_status'] . '</h3>' . "\n";
    }
    echo $image_code . "\n";
    echo '<div style="width: 545px; float: left;">' . "\n";
    echo '<div style="background: white;">' . "\n";
    echo '<h2 style="margin: 0px; font-size: 19px;">' . $userinfo['login']['username'] . ' - ' . $gender . $age . $location . $location_button . '</h2>' . "\n";
    echo '<h3>' . $onlinestatus . '</h3>' . "\n";
    echo '</div>' . "\n";
    echo '<div style="width: 400px;">' . "\n";
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">Förnamn</span><br />' . $firstname . '</div>';
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">Blev medlem: </span><br/> ' . date('Y-m-d', $userinfo['login']['regtimestamp']) . '</div><br />' . "\n";
    echo '<div style="float: left; clear: both; width: 50%;"><span style="font-weight: bold;">' . $contact1['label'] . '</span><br />' . $contact1['link'] . '</div>' . "\n";
    echo '<div style="float: left; clear: right; width: 50%;"><span style="font-weight: bold;">' . $contact2['label'] . '</span><br />' . $contact2['link'] . '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '<div style="margin: -3px; border-bottom: 1px solid ' . $profile_colors['border'] . '; background: ' . $profile_colors['dark'] . '; height: 25px; font-weight: bold; color: white;">' . "\n";
    $links[] = array('width' => 95, 'label' => 'Presentation', 'uri' => '/traffa/profile.php?id=' . $userid);
    $links[] = array('width' => 85, 'label' => 'Gästbok', 'uri' => '/traffa/guestbook.php?view=' . $userid);
    if ($_SESSION['login']['id'] == $userid) {
        $links[] = array('width' => 150, 'label' => 'Mina meddelanden', 'uri' => '/traffa/messages.php');
        $links[] = array('width' => 100, 'label' => 'Mina besök', 'uri' => '/traffa/my_visitors_joel.php');
    } else {
        $links[] = array('width' => 185, 'label' => 'Skicka privatmeddelande', 'uri' => '/traffa/messages.php?action=compose&amp;recipient_username='******'login']['username'] . '&amp;recipient_id=' . $userid);
    }
    foreach ($links as $current) {
        echo '<div style="float: left; width: ' . $current['width'] . 'px; line-height: 25px; border-right: 1px solid #3f657a; height: 25px; text-align: center;"><a href="' . $current['uri'] . '" style="color: white;">' . $current['label'] . '</a></div>' . "\n";
    }
    if ($userid != $_SESSION['login']['id'] && login_checklogin()) {
        echo '<input type="button" class="button_80" style="float: right; margin-right: 5px; margin-top: 3px;" value="Kompis" onclick="window.open(\'/traffa/friends_popup.php?user_id=' . $userid . '\', \'cpinternetexplorer\', \'location=no, width=200, height=100\');" />' . "\n";
        echo '<input type="button" class="button_100" style="float: right; margin-right: 5px; margin-top: 3px;" value="Rapportera" onclick="abuse_report(\'user\', ' . $userid . ');" />' . "\n";
    }
    if ($_SERVER['REQUEST_URI'] == '/traffa/my_visitors.php') {
        treasure_item(9);
    }
    echo '</div>' . "\n";
}
Пример #9
0
} else {
    /*
    if(644314 == $_SESSION['login']['id'])
    {
    	preint_r($userinfo);
    }
    */
    if (isset($_SESSION['login']['id'])) {
        $userid = $_SESSION['login']['id'];
        $userinfo['login'] = $_SESSION['login'];
        $userinfo['userinfo'] = $_SESSION['userinfo'];
        $userinfo['traffa'] = $_SESSION['traffa'];
        $userinfo['preferences'] = $_SESSION['preferences'];
        /* Since the users presentation isn't stored in the session array, we will have to fetch it from the database... */
        $fetch['traffa'] = array('color_theme');
        $color_theme = login_load_user_data($userid, $fetch);
        $userinfo['traffa']['color_theme'] = $color_theme['traffa']['color_theme'];
        unset($presentation);
    } else {
        $die = 1;
    }
}
switch ($userinfo['traffa']['color_theme']) {
    case '1':
        $profile_colors['light'] = '#edf4fd';
        $profile_colors['background'] = '#c9ddf9';
        $profile_colors['dark'] = '#7ba0cf';
        $profile_colors['border'] = '#3f5879';
        break;
    case '2':
        $profile_colors['light'] = '#f1edfd';