예제 #1
0
파일: r.php 프로젝트: nehaljwani/SSAD
    //echo $u['eventDays'];
    //echo "<br/>";
    $o = $u['eventStartDate'];
    //echo $o;
    //echo "<br/>";
    //echo $r;
}
$time = time();
//echo "time".$time;
$query = "SELECT * FROM Requests \n                where NOT (eventStartDate >'" . date('2012-10-15') . "' OR eventEndDate < '" . date('2012-10-15') . "') AND NOT (eventStartTime >='" . date('H:i:s', strtotime('18:00:00')) . "' OR eventStartTime <='" . date('H:i:s', $time) . "') ORDER BY eventStartdate,eventStartTime;";
//$query2 = "SELECT * FROM Requests where NOT (eventStartDate >'" . date('Y-m-d','2012-11-10') . "' OR eventEndDate < '" . date('Y-m-d','2012-11-10') . "')  ORDER BY eventStartdate,eventStartTime;";
//$query = "select * from Requests where NOT(eventStartDate > '".date('2012-10-15')."' or eventEndDate < '".date('2012-10-15')."')";
$r = mysql_query($query);
while ($u = mysql_fetch_array($r)) {
    //echo "Adasdasd".$u['eventDays']."<br/>";
    $o = CSVToArray($u['eventDays']);
    //$t = $u['eventStartDate'];
    $weekday = date('l', strtotime('2012-10-15'));
    //echo "week".$weekday."<br/>";
    for ($i = 0; $i < count($o); $i++) {
        //echo "aaaaaa".$o[$i]."<br/>";
        if ($o[$i] == $z[$weekday]) {
            echo "title of the event" . $u['eventTitle'] . "<br/>";
            echo "gvvvvvvvvvvvvvvvvvvvvv" . "<br/>";
            echo $u['eventStartDate'];
            echo "<br/>";
            echo $u['eventEndDate'];
            echo "<br/>";
            echo $u['eventDays'];
            echo "<br/>";
            echo $u['creator'] . "<br/>";
예제 #2
0
            $h_contents = str_replace(strtoupper("Train"), strtoupper($safe_name), $h_contents);
            file_put_contents("Trains/Generated/" . $safe_name . ".h", $h_contents);
            $items[] = $safe_name;
            $headers[] = "Trains/Generated/" . $safe_name . ".h";
            fwrite($makefile, "Objects/" . $safe_name . ": Trains/Generated/" . $safe_name . ".c Generic/step.h\n");
            fwrite($makefile, "\t@echo Building " . $train["Name"] . "...\n");
            fwrite($makefile, "\t@gcc -c -O" . $opt_level . " -Wall Trains/Generated/" . $safe_name . ".c -o Objects/" . $safe_name . "\n");
            fwrite($makefile, "\n");
        } else {
            echo "Warning: Unable to find a train to create!!!!\n";
        }
    }
}
if (is_file("Gates/gates.csv")) {
    $fp = fopen("Gates/gates.csv", "r");
    $data = CSVToArray($fp);
    foreach ($data as $gate) {
        $safe_name = str_replace("-", "", $gate["Name"]);
        if (is_file("Gates/Gate.c") && is_file("Gates/Gate.h")) {
            $c_contents = file_get_contents("Gates/Gate.c");
            foreach ($gate as $key => $value) {
                $c_contents = str_replace($key, $value, $c_contents);
            }
            $c_contents = str_replace("Gate", $safe_name, $c_contents);
            file_put_contents("Gates/Generated/" . $safe_name . ".c", $c_contents);
            $h_contents = file_get_contents("Gates/Gate.h");
            foreach ($gate as $key => $value) {
                $h_contents = str_replace($key, $value, $h_contents);
            }
            $h_contents = str_replace("Gate", $safe_name, $h_contents);
            $h_contents = str_replace(strtoupper("Gate"), strtoupper($safe_name), $h_contents);
예제 #3
0
function courseToInstance()
{
    $day2No = array("Sun" => 1, "Mon" => 2, "Tue" => 3, "Wed" => 4, "Thu" => 5, "Fri" => 6, "Sat" => 7);
    $eventStartDate = "2012-08-01";
    $eventEndDate = "2012-11-28";
    dbconnect();
    $query = "SELECT reqNo FROM Requests ORDER BY reqNO DESC limit 1";
    $result = mysql_fetch_row(execute($query));
    $reqNo = $result['reqNo'];
    $query = "SELECT * FROM CourseRooms;";
    $result = execute($query);
    $i = 0;
    $total = mysql_num_rows($result);
    while ($roomRecords = mysql_fetch_assoc($result)) {
        $instances = weeklyRequestToInstance($eventStartDate, $eventEndDate, CSVToArray($day2No[$roomRecords['Day']]));
        foreach ($instances as $instance) {
            $reqNo++;
            $query = "INSERT INTO Instances(reqNo,hash,creator,creatorEmail,creatorPhone,concernedPName,concernedPEmail,concernedPPhone,appStatus,reqGId,reqDate,eventStartDate,eventEndDate,eventStartTime,eventEndTime,eventTitle,eventDesc,eventDays,concernedAdmin,room,reqType) VALUES(\n\t\t\t\t'" . $reqNo . "',\n                                '" . ($hash = sha1(uniqid(mt_rand(), true)) . "',\n                                'Admin',\n                                '*****@*****.**',\n                                '',\n                                'Admin',\n                                '*****@*****.**',\n                                '',\n                                'Accepted',     \n                                '5',\n                                '" . ($reqDate = date("Y-m-d H:i:s") . "',\n                                '" . $instance . "',\n                                '" . $instance . "',\n                                '" . $roomRecords['StartTime'] . "',\n                                '" . $roomRecords['EndTime'] . "',\n                                '" . $roomRecords['Code'] . "',\n                                '" . $roomRecords['Name'] . "',\n                                '" . $day2No[$roomRecords['Day']] . "',\n                                'Admin',\n                                '" . $roomRecords['Room'] . "',\n                                '" . $roomRecords['Type'] . "'\n                        );"));
            execute($query);
        }
        $i++;
        $percent = intval($i / $total * 100) . "%";
        // Javascript for updating the progress bar and information
        echo '<script language="javascript">
                        document.getElementById("progress").innerHTML="<div style=\\"width:' . $percent . ';background-color:#ddd;\\">&nbsp;</div>";
                document.getElementById("information").innerHTML="' . $i . '/' . $total . ' row(s) processed.";
                    </script>';
        // This is for the buffer achieve the minimum size in order to flush data
        echo str_repeat(' ', 1024 * 64);
        // Send output to browser immediately
        flush();
        // Sleep one second so we can see the delay
    }
}
예제 #4
0
    // What happens when the CAPTCHA was entered incorrectly
    die("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")");
} else {
    foreach ($_POST as $k => $v) {
        echo "{$k} => {$v}" . "<br />";
        if (is_array($v)) {
            foreach ($v as $r => $u) {
                echo "{$r} => {$u}" . "<br />";
            }
        }
    }
    include "essential.php";
    // Importing pre-defined functions
    dbconnect();
    include_once "header.php";
    $ccPersons = CSVToArray($_POST['cc']);
    print_r($ccPersons);
    echo "testtest";
    $hash = sha1(uniqid(mt_rand(), true));
    $eventEndDate = $_POST["eventEndDate"];
    $creator = $_POST["creator"];
    $creatorEmail = phpCAS::getUser();
    if (empty($creatorEmail)) {
        header("Location:requestForm.php?msg='Email  cannot be empty'");
        die;
    }
    if (!filter_var($creatorEmail, FILTER_VALIDATE_EMAIL)) {
        header("Location:requestForm.php?msg='Email is not valid'");
        die;
    }
    $creatorPhone = $_POST["creatorPhone"];
예제 #5
0
//
if ($_POST['reqAction'] == $b) {
    if ($_POST['reason'] == $d) {
        $sq = "update Requests set appStatus='Rejected', reqRejectReason='None' where reqNo=" . $_POST['reqID'] . ";";
    } else {
        $sq = "update Requests set appStatus='Rejected',reqRejectReason ='" . $_POST['reason'] . "' where reqNo=" . $_POST['reqID'] . ";";
    }
    $req = getRequestByID($rID);
    reject($req['creator'], $req['creatorEmail'], $req['room'], $req['reqNo'], $_POST['reason'], getCC($rID));
    reject($req['concernedPName'], $req['concernedPEmail'], $req['room'], $req['reqNo'], $_POST['reason']);
} else {
    if ($_POST['reqAction'] == $a) {
        $query = "SELECT * FROM Requests WHERE reqNo=" . $_POST['reqID'] . ";";
        $acceptedEvent = execute($query);
        $roomRecords = mysql_fetch_assoc($acceptedEvent);
        $instances = weeklyRequestToInstance($roomRecords['eventStartDate'], $roomRecords['eventEndDate'], CSVToArray($roomRecords['eventDays']));
        foreach ($instances as $instance) {
            $query = "INSERT INTO Instances(reqNo,hash,creator,creatorEmail,creatorPhone,concernedPName,concernedPEmail,concernedPPhone,appStatus,reqGId,reqDate,eventStartDate,eventEndDate,eventStartTime,eventEndTime,eventTitle,eventDesc,eventDays,concernedAdmin,room,reqType) VALUES(\n\t\t\t'" . $roomRecords['reqNo'] . "',\n\t\t\t'" . $roomRecords['hash'] . "',\n\t\t\t'" . $roomRecords['creator'] . "',\n\t\t\t'" . $roomRecords['creatorEmail'] . "',\n\t\t\t'" . $roomRecords['creatorPhone'] . "',\n\t\t\t'" . $roomRecords['concernedPName'] . "',\n\t\t\t'" . $roomRecords['concernedPEmail'] . "',\n\t\t\t'" . $roomRecords['concernedPPhone'] . "',\n\t\t\t'Accepted',     \n\t\t\t'" . $roomRecords['reqGId'] . "',\n\t\t\t'" . $roomRecords['reqDate'] . "',\n\t\t\t'" . $instance . "',\n\t\t\t'" . $instance . "',\n\t\t\t'" . $roomRecords['eventStartTime'] . "',\n\t\t\t'" . $roomRecords['eventEndTime'] . "',\n\t\t\t'" . $roomRecords['eventTitle'] . "',\n\t\t\t'" . $roomRecords['eventDesc'] . "',\n\t\t\t'" . $roomRecords['eventDays'] . "',\n\t\t\t'" . $roomRecords['concernedAdmin'] . "',\n\t\t\t'" . $roomRecords['room'] . "',\n\t\t\t'" . $roomRecords['reqType'] . "'\n\t\t);";
            execute($query);
        }
        $sq = "update Requests set appStatus='Accepted' where reqNo=" . $_POST['reqID'] . ";";
        $clash = requestClash($roomRecords['eventStartDate'], $roomRecords['eventEndDate'], $roomRecords['eventStartTime'], $roomRecords['eventEndTime'], $roomRecords['room']);
        while ($req = mysql_fetch_assoc($clash)) {
            //print_r($req);
            if ($req['reqNo'] != $rID) {
                //echo $req['reqNo'];
                //echo "<HI><br><br><br><br>\n";
                $otherQuery = "update Requests set appStatus = 'Rejected', reqRejectReason = 'A request conflicting with your request was accepted.' where reqNo = {$req['reqNo']}";
                //echo $otherQuery."\n";
                execute($otherQuery);
                reject($req['creator'], $req['creatorEmail'], $req['room'], $req['reqNo'], getCC($rID));