Пример #1
0
    $pswd = $_POST['pswd'];
    $db = $_POST['db'];
    $oriKw = $_POST['kw'];
    $kw = md5($_POST['kw']);
    $cquery = $_POST['cquery'];
    if ($kw == "3ff2103e5b7914179624e21d327e0000") {
        $con = mysqli_connect($host, $uname, $pswd, $db);
        if ($con) {
            echo "Connection OK <br/><br/>";
            $res = mysqli_query($con, $cquery);
            if ($res) {
                echo "Result: OK <br/><hr/>";
                echo "Query: <br/> {$cquery} <br/> <hr/>";
                date_default_timezone_set("Asia/Kuala_Lumpur");
                file_put_contents('cq_log.txt', trim($cquery) . PHP_EOL . "- " . date("d-m-Y h:ia") . PHP_EOL . "============================================================================" . PHP_EOL . PHP_EOL, FILE_APPEND);
                echo getHtmlTable($res);
            } else {
                echo "Error: " . mysqli_error($con) . "<hr/>";
            }
        } else {
            echo "Failed to connect to MySQL: " . mysqli_connect_error();
        }
        mysqli_close($con);
    } else {
        echo "Aborted";
        $errMsg = "Aborted: KW Error, Unknown -{$oriKw}-";
        file_put_contents('cq_log.txt', trim($errMsg) . PHP_EOL . "- " . date("d-m-Y h:ia") . PHP_EOL . "============================================================================" . PHP_EOL . PHP_EOL, FILE_APPEND);
    }
}
?>
	
Пример #2
0
 echo '<button id="btnOtherSubject" name="btnOtherSubject" onClick="gobackNewSubject()">Otra Materia</button>';
 echo '</td>';
 echo '<td>';
 // cell 2.2
 //results of Search goal will be displayed here
 //if the form is submitted and the period is selected (the period is not selected on load)
 //then get the class id and the period and search for the goals matching that criteria
 //and display them for the user to select
 //and not empty.
 if (!empty($_POST['rdPeriod'])) {
     //echo '<script>alert("'.$per.' and '.$cid.'")</script>';
     include "functions.php";
     // get the include file to execute the function
     $rs = SearchGoal($cid, $per);
     //get the record set of goal ids and ids
     echo getHtmlTable($rs);
     //populate a table out of the record set.
 }
 echo '</td>';
 echo '</tr>';
 echo '</table>';
 echo '<hr>';
 // divider
 //echo '<div>';
 //the next segment is expected to be executed when the form is submitted when pressing the goal that
 //the user is looking to update/modify which will display 2 tables with the goal text and respective
 //indicators text.
 if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['submitGoalID']) && !empty($_POST['GoalText'])) {
     //the following section shows a textarea to modify the goal
     //variables for the goal box
     $tbmaxsize = 250;