当前位置: 首页>>代码示例>>PHP>>正文


PHP is_md5函数代码示例

本文整理汇总了PHP中is_md5函数的典型用法代码示例。如果您正苦于以下问题:PHP is_md5函数的具体用法?PHP is_md5怎么用?PHP is_md5使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_md5函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setSenha

 public function setSenha($senha)
 {
     if (vazio_ou_nulo($senha)) {
         throw new RegraDeNegocioException('Senha não pode ser vazia!');
     }
     $senhaTamanho = strlen($senha);
     if ($senhaTamanho > 16 || $senhaTamanho < 4) {
         throw new RegraDeNegocioException('Senha deve ter entre 4 e 16 caracteres!');
     }
     if (!is_md5($senha)) {
         $senha = md5($senha);
     }
     $this->senha = $senha;
 }
开发者ID:BGCX067,项目名称:facomcrm-svn-to-git,代码行数:14,代码来源:Usuario.php

示例2: pm_add_sent_item

function pm_add_sent_item($sent_item_mid, $to_uid, $from_uid, $subject, $content, $aid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($sent_item_mid)) {
        return false;
    }
    if (!is_numeric($to_uid)) {
        return false;
    }
    if (!is_numeric($from_uid)) {
        return false;
    }
    if (!is_md5($aid)) {
        return false;
    }
    // Escape the subject and content for insertion into database.
    $subject_escaped = $db->escape($subject);
    $content_escaped = $db->escape($content);
    // PM_SENT constant.
    $pm_sent = PM_SENT;
    // Current datetime
    $current_datetime = date(MYSQL_DATETIME, time());
    // Insert the main PM Data into the database
    $sql = "INSERT INTO PM (TYPE, TO_UID, FROM_UID, SUBJECT, RECIPIENTS, ";
    $sql .= "CREATED, NOTIFIED, SMID) VALUES ('{$pm_sent}', '{$to_uid}', '{$from_uid}', ";
    $sql .= "'{$subject_escaped}', '', CAST('{$current_datetime}' AS DATETIME), ";
    $sql .= "1, '{$sent_item_mid}')";
    if ($db->query($sql)) {
        $new_mid = $db->insert_id;
        // Insert the PM Content into the database
        $sql = "INSERT INTO PM_CONTENT (MID, CONTENT) ";
        $sql .= "VALUES ('{$new_mid}', '{$content_escaped}')";
        if (!$db->query($sql)) {
            return false;
        }
        // Save the attachment ID.
        pm_save_attachment_id($new_mid, $aid);
        return $new_mid;
    }
    return false;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:43,代码来源:pm.inc.php

示例3: forum_get_password

function forum_get_password($forum_fid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($forum_fid)) {
        return false;
    }
    $sql = "SELECT FORUM_PASSWD FROM FORUMS WHERE FID = '{$forum_fid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    list($forum_passwd) = $result->fetch_row();
    return is_md5($forum_passwd) ? $forum_passwd : false;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:18,代码来源:forum.inc.php

示例4: fix_html

