コード例 #1
0
function func_show_movies($option, $option2, $db)
{
    switch ($option) {
        case '':
            show($db, 1);
            break;
        case 'desc':
            show($db, -1);
            break;
        case 'genre':
            show_genre($db, $option2);
            break;
        case 'year':
            show_year($db, $option2);
            break;
        case 'rate':
            show_rate($db, $option2);
            break;
        default:
            echo "Error: Wrong option (valid : desc, genre, year, rate)";
            break;
    }
}
コード例 #2
0
ファイル: rate.php プロジェクト: l1ght13aby/Ubilling
function get_rate($for)
{
    $valid_post = false;
    $b_start = '<div class="rate"> ';
    $b_end = ' </div>';
    if (trim(rcms_parse_text($for)) != '') {
        $valid_post = true;
        $for = md5(trim(rcms_parse_text($for)));
    }
    $post_for = 0;
    if (isset($_POST['for'])) {
        $post_for = $_POST['for'];
    }
    $valid_val = 0;
    if (isset($_POST['val'])) {
        if ($_POST['val'] == '5' or $_POST['val'] == '4' or $_POST['val'] == '3' or $_POST['val'] == '2' or $_POST['val'] == '1') {
            $valid_val = $_POST['val'];
        }
    }
    if (!$valid_post) {
        return $b_start . __('Rate') . ': ' . __('Only for registered users') . $b_end;
    }
    if (!LOGGED_IN) {
        return $b_start . show_rate($for) . $b_end;
    }
    if ($post_for == $for and $valid_val == 0 and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) {
        return $b_start . show_rate_rbox($for) . $b_end;
    }
    if ($post_for == $for and $valid_val == 0 and check_ip($for, $_SERVER['REMOTE_ADDR'])) {
        return $b_start . show_rate($for) . $b_end;
    }
    if ($post_for == $for and $valid_val !== 0 and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) {
        write_rate($for, $valid_val, $_SERVER['REMOTE_ADDR']);
        return $b_start . show_rate($for) . $b_end;
    }
    if ($post_for !== $for and $valid_post and !check_ip($for, $_SERVER['REMOTE_ADDR'])) {
        return $b_start . show_rate_rbox($for) . $b_end;
    }
    if ($post_for !== $for and $valid_post and check_ip($for, $_SERVER['REMOTE_ADDR'])) {
        return $b_start . show_rate($for) . $b_end;
    }
    return $b_start . __('Rate') . ': ' . __('Data not valid') . $b_end;
}