Esempio n. 1
0
 function authenticateUser()
 {
     include "adb.php";
     $user_email = $_REQUEST['usermail'];
     $user_pass = $_REQUEST['userpass'];
     $obj = new adb();
     $sql_users = "select * from users where email='{$user_email}'\n\tand password='******'";
     if ($obj->query($sql_users)) {
         $dataset = $obj->fetch();
         if (empty($dataset['email']) or empty($dataset['password'])) {
             echo '{"result":2}';
         } else {
             echo '{"result":1}';
         }
     }
 }
Esempio n. 2
0
function signUp()
{
    $fn = $_REQUEST['fn'];
    $email = $_REQUEST['email'];
    $phone = $_REQUEST['phone'];
    $occupation = $_REQUEST['occupation'];
    $workplace = $_REQUEST['workplace'];
    $nationality = $_REQUEST['nationality'];
    $_SESSION['email'] = $email;
    $myadb = new adb();
    $str_sql = "INSERT INTO attendance (email, fn, phone, occupation, workplace, nationality) values ('{$email}', '{$fn}', '{$phone}', '{$occupation}', '{$workplace}', '{$nationality}')";
    if (!$myadb->query($str_sql)) {
        echo '{"result": 0, "message": "Could not signUp"}';
        return;
    }
    echo '{"result": 1, "message": "SigUp was successful"}';
    return;
}
Esempio n. 3
0
/**
* Bring up events data 
*/
function getEvents()
{
    include_once "adb.php";
    $eqp = new adb();
    $str_query = "select * from inven_products";
    if (!$eqp->query($str_query)) {
        echo '{"result": 0, "message": "No Events in database"}';
        return;
    }
    $data = array();
    $row = $eqp->fetch();
    while ($row) {
        $row_array['id'] = $row['id'];
        $row_array['owner'] = $row['product_id'];
        $row_array['name'] = $row['products'];
        $row_array['des'] = $row['quantity'];
        $row_array['contact'] = $row['price'];
        $row = $eqp->fetch();
        // 		//push the values in the array
        array_push($data, $row_array);
    }
    echo json_encode($data);
}
 function query_functions()
 {
     adb::adb();
 }
Esempio n. 5
0
 function Devotional()
 {
     adb::adb();
 }
