コード例 #1
0
 * 
 * Inputs: SID - Session ID of client
 * 
 * Author: Justin Fraser
 *
 ****************************************************/
include "IMSSql.php";
include "IMSLog.php";
include "IMSBase.php";
$statusArray = "";
$dataArray = "";
$sessionID = "";
$statusCode = 0;
try {
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
    }
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'CheckThresholds Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
コード例 #2
0
 ***********************************************************************/
include "IMSBase.php";
include "IMSLog.php";
include "IMSSql.php";
$sessionID = "";
$logLevel = "";
$statusMessage = "";
$statusCode = "";
$runLevel = "";
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $logLevel = $_POST["LogLevel"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'RetrieveLog Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'RetrieveLog Warning: Log_File_Location Option missing or invalid.');
コード例 #3
0
include "IMSSql.php";
$sessionID = "";
$partNumber = "";
$field = "";
$value = "";
$statusMessage = "";
$statusCode = "";
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $partNumber = $_POST["PartNumber"];
        $field = $_POST["Field"];
        $value = $_POST["Value"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'ModifyItem Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'ModifyItem Warning: Log_File_Location Option missing or invalid.');
コード例 #4
0
include "IMSBase.php";
include "IMSLog.php";
include "IMSSql.php";
$sessionID = "";
$emailAddress = "";
$dataArray = NULL;
$statusMessage = "";
$statusCode = "";
$runLevel = "";
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $emailAddress = $_POST["Email"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'AddEmailAddress Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'AddEmailAddress Warning: Log_File_Location Option missing or invalid.');
コード例 #5
0
<?php

include "Back_End/IMSLog.php";
include "Back_End/IMSSql.php";
$ipaddress = "";
$date = "";
$message = "";
$SID = "";
$key = "";
$timeout = 3600;
//default is 1 hour (3600 seconds)
try {
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log("UNKNOWN", 'Warning', 'Default Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    //Get Credential Time out Option
    $opt_timeout = $sql->getOption('Credential_Expiry_Time_Seconds');
    $log->add_log("UNKNOWN", 'Warning', "Default Warning: {$opt_timeout}");
    if ($opt_timeout === false) {
        $log->add_log("UNKNOWN", 'Warning', 'Default Warning: Credential_Expiry_Time_Seconds Option missing or invalid.');
    } else {
コード例 #6
0
$sessionID = "";
$statusMessage = "";
$statusCode = 0;
$runLevel = "";
$supplierNumber = "";
$itemLink = "";
$quantity = "";
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $supplierNumber = $_POST["SN"];
        $itemLink = $_POST["IL"];
        $quantity = $_POST["QN"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    $IMSBase->verifyData($supplierNumber, "/^.+\$/", "Supplier Number");
    if ($itemLink == "") {
        $itemLink = "Unknown";
    }
    if ($quantity = "") {
        $quantity = 0;
    }
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'AddPurchaseListItem Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
コード例 #7
0
include "IMSBase.php";
include "IMSLog.php";
include "IMSSql.php";
$sessionID = "";
$filter = "";
$statusMessage = "";
$statusCode = "";
$runLevel = "";
$suggestionArray = NULL;
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $filter = $_POST["Filter"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'QueryAutocomplete Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'QueryAutocomplete Warning: Log_File_Location Option missing or invalid.');
コード例 #8
0
 *  			password: 	SQL server password
 *  			DB: 		DB to connect to (most likely will be "Master")
 *  
 *	Date: 26 March 2016
 ***********************************************************************/
header('content-type: text/plain;charset=UTF-8');
include "IMSLog.php";
include "IMSBase.php";
$statusMessage = '';
$statusCode = 0;
$sessionID = '';
$dataArray = '';
$query = array("USE Master", "CREATE DATABASE IMS", "CREATE TABLE [IMS].[dbo].[Class_Data] (\n\t\t\t\tId int NOT NULL PRIMARY KEY IDENTITY (1,1),\n\t\t\t\tClass varchar(50) NOT NULL,\n\t\t\t\tPart varchar(50) NOT NULL,\n\t\t\t\tQuantity int NOT NULL,\n\t\t\t\tDate date NOT NULL)", "CREATE TABLE [IMS].[dbo].[Emails] (\n\t\t\t\tId int NOT NULL PRIMARY KEY IDENTITY (1,1),\n\t\t\t\tRecipients varchar(MAX) NOT NULL,\n\t\t\t\tEmail varchar(MAX) NOT NULL)", "CREATE TABLE [IMS].[dbo].[Inventory] (\n\t\t\t\tId int NOT NULL IDENTITY (1,1),\n\t\t\t\tName varchar(50) NOT NULL PRIMARY KEY DEFAULT 'Empty',\n\t\t\t\tSupplier_Part_Number varchar(50) NOT NULL DEFAULT 'Empty',\n\t\t\t\tQuantity int NOT NULL DEFAULT 0,\n\t\t\t\tDescription varchar(MAX) NOT NULL DEFAULT 'Empty',\n\t\t\t\tLocation varchar(50) NOT NULL DEFAULT 'Empty',\n\t\t\t\tType varchar(50) NOT NULL DEFAULT 'Empty',\n\t\t\t\tOrdering_Threshold int NOT NULL DEFAULT 0,\n\t\t\t\tValue varchar(50) NOT NULL DEFAULT 'Empty',\n\t\t\t\tSuppliers_Name varchar(50) NOT NULL DEFAULT 'Empty',\n\t\t\t\tItem_Link varchar(MAX) NOT NULL DEFAULT 'Empty',\n\t\t\t\tConsumable_Flag bit NOT NULL DEFAULT 0,\n\t\t\t\tEquipment_Flag bit NOT NULL DEFAULT 0,\n\t\t\t\tLab_Part_Flag bit NOT NULL DEFAULT 0,\n\t\t\t\tThreshold_Reported bit NOT NULL DEFAULT 0,\n\t\t\t\tLab_Quantity int NOT NULL DEFAULT 0)", "CREATE TABLE [IMS].[dbo].[Options] (\n\t\t\t\t[Option] varchar(50) NOT NULL PRIMARY KEY,\n\t\t\t\tValue varchar(MAX) NOT NULL)", "CREATE TABLE [IMS].[dbo].[Purchase_List] (\n\t\t\t\tSupplier_Part_Number varchar(50) NOT NULL PRIMARY KEY,\n\t\t\t\tItem_Link varchar(MAX) NOT NULL,\n\t\t\t\tQuantity int NOT NULL DEFAULT 0,\n\t\t\t\tThreshold_Reported bit NOT NULL DEFAULT 0)", "CREATE TABLE [IMS].[dbo].[SID_List] (\n\t\t\t\tID int NOT NULL IDENTITY (1,1),\n\t\t\t\tSID varchar(50) NOT NULL PRIMARY KEY,\n\t\t\t\tCLIENT_IP varchar(50) NOT NULL,\n\t\t\t\tEXPIRE datetime NOT NULL,\n\t\t\t\t[LEVEL] int NOT NULL)", "INSERT INTO [IMS].[dbo].[Options] ([Option], Value) VALUES \n\t\t('Automated_Backups_Enabled', 'False'),\n\t\t('Backup_Frequency', '10'),\n\t\t('Credential_Expiry_Time_Seconds', '3500'),\n\t\t('Debug', 'True'),\n\t\t('Email_fromEmail', '*****@*****.**'),\n\t\t('Email_fromName', 'Your Name'),\n\t\t('Email_Pass', 'Email server password'),\n\t\t('Email_Server', 'smtp.usask.ca'),\n\t\t('Email_User', 'Email server login'),\n\t\t('Log_File_Location', 'C:\\inetpub\\wwwroot\\Back_End\\log\\'),\n\t\t('Remote_Server_Enabled', 'True'),\n\t\t('Thresholds_Enabled', 'True')", "USE [IMS]", "CREATE USER [guest] WITHOUT LOGIN WITH DEFAULT SCHEMA=[dbo]", "GRANT CONNECT to guest", "GRANT DELETE to guest", "GRANT EXECUTE to guest", "GRANT INSERT to guest", "GRANT SELECT to guest", "GRANT UPDATE to guest", "CREATE USER [IMSBackup] WITHOUT LOGIN WITH DEFAULT SCHEMA=[dbo]", "EXEC db_addrolemember 'db_backupoperator', 'IMSBackup'", "EXEC db_addrolemember 'db_denydatareader', 'IMSBackup'", "EXEC db_addrolemember 'db_denydatawriter', 'IMSBackup'");
try {
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $server = $_POST["server"];
        $login = $_POST["login"];
        $password = $_POST["password"];
        $DB = $_POST["DB"];
    }
    $conn = sqlsrv_connect($server, array('UID' => $login, 'PWD' => $password, 'Database' => $DB, 'CharacterSet' => 'UTF-8'));
    if (!$conn) {
        print_r(sqlsrv_errors());
        exit;
    }
    sqlsrv_configure("WarningsReturnAsErrors", 0);
    foreach ($query as $current) {
        if ($stmt = sqlsrv_query($conn, $current)) {
            do {
コード例 #9
0
 *	Usage: GeneratePurcahseReport.php?SID=<session ID>&type=<manual or blank>
 ***********************************************************************/
include "IMSBase.php";
include "IMSLog.php";
include "IMSSql.php";
$sessionID = "";
$statusMessage = "";
$statusCode = 0;
$tableType = "";
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $tableType = $_POST["type"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'GeneratePurchaseReport Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'GeneratePurchaseReport Warning: Log_File_Location Option missing or invalid.');
コード例 #10
0
include "IMSBase.php";
include "IMSLog.php";
include "IMSSql.php";
$sessionID = "";
$partNumber = "";
$statusMessage = "";
$statusCode = "";
$runLevel = "";
$partNumberChange = NULL;
try {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $sessionID = $_POST["SID"];
        $partNumber = $_POST["PartNumber"];
    }
    $IMSBase = new IMSBase();
    $log = new IMSLog();
    $sql = new IMSSql();
    //Set IMSLog options
    $opt_debugLog = $sql->getOption('Debug');
    if ($opt_debugLog === false) {
        $log->add_log($sessionID, 'Warning', 'CreateNewItem Warning: Debug Option missing or invalid.');
    } else {
        if ($opt_debugLog == 'False') {
            $log->opt_debug = false;
        } else {
            $log->opt_debug = true;
        }
    }
    $opt_logLoc = $sql->getOption('Log_File_Location');
    if ($opt_logLoc === false) {
        $log->add_log($sessionID, 'Warning', 'CreateNewItem Warning: Log_File_Location Option missing or invalid.');