Пример #1
0
 function block()
 {
     global $db;
     $sql = "select " . "* " . "from " . TABLE_ADDON_MODULES_ZEN_TWEET . " " . "order by date_added desc";
     $result = $db->execute($sql);
     $return = array();
     //経過時間をチェック
     $get_exec = check_time($result);
     //1時間経過してたら
     if ($get_exec) {
         //print "<br />GETします";
         //ツイートの取得
         $feeds = tweet_get_feeds("http://twitter.com/statuses/user_timeline/" . MODULE_ZEN_TWEET_ACCOUNT_ID . ".xml?count=" . MODULE_ZEN_TWEET_SHOWNUM);
         //テーブルの書き換え
         ins_table($feeds);
     }
     $return['tweet'] = get_zen_tweet();
     return $return;
 }
Пример #2
0
//首先判断是否是登入状态
if (isset($_COOKIE['username'])) {
    alert('您已经登入,请先退出');
}
//开始接收
if ($_GET['action'] == 'login') {
    if (!empty($global_clean['code'])) {
        //如果关闭了验证码验证
        if (!($_POST['code'] == $_SESSION['code'])) {
            location('验证码错误,请重新输入!', 'member_modify.php');
        }
    }
    //进行用户名和密码的验证
    $name = check_username($_POST['username']);
    $password = check_password($_POST['password']);
    $time = check_time($_POST['time']);
    //将接受到得用户名和密码和数据库进行配对
    $query = mysql_query("select username from user where username='******' and password='******'");
    if (is_array(mysql_fetch_array($query))) {
        if (is_array($array = mysql_fetch_array(mysql_query("select username,level from user where username='******' and password='******' and active=''")))) {
            //登入成功,开始写入cookie,调用setcookies函数
            _setcookies($_POST['username'], $time);
            //判断是否是管理员登入
            if ($array['level'] == 1) {
                //如果是管理员身份登入
                $_SESSION['admin'] = $array['username'];
            }
            //开始记录登入信息,包括登入地点,时间,次数
            mysql_query("update \r\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\tuser\r\n\t\t \t\t\t\t\t\t\t\t\t set \t\r\n\t\t \t\t\t\t\t\t\t\t\t \t\t\t\tlast_time=now(),\r\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\tlast_ip='{$_SERVER["REMOTE_ADDR"]}',\r\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\tlogin_count=login_count+1\r\n\t\t \t\t\t\t\t\t\t\t\twhere\r\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t\tusername='******'username']}'");
            location('登入成功', 'index.php');
        } else {
Пример #3
0
    } else {
        $event_duration2 = 'NULL';
    }
} else {
    $event_start_time2 = 'NULL';
    $event_duration2 = 'NULL';
}
if (strlen(trim($_POST["event_start_time3"])) != 0) {
    if (check_time($_POST["event_start_time3"]) == 0 && trim($_POST["event_start_time3"]) != "") {
        $errortext = $errortext . '<li>Incorrect Start Time (Second Session) Format</li>';
    } elseif (trim($_POST["event_start_time3"] != "")) {
        $event_start_time3 = substr($_POST["event_start_time3"], 0, 2) . substr($_POST["event_start_time3"], 3, 2) . '00';
    } else {
        $event_start_time3 = 'NULL';
    }
    if (check_time($_POST["event_duration3"]) == 0 && trim($_POST["event_duration3"]) != "") {
        $errortext = $errortext . '<li>Incorrect Event Duration (Second Session) Format</li>';
    } elseif (trim($_POST["event_duration3"] != "")) {
        $event_duration3 = substr($_POST["event_duration3"], 0, 2) . substr($_POST["event_duration3"], 3, 2) . '00';
    } else {
        $event_duration3 = 'NULL';
    }
} else {
    $event_start_time3 = 'NULL';
    $event_duration3 = 'NULL';
}
//end validation
/*$connection = mysql_connect ("localhost", "com_dbadmin", "0o9i8u7y" ) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("com_calendar", $connection);*/
//connect to db
include_once "includes/functions.inc";
Пример #4
0
//判断登录状态
login_state();
global $system;
//处理登录数据
if (@$_GET['action'] == 'login') {
    //为防止恶意注册,跨站攻击
    if ($system['code'] == 1) {
        check_code($_POST['code'], $_SESSION['code']);
    }
    //引入验证文件
    include ROOT_PATH . 'includes/login.func.php';
    //接收数据
    $clean = array();
    $clean['username'] = check_username($_POST['username'], 2, 20);
    $clean['password'] = check_password($_POST['password'], 6);
    $clean['time'] = check_time($_POST['time']);
    //数据库验证
    if (!!($rows = fetch_array("SELECT bbs_username,bbs_uniqid,bbs_level FROM bbs_users WHERE bbs_username='******'username']}' AND bbs_password='******'password']}' AND bbs_active='' LIMIT 1"))) {
        //登录成功后记录登录信息
        query("UPDATE bbs_users SET bbs_last_time=NOW(),bbs_last_ip='{$_SERVER["REMOTE_ADDR"]}',bbs_login_count=bbs_login_count+1 WHERE\n                        bbs_username='******'bbs_username']}'");
        //session_destroy();
        setcookies($rows['bbs_username'], $rows['bbs_uniqid'], $clean['time']);
        //管理员生成session
        if ($rows['bbs_level'] == 1) {
            $_SESSION['admin'] = $rows['bbs_username'];
        }
        close();
        location(null, 'userzone.php');
    } else {
        close();
        //session_destroy();
Пример #5
0
        $tc += 120000;
    }
    //echo $tc;
    $c_ipf = fopen("conf/cont.conf", "r");
    $cid = fread($c_ipf, 8);
    fclose($c_ipf);
    if (check_stat($cid) != 1) {
        return false;
    }
    if ($tc <= gettl()) {
        return true;
    } else {
        return false;
    }
}
if (!$corr && !check_time()) {
    header("Location: error.php?word=Out of submit time");
    return;
}
echo "<tr height='30px'>";
echo "<td width='200px'>Contest id</td>\n";
if ($corr) {
    echo "<td>" . $cid . "(Correction)</td></tr>\n";
} else {
    echo "<td>" . $cid . "</td></tr>\n";
}
?>

<?php 
echo "<tr height='30px'>";
echo "<td width='200px'>Submit time limit</td>\n";
Пример #6
0
 /**
  * Save edited match details
  */
 function valEditMatch()
 {
     global $db, $_pre;
     list($title, $duration, $start_date, $start_time, $difficulty, $match_points, $match_ranked, $analysis, $unused_1, $unused_2, $match_id, $action) = assoc_to_indexed($_POST);
     $match_id = base64_decode($match_id);
     settype($match_id, 'integer');
     //If action is delete, do and return
     if ($action == 'Delete this match?') {
         //Get match table name first
         $query = "SELECT match_table_name FROM {$_pre}matches WHERE id={$match_id}";
         $db->setQuery($query);
         $row = $db->fetch_assoc();
         $match_table_name = $row['match_table_name'];
         //Delete records from matches table
         $query = "DELETE FROM {$_pre}matches WHERE id={$match_id}";
         $db->setQuery($query);
         //Drop the match table
         $query = "DROP TABLE {$_pre}{$match_table_name}";
         $db->setQuery($query);
         //Remove logs with this match ID
         $query = "DELETE FROM {$_pre}user_match_log WHERE match_id={$match_id}";
         $db->setQuery($query);
         //Rename this match's table to have suffix ".old" so it can be deleted later with a script or manually
         rename("competition_uploads" . DS . $match_table_name, "competition_uploads" . DS . $match_table_name . ".old");
         system_messages(1, "Match number {$match_id} successfully deleted");
         return;
     }
     $errmsg = "";
     //Validate match name
     if (strlen($title) < 2) {
         $errmsg .= "Match name too short";
     }
     //Validate duration
     settype($duration, 'integer');
     if ($duration < 600) {
         $errmsg .= ", Duration invalid";
     }
     //Validate start date
     if (!check_date($start_date)) {
         $errmsg .= ", Invalid date";
     }
     //Validate start time
     if (!check_time($start_time)) {
         $errmsg .= ", Invalid time";
     }
     //Join start date and start time
     $full_date = $start_date . " " . $start_time;
     //Validate match difficulty : scale of 0-100, but min is 10
     settype($difficulty, 'integer');
     if ($difficulty < 10 || $difficulty > 100) {
         $errmsg .= ", Difficulty invalid";
     }
     //Validate match points
     settype($match_points, 'integer');
     if ($match_points < 100 || $match_points > 999) {
         $errmsg .= ", Match points invalid";
     }
     //Validate match ranked
     $match_ranked = $match_ranked != '0' && $match_ranked != '1' ? '0' : $match_ranked;
     //Validate match analysis
     $analysis_text = strip_tags($analysis, "<p><a><strong><i><br><div><pre>");
     //Strip HTML tags
     if (strlen($errmsg) > 0) {
         system_messages(0, $errmsg, 'true');
         return;
     }
     //Update match details
     $query = "UPDATE {$_pre}matches SET title='{$title}',duration={$duration},start_time=" . make_time($full_date) . ",difficulty={$difficulty},match_points={$match_points},match_ranked={$match_ranked},analysis='{$analysis}' WHERE id={$match_id}";
     $db->setQuery($query);
     //We also need to update user_match_log table match_date column to the new changes
     $query = "UPDATE {$_pre}user_match_log SET match_date=" . make_time($full_date) . " WHERE match_id={$match_id}";
     $db->setQuery($query);
     //Echo success message
     system_messages(1, 'Match details saved');
 }