Example #1
0
 public function addUser(User $User)
 {
     $userid = $User->getUserid();
     $userpass = $User->getUserpassword();
     $email = $User->getEmail();
     $telnum = $User->getTelno();
     $firstname = $User->getFirstname();
     $lastname = $User->getLastname();
     $previlege = $User->getPrivilege();
     $add = mysql_query("insert into user (`UserId`, `UserPassword`, `emaill`, `TelNum`, `FirstName`, `LastName`, `Privilege_id`) values ('{$userid}','{$userpass}','{$email}','{$telnum}','{$firstname}','{$lastname}','{$previlege}')");
 }
Example #2
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      User $value A User object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(User $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getUserid();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #3
0
$User->setPassword($_POST["pass"]);
$User->setUsertoken(uniqid());
$User->setIpAddress($_POST["ipAddress"]);
$User->setMacAddress($_POST["macAddress"]);
$sql = "select * from User_Accounts where username= '******' and password = '******'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    echo "Access-Granted ";
    echo "userToken=";
    echo $User->getUsertoken();
    echo "!endOfToken ";
    //insert to userlogs
    $row = $result->fetch_row();
    $User->setUserid($row[0]);
    $User->setUsertype($row[5]);
    $sql = "INSERT INTO UserLogs (userid,ipAddress,macAddress,userToken,lastLogin) VALUES('" . $User->getUserid() . "','" . $User->getIpAddress() . "','" . $User->getMacAddress() . "','" . $User->getUsertoken() . "',NOW())";
    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
    //send to mdm
    $fields_string = '';
    $url = "http://{$ip}/phpprojects/MDMStore.php";
    $fields = array('uname' => urlencode($User->getUsername()), 'userid' => urlencode($User->getUserid()), 'userToken' => urlencode($User->getUsertoken()), 'userType' => urlencode($User->getUsertype()), 'macAddress' => urlencode($User->getMacAddress()), 'ipAddress' => urlencode($User->getIpAddress()));
    //url-ify the data for the POST
    foreach ($fields as $key => $value) {
        $fields_string .= $key . '=' . $value . '&';
    }
    rtrim($fields_string, '&');
    //open connection
Example #4
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require "MONITORINGDB.php";
set_include_path("./Bean");
spl_autoload_register();
require 'User.php';
$User = new User();
$User->setUsername($_POST["uname"]);
$User->setUsertoken($_POST["userToken"]);
$User->setIpAddress($_POST["ipAddress"]);
$User->setMacAddress($_POST["macAddress"]);
$User->setUsertype($_POST["userType"]);
$User->setUserid($_POST["userid"]);
$sql = "INSERT INTO MonitoringDeviceAccounts (userId,username,usertype,usertoken,ipAddress,macAddress)\nVALUES ('" . $User->getUserid() . "','" . $User->getUsername() . "','" . $User->getUsertype() . "','" . $User->getUsertoken() . "',\n            '" . $User->getIpAddress() . "','" . $User->getMacAddress() . "')";
if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
Example #5
0
$file_handle = fopen("MonitoringConfig.txt", "r");
while (!feof($file_handle)) {
    $line = fgets($file_handle);
    $ip = substr($line, 3);
    echo $ip;
}
fclose($file_handle);
$User = new User();
$fields_string = '';
$User->setUsername($_POST["uname"]);
$User->setUsertoken($_POST["userToken"]);
$User->setIpAddress($_POST["ipAddress"]);
$User->setMacAddress($_POST["macAddress"]);
$User->setUsertype($_POST["userType"]);
$User->setUserid($_POST["userid"]);
$sql = "INSERT INTO MobileDeviceAccounts (userId,username,usertype,usertoken,ipAddress,macAddress,lastActivityTime)\nVALUES ('" . $User->getUserid() . "','" . $User->getUsername() . "','" . $User->getUsertype() . "','" . $User->getUsertoken() . "',\n            '" . $User->getIpAddress() . "','" . $User->getMacAddress() . "','NOW()')";
if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$url = "http://{$ip}/phpprojects/MonitoringStore.php";
$fields = array('uname' => urlencode($User->getUsername()), 'userid' => urlencode($User->getUserid()), 'userToken' => urlencode($User->getUsertoken()), 'userType' => urlencode($User->getUsertype()), 'macAddress' => urlencode($User->getMacAddress()), 'ipAddress' => urlencode($User->getIpAddress()));
//url-ify the data for the POST
foreach ($fields as $key => $value) {
    $fields_string .= $key . '=' . $value . '&';
}
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data