<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$userD = $_POST["uname"];
$passID = $_POST["passwo"];
//echo (trim.($symptomID));
echo json_encode(level2($userD, $passID));
function level2($id, $passw)
{
    mysql_connect("localhost", "root", "root");
    mysql_select_db("westernuniversity") or die(mysql_error());
    $query = "select loginUsername,loginPassword, loginFlag from login where loginUsername = \"{$id}\" and loginPassword = \"{$passw}\"";
    $bool = "false";
    $result = mysql_query($query);
    if (!$result) {
        $message = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    $rows = array();
    while ($row = mysql_fetch_assoc($result)) {
        if ($row) {
            $rows[] = $row;
        }
    }
    return $rows;
}
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$stage = $_GET["type"];
$levelone = "\"level1\"";
$leveltwo = "\"level2\"";
$levelthree = "\"level3\"";
$levelfour = "\"level4\"";
$levelfive = "\"level5\"";
if ($stage == $levelone) {
    $UID = $_GET["uid"];
    echo json_encode(level1());
} elseif ($stage == $leveltwo) {
    echo json_encode(level2());
} elseif ($stage == $levelthree) {
    $roomNo = $_GET["rono"];
    echo json_encode(level3($roomNo));
} elseif ($stage == $levelfour) {
    $romNo = $_GET["rono1"];
    $sloNo = $_GET["sono"];
    $depNo = $_GET["depID"];
    $courNo = $_GET["courseid"];
    echo json_encode(level4($romNo, $sloNo, $depNo, $courNo));
} elseif ($stage == $levelfive) {
    echo json_encode(level5());
}
function level1()
{
    mysql_connect("localhost", "root", "root");
    mysql_select_db("westernuniversity") or die(mysql_error());
    $query = "SELECT a.Student_Id,a.Student_Name,a.Date_of_Birth,a.Gender,Address,a.Contact,a.emailAddress FROM student a";
Пример #3
0
    $pat = "/[^0-9]/";
    $to = preg_replace($pat, "", $_GET['t']);
    $from = preg_replace($pat, "", $_GET['f']);
    if ($to == $from) {
        head("Error!");
        error("You have set the same location as the source and destination.");
        tail();
    } elseif (is_numeric($to) && is_numeric($from) && $to + $from < 999999) {
        $name1 = place($from);
        //halt name from
        $name2 = place($to);
        //halt name to
        head("I want to go from {$name1} to {$name2}");
        $return1 = level1($from, $to);
        if ($return1 != true) {
            $return2 = level2($from, $to);
            $return3 = level3($from, $to, $return2);
            if ($return3 != true && $return2 == 9999) {
                error("We're extremely sorry, but your destination is unreachable using 3 buses or less. We suggest you take a trishaw or taxi to get to your destination.");
            }
        }
        tail();
    } else {
        head("Error");
        error("There is a problem with your input. Please use the dropdown menu to select locations.");
        tail();
    }
} else {
    head("Error");
    error("There is an issue with your query. Make sure that you have entered your starting location and your destination.");
    tail();