function 重新转化排班里面USER_NAME为USER_ID()
{
    global $db;
    $sql = "select 编号,排班人员 from edu_xingzheng_paiban";
    $rs = $db->Execute($sql);
    $rs_a = $rs->GetArray();
    for ($i = 0; $i < sizeof($rs_a); $i++) {
        $编号 = $rs_a[$i]['编号'];
        $排班人员 = $rs_a[$i]['排班人员'];
        $USER_NAME = returntablefield('user', "USER_ID", $排班人员, "USER_NAME");
        if ($USER_NAME == "") {
            $排班人员结果 = usernametoid($排班人员);
            $sql = "update edu_xingzheng_paiban set 排班人员='{$排班人员结果}' where 编号='{$编号}'";
            $db->Execute($sql);
            //print $sql."<BR>";
        }
    }
    //exit;
}
Example #2
0
function userdetect($string)
{
    if (preg_match_all('/(^|\\s)(@\\w+)/', $string, $zavinace) > 0) {
        foreach ($zavinace[2] as $name) {
            if (preg_match('/@\\d*/', $name)) {
                $namefix = str_replace("@", "", $name);
                $validus = dbcount("(user_id)", "bg_users", "user_nick='" . htmlspecialchars($namefix) . "'");
                if ($validus >= 1) {
                    $string = str_replace($name, "<a class='profillink' data-target='" . usernametoid($namefix) . "' style='color:#e74c3c'>@" . $namefix . "</a>", $string);
                } else {
                    $string = str_replace($name, '<span style="color:#e74c3c">@' . $namefix . '</span>', $string);
                }
            }
        }
    }
    return $string;
}