示例#1
0
</div></td>

                            <td><div align="center"><?php 
            echo $objResult1["LOCATION"];
            ?>
<div></td>

                                        <td><div align="center"><?php 
            echo $objResult1["DESCRIPTION"];
            ?>
</div></td>

                                        <?php 
            echo "<td><div align='center'><input class='downloadbutton' type='submit' name='UnSubscribe{$cnt}' value='UnSubscribe' style='horizontal-align: middle;'/></div></td>";
            if (isset($_POST["UnSubscribe{$cnt}"])) {
                OceanDB::getInstance()->delete_subscription($objResult1["SENSOR_ID"], $user);
                header("Refresh:0");
            }
            $cnt++;
            ?>

                                        </tr>

                                        <!-- Display message if the user has no subscriptions -->
                                        <?php 
        }
    }
} else {
    echo "<p style='color:red;'>CURENTLY NOT SUBSCRIBED TO ANY SENSOR<p>";
}
?>
示例#2
0
        
    <!-- Navigation Panel -->
         <form name="logon" method="post">
         <input class="logoutButton" type="submit" value="Help" name="Help">
                   <?php 
if (isset($_POST['Help'])) {
    header('Location: userDocumentation.php');
}
?>
        </form>
              <!--check the role of the user - only administrators are allowed to access this section-->
        <?php 
require_once 'Includes/db.php';
session_start();
$user = $_SESSION['user'];
$role = OceanDB::getInstance()->get_user_role($user);
?>
        
        <!--Bring up Management screen if administrator else deny access and display message-->
        <?php 