if (isset($_POST['message_text']) && strlen(trim($_POST['message_text'])) > 0) {
    $message_text = fix_html(emoticons_strip($_POST['message_text']));
}
$allow_html = true;
$allow_sig = true;
if (isset($fid) && !session::check_perm(USER_PERM_HTML_POSTING, $fid)) {
    $allow_html = false;
}
if (isset($fid) && !session::check_perm(USER_PERM_SIGNATURE, $fid)) {
    $allow_sig = false;
}
if ($allow_html == false) {
    $message_text = htmlentities_array($message_text);
    $sig_text = htmlentities_array($sig_text);
}
if (isset($_POST['aid']) && is_md5($_POST['aid'])) {
    $aid = $_POST['aid'];
} else {
    $aid = md5(uniqid(mt_rand()));
}
if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) {
    html_email_confirmation_error();
    exit;
}
if (isset($_POST['preview_poll']) || isset($_POST['preview_form']) || isset($_POST['post'])) {
    $valid = true;
    if (!isset($thread_title) || strlen(trim($thread_title)) == 0) {
        $error_msg_array[] = gettext("You must enter a title for the thread!");
        $valid = false;
    }
    if (!isset($fid) || !folder_is_valid($fid)) {
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:31,代码来源:create_poll.php

示例5: post_save_attachment_id

function post_save_attachment_id($tid, $pid, $aid)
{
    if (!is_numeric($tid)) {
        return false;
    }
    if (!is_numeric($pid)) {
        return false;
    }
    if (!is_md5($aid)) {
        return false;
    }
    if (!($db = db::get())) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $sql = "INSERT INTO POST_ATTACHMENT_IDS (FID, TID, PID, AID) ";
    $sql .= "VALUES ({$forum_fid}, {$tid}, {$pid}, '{$aid}') ON DUPLICATE KEY ";
    $sql .= "UPDATE AID = VALUES(AID)";
    if (!$db->query($sql)) {
        return false;
    }
    return true;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:28,代码来源:post.inc.php

示例6: message_display


//.........这里部分代码省略.........
        echo "<table class=\"thread_track_notice\" width=\"96%\">\n";
        echo "  <tr>\n";
        echo "    <td align=\"left\">", sprintf(gettext("<b>Thread Split:</b> This post has been moved %s"), $post_link), "</td>\n";
        echo "  </tr>\n";
        echo "</table>\n";
        echo "</div>\n";
        echo $in_list ? "<br />\n" : '';
        return;
    }
    echo "<div align=\"center\">\n";
    echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
    echo "  <tr>\n";
    if ($in_list && !$is_preview) {
        message_display_navigation($tid, $message['PID'], $first_msg, $msg_count, $posts_per_page);
    }
    echo "    <td align=\"center\">\n";
    echo "      <table width=\"100%\" class=\"box\" cellpadding=\"0\">\n";
    echo "        <tr>\n";
    echo "          <td align=\"left\">\n";
    echo "            <table class=\"posthead\" width=\"100%\">\n";
    echo "              <tr>\n";
    echo "                <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"posttofromlabel\">&nbsp;", gettext("From"), ":&nbsp;</span></td>\n";
    echo "                <td style=\"white-space: nowrap\" width=\"98%\" align=\"left\"><span class=\"posttofrom\">";
    if ($message['FROM_UID'] > -1) {
        echo "<a href=\"user_profile.php?webtag={$webtag}&amp;uid={$message['FROM_UID']}\" target=\"_blank\" class=\"popup 650x500\">";
        echo word_filter_add_ob_tags(format_user_name($message['FLOGON'], $message['FNICK']), true), "</a></span>";
    } else {
        echo word_filter_add_ob_tags(format_user_name($message['FLOGON'], $message['FNICK']), true), "</span>";
    }
    if (session::get_value('SHOW_AVATARS') == 'Y') {
        if (isset($message['AVATAR_URL']) && strlen($message['AVATAR_URL']) > 0) {
            echo "&nbsp;<img src=\"{$message['AVATAR_URL']}\" alt=\"\" title=\"", word_filter_add_ob_tags(format_user_name($message['FLOGON'], $message['FNICK']), true), "\" border=\"0\" width=\"16\" height=\"16\" />";
        } else {
            if (isset($message['AVATAR_AID']) && is_md5($message['AVATAR_AID'])) {
                $attachment = attachments_get_by_hash($message['AVATAR_AID']);
                if ($profile_picture_href = attachments_make_link($attachment, false, false, false, false)) {
                    echo "&nbsp;<img src=\"{$profile_picture_href}&amp;avatar_picture\" alt=\"\" title=\"", word_filter_add_ob_tags(format_user_name($message['FLOGON'], $message['FNICK']), true), "\" border=\"0\" width=\"16\" height=\"16\" />\n";
                }
            }
        }
    }
    $temp_ignore = false;
    // If the user posting a poll is ignored, remove ignored status for this message only so the poll can be seen
    if ($is_poll && isset($message['PID']) && $message['PID'] == 1 && $message['FROM_RELATIONSHIP'] & USER_IGNORED) {
        $message['FROM_RELATIONSHIP'] -= USER_IGNORED;
        $temp_ignore = true;
    }
    if ($message['FROM_RELATIONSHIP'] & USER_FRIEND) {
        echo "&nbsp;<img src=\"", html_style_image('friend.png'), "\" alt=\"", gettext("Friend"), "\" title=\"", gettext("Friend"), "\" />";
    } else {
        if ($message['FROM_RELATIONSHIP'] & USER_IGNORED || $temp_ignore) {
            echo "&nbsp;<img src=\"", html_style_image('enemy.png'), "\" alt=\"", gettext("Ignored user"), "\" title=\"", gettext("Ignored user"), "\" />";
        }
    }
    echo "</td>\n";
    echo "                <td width=\"1%\" align=\"right\" style=\"white-space: nowrap\"><span class=\"postinfo\">";
    if ($message['FROM_RELATIONSHIP'] & USER_IGNORED && $limit_text && $uid != 0) {
        echo "<b>", gettext("Ignored message"), "</b>";
    } else {
        if ($in_list) {
            if ($from_user_permissions & USER_PERM_WORMED) {
                echo "<b>", gettext("Wormed user"), "</b> ";
            }
            if ($message['FROM_RELATIONSHIP'] & USER_IGNORED_SIG) {
                echo "<b>", gettext("Ignored signature"), "</b> ";
            }
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:67,代码来源:messages.inc.php

示例7: openinviter_conf

function openinviter_conf()
{
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $options = array();
        $ers = array();
        if (empty($_POST['message_body_box'])) {
            $ers['message'] = __("Message missing");
        } elseif (strlen($_POST['message_body_box']) < 15) {
            $ers['message'] = __("Message body too short. Minimum length: 15 chars");
        } else {
            $options['message_body'] = $_POST['message_body_box'];
        }
        if (empty($_POST['message_subject_box'])) {
            $ers['message_subject'] = __("Message subject missing");
        } elseif (strlen($_POST['message_subject_box']) < 5) {
            $ers['message_subject'] = __("Message subject too short. Minimum length: 5 chars");
        } else {
            $options['message_subject'] = $_POST['message_subject_box'];
        }
        if (empty($_POST['username_box'])) {
            $ers['username'] = __("OpenInviter.com Username missing");
        } else {
            $options['username'] = $_POST['username_box'];
        }
        if (empty($_POST['private_key_box'])) {
            $ers['private_key'] = __("OpenInviter.com Private Key missing");
        } elseif (!is_md5($_POST['private_key_box'])) {
            $ers['private_key'] = __("Invalid OpenInviter.com Private Key");
        } else {
            $options['private_key'] = $_POST['private_key_box'];
        }
        if (empty($_POST['transport_box'])) {
            $ers['transport'] = __("Transport missing");
        } else {
            $options['transport'] = $_POST['transport_box'];
        }
        if (empty($_POST['cookie_path_box'])) {
            $ers['cookie'] = __("Cookie path missing");
        } else {
            $options['cookie_path'] = $_POST['cookie_path_box'];
        }
        if (empty($_POST['local_debug_box'])) {
            $ers['local_debug'] = __("Local debugger setting missing");
        } else {
            $options['local_debug'] = $_POST['local_debug_box'] == 'off' ? false : $_POST['local_debug_box'];
        }
        if (empty($_POST['remote_debug_box'])) {
            $ers['remote_debug'] = __("Remote debugger setting missing");
        } else {
            $options['remote_debug'] = $_POST['remote_debug_box'] == 'on' ? true : false;
        }
        if (!isset($_POST['filter_emails_box'])) {
            $options['filter_emails'] = false;
        } else {
            $options['filter_emails'] = true;
        }
        if (count($ers) == 0) {
            if (!get_option('openinviter_settings')) {
                add_option('openinviter_settings', $options);
            } else {
                update_option('openinviter_settings', $options);
            }
            $path = WP_PLUGIN_DIR . "/openinviter-for-wordpress/oi_includes/config.php";
            $file_contents = "<?php\n";
            $file_contents .= "\$openinviter_settings=array(\n" . row2text($options) . "\n);\n";
            $file_contents .= "?>";
            file_put_contents($path, $file_contents);
            echo "<div id='message' class='updated fade'><p><strong>" . __('Options saved.') . "</strong></p></div>";
        } else {
            echo "<div id='message' class='error'><p><strong>" . __('Errors encountered:') . "</strong>";
            foreach ($ers as $er) {
                echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$er}";
            }
            echo "</p></div>";
        }
    } else {
        $options = get_option('openinviter_settings');
        global $openinviter_options;
        foreach ($openinviter_options['settings'] as $key => $val) {
            if (!isset($options[$key])) {
                $options[$key] = $val['default'];
            }
        }
    }
    $transports = array('curl' => __('cURL'), 'wget' => __('WGET'));
    $local_debugs = array('off' => __('None'), 'on_error' => __('Errors only'), 'always' => __('Always'));
    $remote_debugs = array('off' => __('Off'), 'on' => __('On'));
    $contents = "<div class='wrap'><h2>" . __('OpenInviter Configuration') . "</h2>\n\t\t\t<div class='narrow'><form action='' method='POST' style='margin: auto; width: 600px;'><p>\n\t\t\t" . sprintf(__('<strong>Tip</strong>: You can get your API details (username and private key) from <a href="%1$s">OpenInviter.com</a>. If you don\'t have an OpenInviter.com account you can sign up at <a href="%2$s">OpenInviter.com</a>.'), 'http://openinviter.com/get_key.php', 'http://openinviter.com/register.php') . "</p>\n\t\t\t\t<table>\n\t\t\t\t<tr><td valign='top'><strong><label for='message_body_box'>" . __("Invite message body") . "</label></strong></td><td><textarea rows='5' cols='47' id='message_body_box' name='message_body_box'>{$options['message_body']}</textarea></td></tr>\n\t\t\t\t<tr><td valign='top'><strong><label for='message_subject_box'>" . __("Invite message subject") . "</label></strong></td><td><input type='text' id='message_subject_box' name='message_subject_box' value='{$options['message_subject']}' style='font-family: 'Courier New', Courier, mono; font-size: 1.5em;' size='50' /></td></tr>\n\t\t\t\t<tr><td colspan='2' align='right'>The <strong>%s</strong> in the message subject will be replaced with the sender</td></tr>\n\t\t\t\t<tr><td colspan='2'>&nbsp;</td></tr>\n\t\t\t\t<tr><td><strong><label for='username_box'>" . __('OpenInviter.com Username') . "</label></strong></td><td><input id='username_box' name='username_box' type='text' value='{$options['username']}' style='font-family: 'Courier New', Courier, mono; font-size: 1.5em;' size='50' /></td></tr>\n\t\t\t\t<tr><td><strong><label for='private_key_box'>" . __('OpenInviter.com Private Key') . "</label></strong></td><td><input id='private_key_box' name='private_key_box' type='text' value='{$options['private_key']}' style='font-family: 'Courier New', Courier, mono; font-size: 1.5em;' size='50' /></td></tr>\n\t\t\t\t<tr><td><strong><label for='transport_box'>" . __("Transport") . "</label></strong></td><td><select id='transport_box' name='transport_box'><option value=''></option>";
    foreach ($transports as $value => $name) {
        $contents .= "<option value='{$value}'" . ($options['transport'] == $value ? ' selected' : '') . ">{$name}</option>";
    }
    $contents .= "</select></td></tr>\n\t\t\t\t<tr><td><strong><label for='cookie_path_box'>" . __("Cookie path") . "</label></strong></td><td><input type='text' id='cookie_path_box' name='cookie_path_box' value='{$options['cookie_path']}' style='font-family: 'Courier New', Courier, mono; font-size: 1.5em;' size='50' /></td></tr>\n\t\t\t\t<tr><td><strong><label for='local_debug_box'>" . __('Local debugger') . "</label></strong></td><td><select id='local_debug_box' name='local_debug_box'><option value=''></option>";
    if ($options['local_debug'] === false) {
        $options['local_debug'] = 'off';
    }
    if ($options['remote_debug'] === false) {
        $options['remote_debug'] = 'off';
    } else {
        $options['remote_debug'] = 'on';
    }
//.........这里部分代码省略.........
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:101,代码来源:openinviter.php

示例8: header

             header('Location: index.php?action=backupjobs');
         } else {
             echo 'Unable to delete file';
         }
     } else {
         echo 'File does not exist';
     }
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'backuprestore') {
     checkacl('restoreb');
     include $config['path'] . '/includes/backuprestore.php';
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'logout') {
     session_unset();
     session_destroy();
     logevent('User ' . $_SESSION['user'] . ' logged out', 'activity');
     header('Location: index.php');
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'runbackup' && isset($_REQUEST['id']) && is_md5($_REQUEST['id'])) {
     checkacl('backnow');
     logevent('User ' . $_SESSION['user'] . ' ran backup job manually', 'activity');
     //making sure backup job is not terminated
     ignore_user_abort(true);
     set_time_limit(0);
     echo 'Backup task has been started, please do not close this window <pre>';
     echo shell_exec(escapeshellcmd('php ' . $config['path'] . '/cron.php ' . $_REQUEST['id']));
     echo '</pre>';
 } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'activitylogs') {
     checkacl('alog');
     $smarty->display($config['path'] . '/templates/header.tpl');
     echo '<h4>Activity Logs</h4>';
     $activitylogs = json_decode(file_get_contents($config['path'] . '/db/db-activitylog.json'), true);
     $activitylogs = array_reverse($activitylogs);
     echo '<table class="table table-bordered table-striped">';
开发者ID:xiaokangrj,项目名称:cdp,代码行数:31,代码来源:index.php

示例9: lang

     $chat_id = $chatid;
     $head_name = lang($L['chat_with'], array($user['username']));
     $head_title = $head_name . $DT['seo_delimiter'] . $head_title;
     $forward = is_url($forward) ? addslashes(dhtmlspecialchars($forward)) : '';
     if (strpos($forward, $MOD['linkurl']) !== false) {
         $forward = '';
     }
     $chat = $db->get_one("SELECT * FROM {$table} WHERE chatid='{$chatid}'");
     if ($chat) {
         $db->query("UPDATE {$table} SET forward='{$forward}' WHERE chatid='{$chatid}'");
     } else {
         $db->query("INSERT INTO {$table} (chatid,fromuser,touser,tgettime,forward) VALUES ('{$chat_id}','{$_username}','{$touser}','0','{$forward}')");
     }
     $type = 1;
 } else {
     if (isset($chatid) && is_md5($chatid)) {
         $chat = $db->get_one("SELECT * FROM {$table} WHERE chatid='{$chatid}'");
         if ($chat && ($chat['touser'] == $_username || $chat['fromuser'] == $_username)) {
             if ($chat['touser'] == $_username) {
                 $user = userinfo($chat['fromuser']);
             } else {
                 if ($chat['fromuser'] == $_username) {
                     $user = userinfo($chat['touser']);
                 }
             }
             $online = online($user['userid']);
             $chat_id = $chatid;
             $head_name = lang($L['chat_with'], array($user['username']));
             $head_title = $head_name . $DT['seo_delimiter'] . $head_title;
         } else {
             dheader('?action=index');
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:chat.php

示例10: gettext

    echo "                </tr>\n";
}
echo "                <tr>\n";
echo "                  <td align=\"left\" colspan=\"5\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
echo "    </tr>\n";
echo "    <tr>\n";
echo "      <td align=\"left\">&nbsp;</td>\n";
echo "    </tr>\n";
if ($uid == session::get_value('UID')) {
    if (!is_md5($aid)) {
        $aid = md5(uniqid(mt_rand()));
    }
    if ($popup == 1) {
        echo "    <tr>\n";
        echo "      <td align=\"center\">";
        echo "        <a href=\"attachments.php?webtag={$webtag}&amp;aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
        echo "        &nbsp;", form_submit('delete', gettext("Delete")), "&nbsp;", form_submit('close', gettext("Close"));
        echo "      </td>\n";
        echo "    </tr>\n";
    } else {
        echo "    <tr>\n";
        echo "      <td align=\"center\">";
        echo "        <a href=\"attachments.php?webtag={$webtag}&amp;aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
        echo "        &nbsp;", form_submit('delete', gettext("Delete"));
        echo "      </td>\n";
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:31,代码来源:edit_attachments.php

示例11: message

             if ($r) {
                 $username = $r['username'];
             }
         }
     } else {
         message($L['login_msg_not_member']);
     }
 }
 if ($MOD['passport'] == 'uc') {
     include DT_ROOT . '/api/' . $MOD['passport'] . '.inc.php';
 }
 $user = $do->login($username, $password, $cookietime);
 if ($user) {
     if ($MOD['passport'] && $MOD['passport'] != 'uc') {
         $api_url = '';
         $user['password'] = is_md5($password) ? $password : md5($password);
         //Once MD5
         if (strtoupper($MOD['passport_charset']) != DT_CHARSET) {
             $user = convert($user, DT_CHARSET, $MOD['passport_charset']);
         }
         extract($user);
         include DT_ROOT . '/api/' . $MOD['passport'] . '.inc.php';
         if ($api_url) {
             $forward = $api_url;
         }
     }
     #if($MOD['sso']) include DT_ROOT.'/api/sso.inc.php';
     if ($DT['login_log'] == 2) {
         $do->login_log($username, $password, $user['passsalt'], 0);
     }
     if ($api_msg) {
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:login.inc.php

示例12: user_get_profile

function user_get_profile($uid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    $peer_uid = session::get_value('UID');
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $user_groups_array = array();
    $user_prefs = user_get_prefs($uid);
    $session_gc_maxlifetime = ini_get('session.gc_maxlifetime');
    $session_cutoff_datetime = date(MYSQL_DATETIME, time() - $session_gc_maxlifetime);
    $sql = "SELECT USER.UID, USER.LOGON, USER.NICKNAME, USER_PEER.PEER_NICKNAME, ";
    $sql .= "UNIX_TIMESTAMP(USER_FORUM.LAST_VISIT) AS LAST_VISIT, ";
    $sql .= "UNIX_TIMESTAMP(USER.REGISTERED) AS REGISTERED, ";
    $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_BEST) AS USER_TIME_BEST, ";
    $sql .= "UNIX_TIMESTAMP(USER_TRACK.USER_TIME_TOTAL) AS USER_TIME_TOTAL, ";
    $sql .= "USER_PEER.RELATIONSHIP, SESSIONS.ID FROM USER USER ";
    $sql .= "LEFT JOIN USER_PREFS USER_PREFS_GLOBAL ON (USER_PREFS_GLOBAL.UID = USER.UID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PREFS` USER_PREFS_FORUM ";
    $sql .= "ON (USER_PREFS_FORUM.UID = USER.UID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ";
    $sql .= "ON (USER_PEER.PEER_UID = USER.UID AND USER_PEER.UID = '{$peer_uid}') ";
    $sql .= "LEFT JOIN USER_FORUM USER_FORUM ON (USER_FORUM.UID = USER.UID ";
    $sql .= "AND USER_FORUM.FID = '{$forum_fid}') ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_TRACK` USER_TRACK ";
    $sql .= "ON (USER_TRACK.UID = USER.UID) ";
    $sql .= "LEFT JOIN SESSIONS ON (SESSIONS.UID = USER.UID ";
    $sql .= "AND SESSIONS.TIME >= CAST('{$session_cutoff_datetime}' AS DATETIME)) ";
    $sql .= "WHERE USER.UID = '{$uid}' ";
    $sql .= "GROUP BY USER.UID";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    $user_profile = $result->fetch_assoc();
    if (isset($user_prefs['ANON_LOGON']) && $user_prefs['ANON_LOGON'] > USER_ANON_DISABLED) {
        $anon_logon = $user_prefs['ANON_LOGON'];
    } else {
        $anon_logon = USER_ANON_DISABLED;
    }
    if ($anon_logon == USER_ANON_DISABLED && isset($user_profile['LAST_VISIT']) && $user_profile['LAST_VISIT'] > 0) {
        $user_profile['LAST_LOGON'] = format_time($user_profile['LAST_VISIT']);
    } else {
        $user_profile['LAST_LOGON'] = gettext("Unknown");
    }
    if (isset($user_profile['REGISTERED']) && $user_profile['REGISTERED'] > 0) {
        $user_profile['REGISTERED'] = format_date($user_profile['REGISTERED']);
    } else {
        $user_profile['REGISTERED'] = gettext("Unknown");
    }
    if (isset($user_profile['USER_TIME_BEST']) && $user_profile['USER_TIME_BEST'] > 0) {
        $user_profile['USER_TIME_BEST'] = format_time_display($user_profile['USER_TIME_BEST']);
    } else {
        $user_profile['USER_TIME_BEST'] = gettext("Unknown");
    }
    if (isset($user_profile['USER_TIME_TOTAL']) && $user_profile['USER_TIME_TOTAL'] > 0) {
        $user_profile['USER_TIME_TOTAL'] = format_time_display($user_profile['USER_TIME_TOTAL']);
    } else {
        $user_profile['USER_TIME_TOTAL'] = gettext("Unknown");
    }
    if (isset($user_prefs['DOB_DISPLAY']) && !empty($user_prefs['DOB']) && $user_prefs['DOB'] != "0000-00-00") {
        if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_BOTH) {
            $user_profile['DOB'] = format_birthday($user_prefs['DOB']);
            $user_profile['AGE'] = format_age($user_prefs['DOB']);
        } else {
            if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_DATE) {
                $user_profile['DOB'] = format_birthday($user_prefs['DOB']);
            } else {
                if ($user_prefs['DOB_DISPLAY'] == USER_DOB_DISPLAY_AGE) {
                    $user_profile['AGE'] = format_age($user_prefs['DOB']);
                }
            }
        }
    }
    if (isset($user_prefs['PIC_URL']) && strlen($user_prefs['PIC_URL']) > 0) {
        $user_profile['PIC_URL'] = $user_prefs['PIC_URL'];
    }
    if (isset($user_prefs['PIC_AID']) && is_md5($user_prefs['PIC_AID'])) {
        $user_profile['PIC_AID'] = $user_prefs['PIC_AID'];
    }
    if (isset($user_prefs['AVATAR_URL']) && strlen($user_prefs['AVATAR_URL']) > 0) {
        $user_profile['AVATAR_URL'] = $user_prefs['AVATAR_URL'];
    }
    if (isset($user_prefs['AVATAR_AID']) && is_md5($user_prefs['AVATAR_AID'])) {
        $user_profile['AVATAR_AID'] = $user_prefs['AVATAR_AID'];
    }
    if (isset($user_prefs['HOMEPAGE_URL']) && strlen($user_prefs['HOMEPAGE_URL']) > 0) {
        $user_profile['HOMEPAGE_URL'] = $user_prefs['HOMEPAGE_URL'];
    }
    if (!isset($user_profile['RELATIONSHIP'])) {
//.........这里部分代码省略.........
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:101,代码来源:user_profile.inc.php

示例13: restore_password_confirmation

 /**
  * Confirmation of password restoring process
  *
  * @param string		$key
  *
  * @return array|bool			array('id' => <i>id</i>, 'password' => <i>password</i>) or <b>false</b> on failure
  */
 function restore_password_confirmation($key)
 {
     if (!is_md5($key)) {
         return false;
     }
     $id = $this->db_prime()->qfs(["SELECT `id`\n\t\t\tFROM `[prefix]users`\n\t\t\tWHERE\n\t\t\t\t`reg_key`\t= '%s' AND\n\t\t\t\t`status`\t= '%s'\n\t\t\tLIMIT 1", $key, self::STATUS_ACTIVE]);
     if (!$id) {
         return false;
     }
     $data = $this->get('data', $id);
     if (!isset($data['restore_until'])) {
         return false;
     } elseif ($data['restore_until'] < TIME) {
         unset($data['restore_until']);
         $this->set('data', $data, $id);
         return false;
     }
     unset($data['restore_until']);
     $Config = Config::instance();
     $password = password_generate($Config->core['password_min_length'], $Config->core['password_min_strength']);
     $this->set(['password_hash' => hash('sha512', hash('sha512', $password) . Core::instance()->public_key), 'data' => $data], null, $id);
     $this->add_session($id);
     return ['id' => $id, 'password' => $password];
 }
开发者ID:hypnomez,项目名称:opir.org,代码行数:31,代码来源:User.php

示例14: login_log

 function login_log($username, $password, $admin = 0, $message = '')
 {
     global $DT_PRE, $DT_TIME, $DT_IP, $L;
     $password = is_md5($password) ? md5($password) : md5(md5($password));
     $agent = addslashes(htmlspecialchars(strip_sql($_SERVER['HTTP_USER_AGENT'])));
     $message or $message = $L['member_login_ok'];
     if ($message == $L['member_login_ok']) {
         cache_delete($DT_IP . '.php', 'ban');
     }
     $this->db->query("INSERT INTO {$DT_PRE}login (username,password,admin,loginip,logintime,message,agent) VALUES ('{$username}','{$password}','{$admin}','{$DT_IP}','{$DT_TIME}','{$message}','{$agent}')");
 }
开发者ID:hcd2008,项目名称:destoon,代码行数:11,代码来源:member.class.php

示例15: attachments_make_link

function attachments_make_link($attachment, $show_thumbs = true, $limit_filename = false, $local_path = false, $img_tag = true)
{
    if (!is_array($attachment)) {
        return false;
    }
    if (!is_bool($show_thumbs)) {
        $show_thumbs = true;
    }
    if (!is_bool($limit_filename)) {
        $limit_filename = false;
    }
    if (!is_bool($local_path)) {
        $local_path = false;
    }
    if (!is_bool($img_tag)) {
        $img_tag = true;
    }
    if (!($attachment_dir = forum_get_setting('attachment_dir'))) {
        return false;
    }
    if (!isset($attachment['aid'])) {
        return false;
    }
    if (!isset($attachment['hash'])) {
        return false;
    }
    if (!isset($attachment['filename'])) {
        return false;
    }
    if (!isset($attachment['downloads'])) {
        return false;
    }
    if (!is_md5($attachment['aid'])) {
        return false;
    }
    if (!is_md5($attachment['hash'])) {
        return false;
    }
    $webtag = get_webtag();
    if (forum_get_setting('attachment_thumbnails', 'Y') && (($user_show_thumbs = session::get_value('SHOW_THUMBS')) > 0 || !session::logged_in())) {
        $thumbnail_size = array(1 => 50, 2 => 100, 3 => 150);
        $thumbnail_max_size = isset($thumbnail_size[$user_show_thumbs]) ? $thumbnail_size[$user_show_thumbs] : 100;
    } else {
        $thumbnail_max_size = 100;
        $show_thumbs = false;
    }
    if ($local_path) {
        $attachment_href = "attachments/{$attachment['filename']}";
    } else {
        $attachment_href = "get_attachment.php?webtag={$webtag}&amp;hash={$attachment['hash']}";
        $attachment_href .= "&amp;filename={$attachment['filename']}";
    }
    if ($img_tag === true) {
        $title_array = array();
        if (mb_strlen($attachment['filename']) > 16 && $limit_filename) {
            $title_array[] = gettext("Filename") . ": {$attachment['filename']}";
            $attachment['filename'] = mb_substr($attachment['filename'], 0, 16);
            $attachment['filename'] .= "&hellip;";
        }
        if (isset($attachment['filesize']) && is_numeric($attachment['filesize'])) {
            $title_array[] = gettext("Size") . ": " . format_file_size($attachment['filesize']);
        }
        if ($attachment['downloads'] == 1) {
            $title_array[] = gettext("Downloaded: 1 time");
        } else {
            $title_array[] = sprintf(gettext("Downloaded: %d times"), $attachment['downloads']);
        }
        if (@file_exists("{$attachment_dir}/{$attachment['hash']}.thumb") && $show_thumbs) {
            if (@($image_info = getimagesize("{$attachment_dir}/{$attachment['hash']}"))) {
                $title_array[] = gettext("Dimensions") . ": {$image_info[0]}x{$image_info[1]}px";
                $thumbnail_width = $image_info[0];
                $thumbnail_height = $image_info[1];
                while ($thumbnail_width > $thumbnail_max_size || $thumbnail_height > $thumbnail_max_size) {
                    $thumbnail_width--;
                    $thumbnail_height = floor($thumbnail_width * ($image_info[1] / $image_info[0]));
                }
                $title = implode(", ", $title_array);
                $attachment_link = "<span class=\"attachment_thumb\"><a href=\"{$attachment_href}\" title=\"{$title}\" ";
                $attachment_link .= "target=\"_blank\"><img src=\"{$attachment_href}&amp;thumb=1\"";
                $attachment_link .= "border=\"0\" width=\"{$thumbnail_width}\" height=\"{$thumbnail_height}\"";
                $attachment_link .= "alt=\"{$title}\" title=\"{$title}\" /></a></span>";
                return $attachment_link;
            }
        }
        $title = implode(", ", $title_array);
        $attachment_link = "<img src=\"";
        $attachment_link .= html_style_image('attach.png');
        $attachment_link .= "\" width=\"14\" height=\"14\" border=\"0\" ";
        $attachment_link .= "alt=\"" . gettext("Attachment") . "\" ";
        $attachment_link .= "title=\"" . gettext("Attachment") . "\" />";
        $attachment_link .= "<a href=\"{$attachment_href}\" title=\"{$title}\" ";
        $attachment_link .= "target=\"_blank\">{$attachment['filename']}</a>\n";
        return $attachment_link;
    }
    return $attachment_href;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:96,代码来源:attachments.inc.php


注:本文中的is_md5函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。