Esempio n. 6
0
$student_major = $_REQUEST['student_major'];
$student_phone = $_REQUEST['student_phone'];
function generateRandomString($length = 10)
{
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMONPQRSTUVWXYZ';
    $charactersLength .= strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
$random_pass = generateRandomString(8);
echo "PASS: {$random_pass}";
/** PARTS OF THE MESSAGE ***/
$obj = new adb();
// check if ISSET
$str = "INSERT INTO `sms_messages` SET  `student_id`='{$student_id}',\n    `student_name`='{$student_name}', `student_gpa`='{$student_gpa}',\n    `student_major`='{$student_major}', `student_phone`='{$student_phone}'";
$result = $obj->query($str);
try {
    // Quick Send approach SMSGH quick send
    $messageResponse = $messagingApi->sendQuickMessage("CodeWreaker", $student_phone, "{$student_name} This is your login password {$random_pass}");
    if ($messageResponse instanceof MessageResponse) {
        echo "msg1: " . $messageResponse->getStatus() . "</br></br>";
    } elseif ($messageResponse instanceof HDpResponse) {
        echo "\nServer Response Status : " . $messageResponse->getStatus() . "</br></br>";
    }
    echo "</br>success done";
} catch (ExcepWon $ex) {
    echo $ex->getTraceAsString();
}
function see_all_holidays()
{
    $db = new adb();
    $db->connect();
    $sql = "SELECT h_id, h_name, DATE_FORMAT(h_date, '%d %b %Y') as h_dates\n        \t\tFROM lms_holidays\n        \t\tWHERE h_date >= CURDATE()\n        \t\tORDER BY h_date";
    $result = mysql_query($sql);
    //run the query
    if ($result === FALSE) {
        die(mysql_error());
        // TODO: better error handling
    }
    if (mysql_num_rows($result) > 0) {
        echo "<table class='table table-striped'>";
        echo "<thead><tr>";
        echo "<th>HOLIDAY</th>";
        echo "<th>DATE</th>";
        echo "</tr></thead>";
        echo "<tbody>";
        while ($row = mysql_fetch_array($result)) {
            echo "<tr>";
            echo "<td>" . $row['h_name'] . "</td>";
            echo "<td>" . $row['h_dates'] . "</td>";
            echo "</tr>";
        }
        echo "</tbody>\n\t\t\t</table>";
        mysql_free_result($result);
    } else {
        echo "<center><div align='center' class='alert alert-danger' role='alert'>\n        \t<i class='glyphicon glyphicon-alert'></i><b>No Holidays Recorded In The System</b></div></center>";
    }
}
						<span style = 'padding:1%' class="menuitem1" ><a href='index.php' style="text-decoration:none;color:#42433c">View tasks</a></span>
						<span style = 'padding:1%' class="menuitem1" ><a href='addTask.php'style="text-decoration:none;color:#42433c">Add task</a></span>
						<span style='float:right' ><input  type="text" placeholder = "Search" id="txtSearch" />
						<span><input type="submit" name="button" value="Go"></span>		
						</span>		
					</div>
					<div id="divStatus" class="status">
						status message
					</div>
					<div id="divContent">
						Content space
						<span class="clickspot">click here </span>
				
						<?php 
include 'adb.php';
$obj = new adb();
$obj->connect();
$select_query = "Select * from task,nurse where task.nurse_id = nurse.nurse_id";
$obj->query($select_query);
echo "<table border='1' id='tableExample' class='reportTable' width='100%'>";
echo "<tr style = 'Background-color:#066d5d' class='header'>";
echo "<td>Task id</td>";
echo "<td>Task name</td>";
echo "<td>Due date</td>";
echo "<td>Description</td>";
echo "<td>Nurse</td>";
echo "<td></td>";
echo "<td></td>";
echo "</tr>";
$row = $obj->fetch();
while ($row) {
Esempio n. 9
0
 function login()
 {
     adb::adb();
 }
Esempio n. 10
0
        if (!$this->connect()) {
            return false;
        }
        $this->result = mysql_query($str_sql);
        if (!$this->result) {
            $this->log_error(LOG_LEVEL_DB_FAIL, 4, "query failed", mysql_error($this->link));
            return false;
        }
        return true;
    }
    /**
     * returns number of rows in current dataset
     */
    function get_num_rows()
    {
        return mysql_num_rows($this->result);
    }
    /**
     *returns last auto generated id 
     */
    function get_insert_id()
    {
        return mysql_insert_id($this->link);
    }
}
$obj = new adb();
if ($obj->connect()) {
    //echo "connected";
} else {
    echo "not connected";
}
function login()
{
    $username = trim(htmlentities($_REQUEST["username"]));
    $password = trim(htmlentities($_REQUEST["password"]));
    $pass = md5($password);
    $salt = md5("datamanagement");
    $pepper = "ikyhtgtbhfdsfsqwnk";
    $thePass = $salt . $pass . $pepper;
    $db = new adb();
    $db->connect();
    $query = "SELECT * FROM ge_users \n\t\t\t\t\tINNER JOIN ge_departments ON (ge_users.u_department = ge_departments.d_id)\n\t\t\t\t\tINNER JOIN ge_groups ON (ge_users.u_group = ge_groups.g_id)\n\t\t\t\t\tWHERE username='******' AND password=MD5('{$password}')";
    $result = mysql_query($query) or die(mysql_error());
    $num_rows = mysql_num_rows($result);
    $info = mysql_fetch_assoc($result);
    //echo "Got result";
    if ($result) {
        if ($num_rows > 0) {
            if ($info['u_group'] == 1) {
                $dep = $info['d_name'];
                $r_dep = str_replace(' ', '_', $dep);
                session_start();
                $_SESSION['login'] = "******";
                $_SESSION['u_id'] = $info["u_id"];
                $_SESSION['firstname'] = $info["firstname"];
                $_SESSION['lastname'] = $info["lastname"];
                $_SESSION['username'] = $info["username"];
                $_SESSION['u_group'] = $info["u_group"];
                $_SESSION['u_department'] = $info["u_department"];
                header("Location: 1_ce/");
            } else {
                if ($info['u_group'] == 2) {
                    $dep = $info['d_name'];
                    $r_dep = str_replace(' ', '_', $dep);
                    session_start();
                    $_SESSION['login'] = "******";
                    $_SESSION['u_id'] = $info["u_id"];
                    $_SESSION['firstname'] = $info["firstname"];
                    $_SESSION['lastname'] = $info["lastname"];
                    $_SESSION['username'] = $info["username"];
                    $_SESSION['u_group'] = $info["u_group"];
                    $_SESSION['u_department'] = $info["u_department"];
                    header("Location: 2_director/dep_" . $r_dep . "/");
                } else {
                    if ($info['u_group'] == 3) {
                        $dep = $info['d_name'];
                        $r_dep = str_replace(' ', '_', $dep);
                        session_start();
                        $_SESSION['login'] = "******";
                        $_SESSION['u_id'] = $info["u_id"];
                        $_SESSION['firstname'] = $info["firstname"];
                        $_SESSION['lastname'] = $info["lastname"];
                        $_SESSION['username'] = $info["username"];
                        $_SESSION['u_group'] = $info["u_group"];
                        $_SESSION['u_department'] = $info["u_department"];
                        header("Location: 3_manager/dep_" . $dep . "/");
                    } else {
                        if ($info['u_group'] == 4) {
                            $dep = $info['d_name'];
                            $r_dep = str_replace(' ', '_', $dep);
                            session_start();
                            $_SESSION['login'] = "******";
                            $_SESSION['u_id'] = $info["u_id"];
                            $_SESSION['firstname'] = $info["firstname"];
                            $_SESSION['lastname'] = $info["lastname"];
                            $_SESSION['username'] = $info["username"];
                            $_SESSION['u_group'] = $info["u_group"];
                            $_SESSION['u_department'] = $info["u_department"];
                            header("Location: 4_regular/dep_" . $r_dep . "/");
                        }
                    }
                }
            }
        } else {
            ?>
				<script>
					alert("Invalid Username or Password!");
			      	window.history.back();
				</script>
				<?php 
            // $msg="username or password is incorrect";
        }
    } else {
        ?>
				<script>
					alert("Invalid Username or Password");
			      window.history.back();
				</script>
				<?php 
    }
}