if ($role == 's') {
    ?>
           
            <?php 
    $allow = true;
    ?>
        <?php 
} else {
    ?>
            <h1 align="left" style="font-size: 175%; color: red">Access denied: Not a Scientist</h1>
            <?php 
示例#3
0
        
        <!--return to home screen when "home" button is pressed-->
        <?php 
if (isset($_POST['home'])) {
    header('Location: homeScreen.php');
}
?>
 

        <?php 
if ($allow) {
    ?>
           
            <!--get all scalar sensors that the current user is subscribed to and display in drop down -->
            <?php 
    $sensors = OceanDB::getInstance()->get_subscribed_sensors($user);
    ?>
            
            <table width="250" align="center">
                <tr>
                    <td><div align="left" style="font-size: 125%">Select Sensor:</div></td>
                    <td><div align="left"><select name="sensor"><option value=""></option> <?php 
    while ($sen = oci_fetch_array($sensors, OCI_ASSOC)) {
        ?>
                                                                                                    <option value="<?php 
        echo $sen['SENSOR_ID'];
        ?>
"<?php 
        if (isset($_POST['show']) && $_POST['sensor'] == $sen["SENSOR_ID"]) {
            ?>
selected<?php 
示例#4
0
?>
     
                
                <!--user action - "log on" to the system, "account" to edit the users personal/user account information-->
                <input class="logoutButton" type="submit" value="Log On" name="logon">
                <input class="logoutButton" type="submit" value="Account" name="person">
                
                <?php 
//access to OceanDB class to connect and query the database
require_once "Includes/db.php";
//check that username and password are entered
if (isset($_REQUEST['logon']) or isset($_REQUEST['person'])) {
    if ($_POST["user"] != "" && $_POST["userpassword"] != "") {
        //check if the username are password are vaild
        //if valid allow the user action to the system or edit account
        $valid = OceanDB::getInstance()->is_valid_login($_POST["user"], $_POST["userpassword"]);
        if ($valid) {
            session_start();
            $_SESSION['user'] = $_POST["user"];
            $_SESSION['screen'] = "Logon";
            if (isset($_REQUEST['logon'])) {
                header('Location: homeScreen.php');
            }
            if (isset($_REQUEST['person'])) {
                header('Location: personalAccount.php');
            }
            exit;
        } else {
            echo "<br><p style='color:red;'>Incorrect username and/or password<p>";
        }
    }
示例#5
0
                    <td> <div align="center">Role</div></td>
                </tr>
                <?php 
while ($users1 = oci_fetch_array($usersAll, OCI_BOTH)) {
    ?>
                    <tr>
                    <td><div align="center"><input type="radio" name="userSelected" value="<?php 
    echo $users1["USER_NAME"];
    ?>
"></div></td>
                    <td><div align="center"><?php 
    echo $users1["USER_NAME"];
    ?>
</td>
                    <td><div align="center"><?php 
    echo OceanDB::getInstance()->get_role($users1["ROLE"]);
    ?>
</div></td>
                    </tr>
                <?php 
}
?>
            </table>
            
            <!--"edit user" button to edit user-->
            <div align="center">
            <input class="logoutButton" type="submit" value="Edit User" name="userEdit" style="margin-top:15;margin-bottom:15">
            <p style="color:red;display:<?php 
if (isset($_POST['userEdit']) && $_POST['userSelected'] == '') {
    ?>
inline <?php 
示例#6
0
                    <?php 
}
?>
                </table>
           
            <!--"create new person" button is selected - user is taken to a different page to create -->
            <?php 
if (isset($_POST['newPerson'])) {
    header('Location: createNewPersonProfile.php');
}
?>

            <!--"delete person" if a person is selected the person is deleted-->
            <?php 
if (isset($_POST['deletePerson']) && $_POST['personSelected'] != $personID) {
    OceanDB::getInstance()->delete_person($_POST['personSelected']);
    header('Location: managementUserScreen.php');
}
?>
            
            <!--"edit person" if a person is selected the user is taken to a different page to edit the person-->
            <?php 
if (isset($_POST['editPerson']) && $_POST['personSelected'] != '') {
    $_SESSION['personToEdit'] = $_POST['personSelected'];
    header('Location: editPersonScreen.php');
}
?>
            
            
        </form> 
    </body>
示例#7
0
    if ($_POST['location'] == '') {
        $isEmpty = true;
    }
    if ($_POST['description'] == '') {
        $isEmpty = true;
    }
    if ($_POST['type'] == '') {
        $isEmpty = true;
    }
}
?>
            
            <!--if "save" button is selected and fields are not empty, save the sensor to the database and return to the previous screen-->
            <?php 
if (isset($_POST['save']) && !$isEmpty) {
    $success = OceanDB::getInstance()->add_new_sensor($_POST['sensorID'], $_POST['location'], $_POST['type'], $_POST['description']);
    if (!$success) {
        ?>
 
                    <p style="color:red;" align="center">Error! Sensor was not saved<p> 
                <?php 
    } else {
        header('Location: managementSensorScreen.php');
    }
}
?>
                        
             <!--"cancel" clicked - return the the previous page-->           
            <?php 
if (isset($_POST['cancel'])) {
    header('Location: managementSensorScreen.php');
示例#8
0
                    <h1 style="font-size: 115%; color:green">Upload Successful</h1>
                    <p>
                        <!--Upload another file -->
                    <form name="uploadAnother" method="post">
                        <input class="logoutButton" type="submit" value="Upload Another File" style="font-size:100%; width:200px; margin:10" name="uploadAnother">
                        <!--return to home screen when "home" button is pressed-->
                    <?php 
            if (isset($_POST['uploadAnother'])) {
                header('Location: uploadScreen.php');
            }
            ?>
                    </form>
            <?php 
        } elseif ($ext == 'csv') {
            //Call to funciton for uploading scalar data in batches form csv file, scalar data is inserted in this funtion
            $result = OceanDB::getInstance()->upload_csv($_FILES);
            ?>
                    <!-- Scalar data is uploaded -->
                    <h1 style="font-size: 115%; color:green">Upload Successful</h1>
                    <!--Display uploaded data -->
                    <p>Scalar Data Uploaded:</p>
            <?php 
            foreach ($result as $key => $value) {
                echo "Sensor_Id: " . $value[0] . ", ";
                echo "Date_Created: " . $value[1] . ", ";
                echo "Value: " . $value[2];
                ?>
<br>
                        <?php 
            }
            ?>
示例#9
0
            
            <!--"save" button is clicked - must do checks on the entered information before saving to the database-->
            <!--check: all fields are filled in, none can be left empty-->
            <?php 
if (isset($_REQUEST['save'])) {
    $empty = false;
    if ($_POST['firstName'] == '' or $_POST['lastName'] == '' or $_POST['address'] == '' or $_POST['email'] == '' or $_POST['phone'] == '') {
        $empty = true;
    }
}
?>
            
            <!--if "save" save button is clicked and the fields are not empty, save the person to the database and return to the previous page-->
            <?php 
if (isset($_REQUEST['save']) && !$empty) {
    $success = OceanDB::getInstance()->add_new_person($personID, $_POST['firstName'], $_POST['lastName'], $_POST['address'], $_POST['email'], str_replace("-", "", $_POST['phone']));
    if ($success) {
        if ($screen == "createUser") {
            header('Location: createNewUser.php');
        }
        if ($screen == "editUser") {
            header('Location: editUserScreen.php');
        }
        if ($screen == "userManagement") {
            header('Location: managementUserScreen.php');
        }
    }
}
?>
           
            
示例#10
0
</div></td>
                    </tr>
                <?php 
}
?>
            </table>
           
            <!--"create new sensor" button is selected - user is taken to a different page to create -->
            <?php 
if (isset($_POST['newSensor'])) {
    header('Location: createNewSensor.php');
}
?>

            <!--"delete sensor" if a sensor is selected the sensor is deleted-->
            <?php 
if (isset($_POST['deleteSensor']) && $_POST['sensorSelected'] != '') {
    OceanDB::getInstance()->delete_sensor($_POST['sensorSelected']);
    header('Location: managementSensorScreen.php');
}
?>
            
        </form> 
    </body>
    <!--used for graphical interface-->
    <?php 
require_once "Includes/css.php";
?>
</html>

示例#11
0
            
            <!--"save" clicked - do checks on fields-->
            <!--check: fields cannot be empty-->
            <?php 
if (isset($_REQUEST['save'])) {
    $empty = false;
    if ($_POST['firstName'] == '' or $_POST['lastName'] == '' or $_POST['address'] == '' or $_POST['email'] == '' or $_POST['phone'] == '') {
        $empty = true;
    }
}
?>
            
            <!--update the person if all fields are filled out and return to previous page-->
            <?php 
if (isset($_REQUEST['save']) && !$empty) {
    $success = OceanDB::getInstance()->update_person($person["PERSON_ID"], $_POST['firstName'], $_POST['lastName'], $_POST['address'], $_POST['email'], str_replace("-", "", $_POST['phone']));
    if ($success) {
        if ($screen == "createUser") {
            header('Location: createNewUser.php');
        }
        if ($screen == "userManagement") {
            header('Location: managementUserScreen.php');
        }
    }
}
?>
            
        </form> 
    </body>
    <!--used for graphical interface-->
    <?php 
示例#12
0
            <!--if week button clicked - if week is in weekR array remove it (roll up), in not in weekR array add week (drill down)-->
            <?php 
if (isset($_REQUEST["weeks"])) {
    if (($key = array_search($_POST["weeks"], $weeksR)) !== false) {
        unset($weeksR[$key]);
    } else {
        array_push($weeksR, $_POST["weeks"]);
    }
    $_SESSION["weeks"] = $weeksR;
    header('Location: reportScreen.php');
}
?>
            
            <!--drop view from the database-->
            <?php 
OceanDB::getInstance()->drop_view_data();
?>
        </form>              
                            
    </body>
    <!--used for graphical interface-->
    <?php 
require_once "Includes/css.php";
?>
</html>


<?php 
//gets the label depending with time level
function get_time_label($date)
{
示例#13
0
" download="recording<?php 
                                echo $afilename;
                                ?>
"><input class=downloadbutton type="button" value="Download"/><a/>
                                                    <?php 
                            }
                        }
                        ?>
                                        </div>
                                    </td>   
                                </tr>

                                <?php 
                        //Scalar Row
                        if (count($scalarData_content) != 0) {
                            $scalarData = OceanDB::getInstance()->get_scalar_data_values($sensorID, $_POST["startDate"], $_POST["endDate"], $_POST["startTime"], $_POST["endTime"]);
                            while ($sensorResult = oci_fetch_array($scalarData, OCI_BOTH)) {
                                ?>

                                        <tr>
                                            <td><div align="center"><?php 
                                echo $sensors_content[$k]["SENSOR_ID"];
                                ?>
</div></td>

                                            <td><div align="center"><?php 
                                echo $sensorResult["DATE_CREATED"];
                                ?>
</div></td>

                                            <td><div align="center"></div></td>
示例#14
0
if (isset($_POST['saveNewUser']) && !$validPassword && !$isEmpty) {
    echo "<p style='color:red;'>Passwords do not match.<p>";
}
?>
            <!--if username already exists display message-->
            <?php 
if (isset($_POST['saveNewUser']) && !$validUser && !$isEmpty) {
    echo "<p style='color:red;'>Username " . $_POST['username'] . " already exists<p>";
}
?>
            </div>
            
            <!--if all checks pass: not empty, unique username, matching passwords - can save the user-->
            <?php 
if (isset($_POST['saveNewUser']) && !$isEmpty && $validPassword && $validUser) {
    $success = OceanDB::getInstance()->add_new_user($_POST['username'], $_POST['password'], $_POST['role'], $_POST['personProfile']);
    if ($success) {
        header('Location: managementUserScreen.php');
    }
}
?>
            
            <!--"add new profile" button clicked - go to page to create-->
            <?php 
if (isset($_POST['newProfile'])) {
    header('Location: createNewPersonProfile.php');
}
?>
            
            <!--"cancel" clicked - discard form and return to previous page-->
            <?php 
示例#15
0
if ($changePassword && $saveInfo) {
    $success = OceanDB::getInstance()->update_user($userEdit, $_POST['role'], $_POST['username'], $_POST['newPassword'], $_POST['personProfile']);
    if ($success) {
        if ($user == $userEdit) {
            $_SESSION['user'] = $_POST['username'];
        }
        $_SESSION['userToEdit'] = $_POST['username'];
        if ($previousScreen == 'personalAccount') {
            header('Location: personalAccount.php');
        }
        if ($previousScreen == 'userManagement') {
            header('Location: managementUserScreen.php');
        }
    }
} elseif ($keepPassword && $saveInfo) {
    $success = OceanDB::getInstance()->update_user($userEdit, $_POST['role'], $_POST['username'], $userInfo['PASSWORD'], $_POST['personProfile']);
    if ($success) {
        if ($user == $userEdit) {
            $_SESSION['user'] = $_POST['username'];
        }
        $_SESSION['userToEdit'] = $_POST['username'];
        if ($previousScreen == 'personalAccount') {
            header('Location: personalAccount.php');
        }
        if ($previousScreen == 'userManagement') {
            header('Location: managementUserScreen.php');
        }
    }
}
?>
            
示例#16
0
 public function delete_subscription($sensorID, $user)
 {
     $person_id = OceanDB::getInstance()->get_person_id_by_name($user);
     $person_id_parse = oci_fetch_array($person_id, OCI_BOTH);
     $person_id = $person_id_parse["PERSON_ID"];
     $sql = "DELETE FROM sjpartri.SUBSCRIPTIONS WHERE " . "SENSOR_ID = {$sensorID} " . "AND PERSON_ID = {$person_id} ";
     $objParse = oci_parse($this->con, $sql);
     oci_execute($objParse);
     return $objParse;
 }