}
    if (!$validator->CheckValueInRange(strlen($value), 1, 50)) {
        $errors .= "<li>Unit code is too long. Please keep it less than 50 characters</li>";
    }
    if (strlen($errors) > 0) {
        return false;
    }
    return true;
}
//Sanatise ALL the Data :D
$i_uname = $sanitiser->sanitise($_POST["unitname"]);
$i_ucode = $sanitiser->sanitise($_POST["unitcode"]);
//Start Validating :D
$valid = true;
$valid = uname($i_uname) && $valid;
$valid = ucode($i_ucode) && $valid;
if (!$valid) {
    header("location:create_unit.php?errors={$errors}");
    die;
} else {
    //check if the unit already exist
    $email = $_SESSION['username'];
    $courseID = $_SESSION['u_course'];
    $universityID = $_SESSION['u_university'];
    include_once "settings.php";
    $conn = mysqli_connect($host, $user, $pwd, $sql_db);
    if (!$conn) {
        header("location:error.php?type=database");
        die;
    }
    //checking for duplicate
Esempio n. 2
0
function uset_image($lc_direction = "up", $lc_fast = 2, $lc_width = 500, $lc_height = 130)
{
    //第一個參數傳入方向  up down left right
    //第二個參數傳入速度  數字越小越慢  數字越大越快
    //第三個參數傳入整個輪播圖片的寬度
    //第四個參數傳入整個輪播圖片的高度
    $m_link = uconnect("aigulic2_COR000");
    ucode();
    $query = mysql_query("SELECT A.NO_,A.NAME1 AS IMG_NAME, B.NAME1\r\n\t\t\t\t\t\t\tFROM A6200A_IMAGE A LEFT OUTER JOIN A6200A B \r\n\t\t\t\t\t\t\tON B.NO_=A.NO_\r\n\t\t\t\t\t\t\tWHERE A.TYPE_ = 2 AND B.ORDER1='1'", $m_link);
    $side = "";
    $m_num = 0;
    while ($a_record = mysql_fetch_array($query)) {
        $side[$m_num] = "<a href='../0435001188/heart_pc.php?m_par={$a_record['NO_']}' target='_blank'><img src='../A6200A_IMAGE/{$a_record['IMG_NAME']}' width='153' height='129'></a>";
        $m_num = $m_num + 1;
    }
    for ($m_j = 0; $m_j < count($side); $m_j++) {
        //count傳回陣列的元素個數
        if ($lc_direction == "left" || $lc_direction == "right") {
            $slide = $slide . ' ' . $side[$m_j];
        } else {
            $slide = $slide . '<br>' . $side[$m_j];
        }
    }
    if ("<script>document.all</script>") {
        echo "<marquee direction='" . $lc_direction . "' scrollAmount='" . $lc_fast . "' top='300' width='500' height='" . $lc_height . "' onMouseOut='this.start()' onMouseOver='this.stop()'>" . $slide . "</marquee>";
    }
}