dsdt66064367 2010-04-24 00:50
浏览 15

简单的PHP声明,我无法让它工作!

How to get $schedule = true` and $schedule2 = true to work?

I know this is easy and I'm overlooking something simple!

Here is the full code:

I basically want schedule and schedule2 to work (it looks at a PHP date and tells it when to expire on our news site!)

$where = array();
$where = run_filters('also-allow', $where);

if ($allow_full_story or $allow_add_comment) {
    $post = 'full';

    if ($title){
        $where[] = "url = $title";
    } elseif ($time){
        $where[] = "date = $time";
    } elseif ($id){
        $where[] = "id = $id";
    }
} else {
    $post = 'short';

    if (!$is_logged_in or $is_logged_in and $member['level'] == 4) {
        $where[] = 'hidden = 0';
        $where[] = 'and';
    }

    if ($user or $author) {
        $where[] = 'author = '.($author ? $author : $user);
        $where[] = 'and';
    }

    if ($year and !$month) {
        $where[] = 'date > '.@mktime(0, 0, 0, 1, 1, $year);
        $where[] = 'and';
        $where[] = 'date < '.@mktime(23, 59, 59, ($year == date("Y") ? date("n") : 12), ($year == date("Y") ? date("d") : 31), $year);
    } elseif ($year and $month and !$day) {
        $where[] = 'date > '.@mktime(0, 0, 0, $month, 1, $year);
        $where[] = 'and';
        $where[] = 'date < '.@mktime(23, 59, 59, $month, (($year == date("Y") and $month >= date("n")) ? date("d") : 31), $year);
    } elseif ($year and $month and $day) {
        if($year == date("Y") and $month >= date("n") and $day >= date("d")) {
            $where[] = 'hidden = 2';
        }
        else {
            $where[] = 'date > '.@mktime(0, 0, 0, $month, $day, $year);
            $where[] = 'and';
            $where[] = 'date < '.@mktime(23, 59, 59, $month, $day, $year);
        }
    }
    else {
    if ($schedule) {
        $where[] = 'date > '.(time() + $config_date_adjust * 60 - 432000);
    }
    else {
        $where[] = 'date < '.(time() + $config_date_adjust * 60);
    }
    $schedule = false;
}
else {
    if ($schedule2) {
        $where[] = 'date > '.(time() + $config_date_adjust * 60 - 86400);
    }
    else {
        $where[] = 'date < '.(time() + $config_date_adjust * 60);
    }
    $schedule2 = false;
}
  • 写回答

3条回答 默认 最新

  • dongma7725 2010-04-24 00:54
    关注

    You can't have 2 elses in a row. Maybe elseif, but no one know your logic.

    评论

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