Example #1
0
function writeCell($conn, $date, $period)
{
    // checks if available
    $name = checkAvailable($conn, $date, $period);
    // if something is returned, then it is booked
    if ($name) {
        echo "<td class='booked'><b>" . $name . "</b></td>";
    } else {
        // check if the date is in the past
        if (checkIfInThePast($date)) {
            //if in the past, write a cell
            echo "<td class='past'></td>";
        } else {
            // checks if user is read only or not
            if (!readOnly($conn)) {
                if (canBookSLT($conn)) {
                    // else write a form containing a button to POST
                    echo "<form method='POST' action='slt_clip.php'>";
                    echo "<td class='available'><button type='submit' id='availablebtn' name='book'";
                    echo "onclick=\"return confirm('" . writeDialog("CLIP", $date, $period) . "');\"";
                    echo "value='" . $date . "," . $period . "'>Book</button></td>";
                    echo "</form>";
                } else {
                    // if can't book vehicles, does not write book button
                    echo "<td class='available'></td>";
                }
                // else
            } else {
                // if read-only, does not write book button
                echo "<td class='available'></td>";
            }
            // else
        }
        // else
    }
    // else
}
Example #2
0
function writeCell($conn, $date, $period)
{
    // checks if available
    $name = checkAvailable($conn, $date, $period);
    // if something is returned, then it is booked
    if ($name) {
        // sql to get the booking description of the booking
        $sqlGetDescription = "SELECT BookingDesc FROM minibusyhj\n                            WHERE BookingDate={$date} AND BookingPeriod={$period}";
        $resultGetDescription = mysqli_query($conn, $sqlGetDescription);
        if (!$resultGetDescription) {
            $bookingdesc = "Unable to get booking description";
        } else {
            $row = mysqli_fetch_assoc($resultGetDescription);
            $bookingdesc = $row["BookingDesc"];
        }
        // on hover replaces the text with the description using JQuery
        echo "<b><td class='booked'><span class='bookedtext' style='font-weight:bold'>" . $name . "</a></span>\n            <input type='hidden' id='description' value=\"{$bookingdesc}\"' /></td></b>";
    } else {
        // check if the date is in the past
        if (checkIfInThePast($date)) {
            //if in the past, write a cell
            echo "<td class='past'></td>";
        } else {
            // checks if user is read only or not
            if (!readOnly($conn)) {
                if (canBookVehicles($conn)) {
                    // else write a form containing a button to POST
                    echo "<form method='POST' action='minibusyhj.php' id={$date},{$period}>";
                    echo "<td class='available'>";
                    echo "<input type='hidden' id='hiddenbooking,{$date},{$period}' name='hiddenbookingdesc' value='' runat='server'>";
                    echo "<button type='submit' id='availablebtn' name='book' ";
                    echo "onclick=\"getBookingDescription({$date},{$period}); return confirm('" . writeDialog("Minibus YHJ", $date, $period) . "');\"";
                    echo "value='" . $date . "," . $period . "'>Book</button></td>";
                    echo "</form>";
                } else {
                    echo "<td class='available'></td>";
                }
            } else {
                // if read-only, does not write book button
                echo "<td class='available'></td>";
            }
            // else
        }
        // else
    }
    // else
}
function writeCell($conn, $date, $period, $table)
{
    // checks if available
    $minibuscodes = ["jbx", "jha", "lle", "yhj"];
    $name = checkAvailable($conn, $date, $period, $table);
    // if something is returned, then it is booked
    if ($name) {
        // sql to get the booking description of the booking
        $sqlGetDescription = "SELECT BookingDesc FROM {$table}\n                            WHERE BookingDate={$date} AND BookingPeriod={$period}";
        $resultGetDescription = mysqli_query($conn, $sqlGetDescription);
        if (!$resultGetDescription) {
            $bookingdesc = "Unable to get booking description";
        } else {
            $row = mysqli_fetch_assoc($resultGetDescription);
            $bookingdesc = $row["BookingDesc"];
        }
        // on hover replaces the text with the description using JQuery
        echo "<td class='booked'><span class='bookedtext'>" . $bookingdesc . "</a></span>\n            <input type='hidden' id='description' value=\"{$bookingdesc}\"' /></td>";
    } else {
        // check if the date is in the past
        if (checkIfInThePast($date)) {
            //if in the past, write a cell
            echo "<td class='past'></td>";
        } else {
            // checks if user is read only or not
            if (!readOnly($conn)) {
                if (canBookVehicles($conn)) {
                    // else write a form containing a button to POST
                    echo "<form method='POST' action='all_vehicles.php' id={$date},{$period},{$table}>";
                    echo "<td class='available'>";
                    echo "<input type='hidden' id='hiddenbooking,{$date},{$period},{$table}' name='hiddenbookingdesc' value='' runat='server'>";
                    echo "<input type='hidden' id='{$date},{$period}' name='table' value='{$table}' runat='server'>";
                    echo "</form>";
                } else {
                    echo "<td class='available'></td>";
                }
            } else {
                // if read-only, does not write book button
                echo "<td class='available'></td>";
            }
            // else
        }
        // else
    }
    // else
}
Example #4
0
<?php

require_once '../../config.php';
require_once '../../model/mysql_query.php';
if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $password = md5($password);
    $data = array('username' => $username);
    if (!checkAvailable('users', $data)) {
        $data = array('username' => $username, 'password' => $password);
        $check = insert('users', $data);
        if ($check) {
            echo "Register sucessfull";
        } else {
            echo 'Register failure ';
        }
    } else {
        echo "Account is avalible";
    }
}
mysql_close($db);
Example #5
0
<?php

header("content-type:text/html;charset:utf-8");
set_time_limit(0);
date_default_timezone_set("Asia/Shanghai");
$domains = array("crusher.com", "jawcrusher.co.in", "mobilecrusher.pw", "conecrusher.co.in", "lxpdeyumng.com");
$start = date("Y-m-d") . " 03:55:00";
$end = date("Y-m-d") . " 04:30:00";
$json = getJson($domains);
$domain_status = getDomainStatus($json, $domains);
print_r(checkAvailable($domain_status));
//检查可以注册的域名
function checkAvailable($domains_status)
{
    $arrayKeys = array_keys($domains_status);
    $i = 0;
    foreach ($arrayKeys as $domain) {
        if ($domains_status[$domain]["status"] == "available") {
            $ava_domains[$i] = $domain;
            $i++;
        }
    }
    return $ava_domains;
}
//获取域名状态json数据
function getJson($domains)
{
    return sendData(getDomainCheckUrl(getDomainConsist($domains)));
}
/**
 * 获取需要注册域名的status