Beispiel #1
0
function ban()
{
    $lastime = $_SESSION['lastime'];
    $nowtime = nowtime();
    $_SESSION['lastime'] = nowtime();
    if ($nowtime - $lastime <= 0.3) {
        return true;
    } else {
        return false;
    }
}
Beispiel #2
0
function robots_log($post_ID)
{
    $bd_submit_log_enabled = get_option('bd_submit_log_enabled');
    if (!$bd_submit_log_enabled) {
        return;
    }
    $searchbot = get_naps_bot();
    if ($searchbot) {
        $tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
        $url = $_SERVER['HTTP_REFERER'];
        $submit_file = dirname(__FILE__) . '/submit_log.txt';
        $robots_file = dirname(__FILE__) . '/robots_log.txt';
        $time = nowtime();
        $PR = home_url() . $_SERVER['REQUEST_URI'];
        if (date('Y-m-d', filemtime($robots_file)) != date('Y-m-d')) {
            file_put_contents($submit_file, '');
            $handle = fopen($robots_file, "w");
        } else {
            $handle = fopen($robots_file, "a");
        }
        fwrite($handle, "{$time}|{$searchbot}|{$PR}||");
        fclose($handle);
    }
}
Beispiel #3
0
 public static function writeSearchBot()
 {
     $date = date("Y-m-d.G:i:s");
     $searchbot = self::getNapsBot();
     if ($searchbot) {
         $tlc_thispage = addslashes($_SERVER['HTTP_USER_AGENT']);
         $url = $_SERVER['HTTP_REFERER'];
         $file = Yii::app()->request->hostInfo . ".txt";
         $time = nowtime();
         $data = fopen($file, "a");
         fwrite($data, "Time:{$time} robot:{$searchbot} URL:{$tlc_thispage}\n");
         fclose($data);
     }
 }
function verify_event_dates($post_data)
{
    $ret_array = array();
    $_CI =& get_instance();
    if (empty($post_data['event_date']) || empty($post_data['time_start']) || empty($post_data['ts_ampm']) || empty($post_data['time_end']) || empty($post_data['te_ampm'])) {
        return array('status' => FALSE, 'message' => 'This event must have at least one date/time');
    }
    //something wasn't submitted
    $ref_size = sizeof($post_data['event_date']);
    if (sizeof($post_data['time_start']) != $ref_size || sizeof($post_data['ts_ampm']) != $ref_size || sizeof($post_data['time_end']) != $ref_size || sizeof($post_data['te_ampm']) != $ref_size) {
        return array('status' => FALSE, 'message' => 'All five fields must be filled in for each date/time');
    }
    foreach ($post_data['event_date'] as $date) {
        $newtime = strtotime(add_business_days(nowtime(), 5));
        $target = strtotime($date);
        //admins can submit within 5 days
        if ($newtime > $target && !$_CI->authorization->has_permission(permGroups::$ALL_STAFF)) {
            return array('status' => FALSE, 'message' => 'Cannot submit within five business days of the event');
        }
    }
    return array('status' => TRUE, 'message' => '');
}
Beispiel #5
0
 if ($oicq == "") {
     $oicq = "未知";
 }
 if ($home == "") {
     $home = "未知";
 }
 if ($mail == "") {
     $mail = "未知";
 }
 $data = fopen("{$admin['path']}/{$user}.dat", "r");
 $num = Chop(fgets($data, 15));
 $num++;
 $old = fread($data, filesize($file));
 fclose($data);
 $id = getid();
 $time = nowtime();
 $ip = $REMOTE_ADDR;
 $ip2 = explode(".", $ip);
 $ip = "{$ip2['0']}.{$ip2['1']}.{$ip2['2']}.{$ip2['3']}";
 $writemsg = "{$num}\n{$id}|!:!|{$msg}|!:!|{$name}|!:!|{$sex}|!:!|{$email}|!:!|{$home}|!:!|{$oicq}|!:!|{$ip}|!:!|{$time}\n{$old}";
 $data = fopen($file, "w");
 fwrite($data, $writemsg);
 fclose($data);
 $cookietime = time() + 31536000;
 setcookie(ex_user_home, $home, $cookietime);
 setcookie(ex_user_mail, $email, $cookietime);
 setcookie(ex_user_name, $name, $cookietime);
 setcookie(ex_user_oicq, $oicq, $cookietime);
 echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
 echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
 echo "<META content=\"text/html; charset=gb2312\" http-equiv=Content-Type>";