</div>
                    </a>
                  </li>
                <?php 
        }
        ?>
              <?php 
    }
    ?>
						<?php 
}
if (empty($params) || count($params) == 0 || isset($params['p'])) {
    ?>
 
              <?php 
    $result_func1 = loadimage(0, 30);
    while ($row_result_func1 = mysql_fetch_assoc($result_func1)) {
        $p_number = $row_result_func1['p_number'];
        $at_number = $row_result_func1['album_type_number'];
        $c_number = $row_result_func1['club_number'];
        $p_code = $row_result_func1['p_code'];
        $filename = $row_result_func1['filename'];
        ?>
                <li class="photo" id="photo_<?php 
        echo $p_number;
        ?>
" code="<?php 
        echo $p_code;
        ?>
" c="<?php 
        echo $c_number;
    while ($row_result = mysql_fetch_assoc($result_sql)) {
        if ($i == 1) {
            $i++;
        } else {
            $c_number .= ", ";
        }
        $c_number .= $row_result['c_number'];
    }
    $sql_func1 = "SELECT * FROM ( SELECT * FROM `photo` WHERE `club_number` in ({$c_number}) ORDER BY `time` DESC LIMIT {$start}, {$count} ) AS T2 ORDER BY RAND()";
    $result_func1 = mysql_query($sql_func1);
    return $result_func1;
}
if (isset($_GET['start']) && isset($_GET['count'])) {
    $start = intval($_GET['start']);
    $count = intval($_GET['count']);
    $result_func1 = loadimage($start, $count);
    $data = array();
    while ($row_result_func1 = mysql_fetch_array($result_func1, MYSQL_NUM)) {
        $data[] = $row_result_func1;
    }
    return $result_func1;
    //$json->encode( $data );
}
if (isset($_GET['p']) && $_GET['p'] != '') {
    // function 2 依點選的相片去選取相片
    $sql_func2 = "SELECT * FROM `photo` WHERE `p_number`= '" . $_GET['p'] . "'";
    $result_func2 = mysql_query($sql_func2);
    $row_result_func2 = mysql_fetch_assoc($result_func2);
    // function 3 選取 點選照片後 該相簿裡的其他相片
    $sql_func3 = "SELECT * FROM `photo` WHERE `album_type_number` = '" . $row_result_func2['album_type_number'] . "' ";
    $result_func3 = mysql_query($sql_func3);
        } else {
            if ($type == "load") {
                loadNote();
            } else {
                if ($type != "lecturecourse") {
                    header("HTTP/1.1 400 Invalid Request");
                    die("HTTP/1.1 400 Invalid Request - you passed in a wrong type parameter.");
                }
            }
        }
    }
} else {
    if (isset($_POST["lecturecourse"])) {
        if (isset($_POST["lecturenumber"])) {
            if (isset($_POST["page"])) {
                loadimage();
            } else {
                pageList();
            }
        } else {
            lectureList();
        }
    }
}
function getLastNum()
{
    $db = new LectureNote();
    $order = $db->getLastNum();
    if ($order == NULL) {
        $order = 1;
    } else {