⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.php

📁 讲的是网络编程
💻 PHP
📖 第 1 页 / 共 2 页
字号:
            break;
        case XOOPS_MATCH_EQUAL:
            $criteria->add(new Criteria('user_aim', $myts->addSlashes(trim($_POST['user_aim']))));
            break;
        case XOOPS_MATCH_CONTAIN:
            $criteria->add(new Criteria('user_aim', '%'.$myts->addSlashes(trim($_POST['user_aim'])).'%', 'LIKE'));
            break;
        }
    }
    if ( !empty($_POST['user_yim']) ) {
        $match = (!empty($_POST['user_yim_match'])) ? intval($_POST['user_yim_match']) : XOOPS_MATCH_START;
        switch ($match) {
        case XOOPS_MATCH_START:
            $criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($_POST['user_yim'])).'%', 'LIKE'));
            break;
        case XOOPS_MATCH_END:
            $criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($_POST['user_yim'])), 'LIKE'));
            break;
        case XOOPS_MATCH_EQUAL:
            $criteria->add(new Criteria('user_yim', $myts->addSlashes(trim($_POST['user_yim']))));
            break;
        case XOOPS_MATCH_CONTAIN:
            $criteria->add(new Criteria('user_yim', '%'.$myts->addSlashes(trim($_POST['user_yim'])).'%', 'LIKE'));
            break;
        }
    }
    if ( !empty($_POST['user_msnm']) ) {
        $match = (!empty($_POST['user_msnm_match'])) ? intval($_POST['user_msnm_match']) : XOOPS_MATCH_START;
        switch ($match) {
        case XOOPS_MATCH_START:
            $criteria->add(new Criteria('user_msnm', $myts->addSlashes(trim($_POST['user_msnm'])).'%', 'LIKE'));
            break;
        case XOOPS_MATCH_END:
            $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm'])), 'LIKE'));
            break;
        case XOOPS_MATCH_EQUAL:
            $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm']))));
            break;
        case XOOPS_MATCH_CONTAIN:
            $criteria->add(new Criteria('user_msnm', '%'.$myts->addSlashes(trim($_POST['user_msnm'])).'%', 'LIKE'));
            break;
        }
    }
    if ( !empty($_POST['user_from']) ) {
        $criteria->add(new Criteria('user_from', '%'.$myts->addSlashes(trim($_POST['user_from'])).'%', 'LIKE'));
    }
    if ( !empty($_POST['user_intrest']) ) {
        $criteria->add(new Criteria('user_intrest', '%'.$myts->addSlashes(trim($_POST['user_intrest'])).'%', 'LIKE'));
    }
    if ( !empty($_POST['user_occ']) ) {
        $criteria->add(new Criteria('user_occ', '%'.$myts->addSlashes(trim($_POST['user_occ'])).'%', 'LIKE'));
    }

    if ( !empty($_POST['user_lastlog_more']) && is_numeric($_POST['user_lastlog_more']) ) {
        $f_user_lastlog_more = intval(trim($_POST['user_lastlog_more']));
        $time = time() - (60 * 60 * 24 * $f_user_lastlog_more);
        if ( $time > 0 ) {
            $criteria->add(new Criteria('last_login', $time, '<'));
        }
    }
    if ( !empty($_POST['user_lastlog_less']) && is_numeric($_POST['user_lastlog_less']) ) {
        $f_user_lastlog_less = intval(trim($_POST['user_lastlog_less']));
        $time = time() - (60 * 60 * 24 * $f_user_lastlog_less);
        if ( $time > 0 ) {
            $criteria->add(new Criteria('last_login', $time, '>'));
        }
    }
    if ( !empty($_POST['user_reg_more']) && is_numeric($_POST['user_reg_more']) ) {
        $f_user_reg_more = intval(trim($_POST['user_reg_more']));
        $time = time() - (60 * 60 * 24 * $f_user_reg_more);
        if ( $time > 0 ) {
            $criteria->add(new Criteria('user_regdate', $time, '<'));
        }
    }
    if ( !empty($_POST['user_reg_less']) && is_numeric($_POST['user_reg_less']) ) {
        $f_user_reg_less = intval($_POST['user_reg_less']);
        $time = time() - (60 * 60 * 24 * $f_user_reg_less);
        if ( $time > 0 ) {
            $criteria->add(new Criteria('user_regdate', $time, '>'));
        }
    }
    if ( !empty($_POST['user_posts_more']) && is_numeric($_POST['user_posts_more']) ) {
        $criteria->add(new Criteria('posts', intval($_POST['user_posts_more']), '>'));
    }
    if ( !empty($_POST['user_posts_less']) && is_numeric($_POST['user_posts_less']) ) {
        $criteria->add(new Criteria('posts', intval($_POST['user_posts_less']), '<'));
    }
    if ( isset($_POST['user_mailok']) ) {
        if ( $_POST['user_mailok'] == "mailng" ) {
            $criteria->add(new Criteria('user_mailok', 0));
        } elseif ( $_POST['user_mailok'] == "mailok" ) {
            $criteria->add(new Criteria('user_mailok', 1));
        } else {
            $criteria->add(new Criteria('user_mailok', 0, '>='));
        }
    }
    if ( isset($_POST['user_type']) ) {
        if ( $_POST['user_type'] == "inactv" ) {
            $criteria->add(new Criteria('level', 0, '='));
        } elseif ( $_POST['user_type'] == "actv" ) {
            $criteria->add(new Criteria('level', 0, '>'));
        } else {
            $criteria->add(new Criteria('level', 0, '>='));
        }
    }
	$groups = empty($_POST['selgroups']) ? array() : array_map("intval", $_POST['selgroups']);
    $validsort = array("uname", "email", "last_login", "user_regdate", "posts");
    $sort = (!in_array($_POST['user_sort'], $validsort)) ? "uname" : $_POST['user_sort'];
    $order = "ASC";
    if ( isset($_POST['user_order']) && $_POST['user_order'] == "DESC") {
        $order = "DESC";
    }
    $limit = (!empty($_POST['limit'])) ? intval($_POST['limit']) : 50;
    if ( $limit == 0 || $limit > 50 ) {
        $limit = 50;
    }
    $start = (!empty($_POST['start'])) ? intval($_POST['start']) : 0;
    $member_handler =& xoops_gethandler('member');
    $total = $member_handler->getUserCountByGroupLink($groups, $criteria);
    echo "<a href='admin.php?fct=findusers&amp;op=form'>". _AM_FINDUS ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;". _AM_RESULTS."<br /><br />";
    if ( $total == 0 ) {
        echo "<h4>"._AM_NOFOUND,"</h4>";
    } elseif ( $start < $total ) {
        echo sprintf(_AM_USERSFOUND, $total)."<br />";
        echo "<form action='admin.php' method='post' name='memberslist' id='memberslist'><input type='hidden' name='op' value='delete_many' />
        <table width='100%' border='0' cellspacing='1' cellpadding='4' class='outer'><tr><th align='center'><input type='checkbox' name='memberslist_checkall' id='memberslist_checkall' onclick='xoopsCheckAll(\"memberslist\", \"memberslist_checkall\");' /></th><th align='center'>"._AM_AVATAR."</th><th align='center'>"._AM_UNAME."</th><th align='center'>"._AM_REALNAME."</th><th align='center'>"._AM_EMAIL."</th><th align='center'>"._AM_PM."</th><th align='center'>"._AM_URL."</th><th align='center'>"._AM_REGDATE."</th><th align='center'>"._AM_LASTLOGIN."</th><th align='center'>"._AM_POSTS."</th><th align='center'>&nbsp;</th></tr>";
        $criteria->setSort($sort);
        $criteria->setOrder($order);
        $criteria->setLimit($limit);
        $criteria->setStart($start);
        $foundusers =& $member_handler->getUsersByGroupLink($groups, $criteria, true);
        $ucount = 0;
        foreach (array_keys($foundusers) as $j) {
            if ($ucount % 2 == 0) {
                $class = 'even';
            } else {
                $class = 'odd';
            }
            $ucount++;
            $fuser_avatar = $foundusers[$j]->getVar("user_avatar") ? "<img src='".XOOPS_UPLOAD_URL."/".$foundusers[$j]->getVar("user_avatar")."' alt='' />" : "&nbsp;";
            $fuser_name = $foundusers[$j]->getVar("name") ? $foundusers[$j]->getVar("name") : "&nbsp;";
            echo "<tr class='$class'><td align='center'><input type='checkbox' name='memberslist_id[]' id='memberslist_id[]' value='".$foundusers[$j]->getVar("uid")."' /><input type='hidden' name='memberslist_uname[".$foundusers[$j]->getVar("uid")."]' id='memberslist_uname[]' value='".$foundusers[$j]->getVar("uname")."' /></td>";
            echo "<td>$fuser_avatar</td><td><a href='".XOOPS_URL."/userinfo.php?uid=".$foundusers[$j]->getVar("uid")."'>".$foundusers[$j]->getVar("uname")."</a></td><td>".$fuser_name."</td><td align='center'><a href='mailto:".$foundusers[$j]->getVar("email")."'><img src='".XOOPS_URL."/images/icons/email.gif' border='0' alt='";
            printf(_SENDEMAILTO,$foundusers[$j]->getVar("uname", "E"));
            echo "' /></a></td><td align='center'><a href='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send2=1&amp;to_userid=".$foundusers[$j]->getVar("uid")."\",\"pmlite\",450,370);'><img src='".XOOPS_URL."/images/icons/pm.gif' border='0' alt='";
            printf(_SENDPMTO,$foundusers[$j]->getVar("uname", "E"));
            echo "' /></a></td><td align='center'>";
            if ( $foundusers[$j]->getVar("url","E") != "" ) {
                echo "<a href='".$foundusers[$j]->getVar("url","E")."' target='_blank'><img src='".XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' /></a>";
            } else {
                echo "&nbsp;";
            }
            echo "</td><td align='center'>".formatTimeStamp($foundusers[$j]->getVar("user_regdate"),"s")."</td><td align='center'>";
            if ( $foundusers[$j]->getVar("last_login") != 0 ) {
                echo formatTimeStamp($foundusers[$j]->getVar("last_login"),"m");
            } else {
                echo "&nbsp;";
            }
            echo "</td><td align='center'>".$foundusers[$j]->getVar("posts")."</td>";
            echo "<td align='center'><a href='".XOOPS_URL."/modules/system/admin.php?fct=users&amp;uid=".$foundusers[$j]->getVar("uid")."&amp;op=modifyUser'>"._EDIT."</a></td></tr>\n";
        }
        echo "<tr class='foot'><td><select name='fct'><option value='users'>"._DELETE."</option><option value='mailusers'>"._AM_SENDMAIL."</option>";
        $group = !empty($_POST['group']) ? intval($_POST['group']) : 0;
        if ( $group > 0 ) {
            $member_handler =& xoops_gethandler('member');
            $add2group =& $member_handler->getGroup($group);
            echo "<option value='groups' selected='selected'>".sprintf(_AM_ADD2GROUP, $add2group->getVar('name'))."</option>";
        }
        echo "</select>&nbsp;";
        if ( $group > 0 ) {
            echo "<input type='hidden' name='groupid' value='".$group."' />";
        }
        echo "</td><td colspan='10'>".$GLOBALS['xoopsSecurity']->getTokenHTML()."<input type='submit' value='"._SUBMIT."' /></td></tr></table></form>\n";
        $totalpages = ceil($total / $limit);
        if ( $totalpages > 1 ) {
            $hiddenform = "<form name='findnext' action='admin.php' method='post'>";
            $skip_vars = array('selgroups');
            foreach ( $_POST as $k => $v ) {
	            if ($k == 'selgroups') {
		            foreach( $_POST['selgroups'] as $_group){
		 				$hiddenform .= "<input type='hidden' name='selgroups[]' value='".$_group."' />\n";
		            }
	            } elseif ($k == 'XOOPS_TOKEN_REQUEST') {
                    // regenerate token value
                    $hiddenform .= $GLOBALS['xoopsSecurity']->getTokenHTML()."\n";
                } else {
                    $hiddenform .= "<input type='hidden' name='".$myts->htmlSpecialChars($k)."' value='".$myts->htmlSpecialChars($myts->stripSlashesGPC($v))."' />\n";
                }
            }
            if (!isset($_POST['limit'])) {
                $hiddenform .= "<input type='hidden' name='limit' value='".$limit."' />\n";
            }
            if (!isset($_POST['start'])) {
                $hiddenform .= "<input type='hidden' name='start' value='".$start."' />\n";
            }
            $prev = $start - $limit;
            if ( $start - $limit >= 0 ) {
                $hiddenform .= "<a href='#0' onclick='javascript:document.findnext.start.value=".$prev.";document.findnext.submit();'>"._AM_PREVIOUS."</a>&nbsp;\n";
            }
            $counter = 1;
            $currentpage = ($start+$limit) / $limit;
            while ( $counter <= $totalpages ) {
                if ( $counter == $currentpage ) {
                    $hiddenform .= "<b>".$counter."</b> ";
                } elseif ( ($counter > $currentpage-4 && $counter < $currentpage+4) || $counter == 1 || $counter == $totalpages ) {
                    if ( $counter == $totalpages && $currentpage < $totalpages-4 ) {
                        $hiddenform .= "... ";
                    }
                    $hiddenform .= "<a href='#".$counter."' onclick='javascript:document.findnext.start.value=".($counter-1)*$limit.";document.findnext.submit();'>".$counter."</a> ";
                    if ( $counter == 1 && $currentpage > 5 ) {
                        $hiddenform .= "... ";
                    }
                }
                $counter++;
            }
            $next = $start+$limit;
            if ( $total > $next ) {
                $hiddenform .= "&nbsp;<a href='#".$total."' onclick='javascript:document.findnext.start.value=".$next.";document.findnext.submit();'>"._AM_NEXT."</a>\n";
            }
            $hiddenform .= "</form>";
            echo "<div style='text-align:center'>".$hiddenform."<br />";
            printf(_AM_USERSFOUND, $total);
            echo "</div>";
        }
    }
}
else {
    redirect_header('admin.php?fct=findusers', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
}
//CloseTable();
xoops_cp_footer();
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -