<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
function level1()
{
    mysql_connect("localhost", "root", "root");
    mysql_select_db("westernuniversity") or die(mysql_error());
    $query = "select Course_Id,Course_Name,Course_Credits,Course_StartDate,Course_EndDate,Course_Prerequisites,Max_Registrations from course";
    $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;
}
$stage = $_GET["type"];
$levelone = "\"courseDisp\"";
if ($stage == $levelone) {
    echo json_encode(level1());
}
?>
 
{
    mysql_connect("localhost", "root", "root");
    mysql_select_db("westernuniversity") or die(mysql_error());
    /*if($stype=="Student_Id"){
          
      }
      elseif($stype=="Student_Name"){
      }
      elseif($stype=="Gender"){
      }
      elseif($stype=="Address"){
      }*/
    $query = "SELECT a.Student_Id,a.Student_Name,a.Date_of_Birth,a.Gender,Address,a.Contact,a.emailAddress FROM student a where {$stype} like \"%{$txt}%\" ";
    $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;
}
$searchtext = $_POST["srch"];
$searchtype = $_POST["typesearch"];
echo json_encode(level1($searchtext, $searchtype));
<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$stage = $_GET["type"];
$levelone = "\"level1\"";
if ($stage == $levelone) {
    $UID = $_GET["uid"];
    echo json_encode(level1($UID));
}
function level1($id)
{
    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,login b where a.emailAddress=b.loginUsername and a.emailAddress= {$id}";
    //$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;
}
Esempio n. 4
0
$dbconn = new DBConn();
if (isset($_GET['t']) && isset($_GET['f'])) {
    $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");
Esempio n. 5
0
    if (strtoupper($password) != $password) {
        $strength += 1;
    }
    if ($length >= 6 && $length <= 10) {
        $strength += 1;
    }
    if ($length >= 10 && $length <= 16) {
        $strength += 2;
    }
    if ($length > 16) {
        $strength += 3;
    }
    preg_match_all('/[|!\\@#$%&*\\/=?,;.:\\-_+~^]/', $password, $specialchars);
    $strength += sizeof($specialchars[0]) * 4;
    $chars = str_split($password);
    $num_unique_chars = sizeof(array_unique($chars));
    $strength += $num_unique_chars * 2;
    if ($strength < 12) {
        return 1;
    } elseif ($strength >= 12 && $strength < 18) {
        return 2;
    } elseif ($strength >= 18 && $strength < 24) {
        return 3;
    } elseif ($strength >= 24 && $strength < 30) {
        return 4;
    } else {
        return 5;
    }
}
echo level1("123^12'^'4saad") * 20 / 5 . "\n";