session_start(); $_SESSION['type'] = $_GET['type']; $db = new DatabaseConnection(); $db->createConnection(); $dropdownArray = array(); $AttributeComaparison = array(); $dropdownResultArray = array(); $inputType = array(); $columnArray = array(); $aListCode = array(); $checkbox = true; $search = true; $isSearchable = ""; //Query to List all the Attributes of the Selected Category. Selected Category is in Session $dropdownArrayListCodeQuery = "Select distinct AttributeCode,DataType,Attributes\n\t\t\t\t\t\t\tfrom Attributes, ArtefactType\n\t\t\t\t\t\t\twhere Attributes.ArtefactTypeCode = ArtefactType.ArtefactTypeCode \n\t\t\t\t\t\t\tand\n\t\t\t\t\t\t\t{$isSearchable}\n\t\t\t\t\t\t\tArtefactType.ArtefactTypeCode = '{$_SESSION['type']}';"; $dropdownArrayListCode = $db->setQuery($dropdownArrayListCodeQuery); if ($dropdownArrayListCode->num_rows > 0) { while ($row = $dropdownArrayListCode->fetch_assoc()) { $dropdownArray[] = $row['AttributeCode']; $columnArray[] = $row['Attributes']; if ($row['DataType'] == 'varchar') { $inputType[] = 'text'; } else { if ($row['DataType'] == 'Int') { $inputType[] = 'text'; //$numberPattern[$numberCount++]="pattern='^[0-9]{1,20}'"; } else { if ($row['DataType'] == 'date') { $inputType[] = 'date'; } else { $inputType[] = 'text';
$endDate = $_GET['endDate']; $type = $_GET['type']; $code = $_GET['code']; session_start(); include '../common/DatabaseConnection.php'; $currentdateq = date('Y-m-d', strtotime($currentdate)); $endDateq = date('Y-m-d', strtotime($endDate)); $location = $_SESSION['userLoc']; $userPK = $_SESSION['userPK']; $db = new DatabaseConnection(); $conn = $db->createConnection(); /* * Query if data already exista in maintainance cycle * if exists update * else * insert * */ $q; $message = ''; $res1; $q = "INSERT INTO maintenancecycle\r\n\t\t \t\t\tVALUES\r\n\t\t \t\t\t(NULL,\r\n\t\t\t \t\t\t'{$location}',\r\n\t\t\t \t\t\t'{$type}',\r\n\t\t\t \t\t\t'{$code}',\r\n\t\t\t \t\t\t'{$currentdateq}',\r\n\t\t\t \t\t\t'0',\r\n\t\t\t \t\t\t'NULL',\r\n\t\t\t \t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t'{$userPK}',\r\n\t\t\t \t\t\t'{$currentdateq}',\r\n\t\t\t \t\t\t'{$userPK}',\r\n\t\t\t \t\t\t'{$currentdateq}'\r\n\t\t \t\t\t)"; $maintainResult = $db->setQuery($q); $latRecordId = $conn->insert_id; $sql = "INSERT INTO scheduledmaintenance\r\n\t\t \t\t\t\t(ScheduleMaintenancePK,\r\n\t\t\t \t\t\t\tMaintenanceCycleFK,\r\n\t\t\t \t\t\t\tArtefactTypeCode,\r\n\t\t\t \t\t\t\tArtefactCode,\r\n\t\t\t \t\t\t\tLocationFK,\r\n\t\t\t \t\t\t\tScheduledServiceDate,\r\n\t\t\t \t\t\t\tCurrentStatus,\r\n\t\t\t \t\t\t\tCreatedDate,\r\n\t\t\t \t\t\t\tCreatedBy,\r\n\t\t\t \t\t\t\tModifiedDate,\r\n\t\t\t \t\t\t\tModifiedBy\r\n\t\t \t\t\t\t) VALUES\r\n\t\t \t\t\t\t(\tNULL,\r\n\t\t\t \t\t\t\t'{$latRecordId}',\r\n\t\t\t \t\t\t\t'{$type}',\r\n\t\t\t \t\t\t\t'{$code}',\r\n\t\t\t \t\t\t\t'{$location}',\r\n\t\t\t \t\t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t\t'Pending',\r\n\t\t\t \t\t\t\tCURRENT_TIMESTAMP,\r\n\t\t\t \t\t\t\t'{$userPK}',\r\n\t\t\t \t\t\t\t'{$currentdate}',\r\n\t\t\t \t\t\t\t'{$userPK}'\r\n\t\t \t\t\t\t)"; $res1 = $db->setQuery($sql); if ($maintainResult) { $message .= "Succesfully Updated"; } else { $message .= $q; } echo $message;
<?php session_start(); include '../common/DatabaseConnection.php'; $db = new DatabaseConnection(); $db->createConnection(); $id = $_GET['id']; $sql = "select * from user where rolefk = '{$id}'"; $result = $db->setQuery($sql); if ($result->num_rows > 0) { echo "Failed to Delete"; } else { $sql2 = "delete from role_page_mapping where RoleFk='{$id}'"; $sql1 = "DELETE FROM role WHERE RolePk='{$id}'"; if ($db->setQuery($sql2)) { if ($db->setQuery($sql1)) { echo 'success'; } } }
<?php include_once '../common/DatabaseConnection.php'; session_start(); $itemName = $_GET['ItemName']; $level = $_GET['level']; $parentNode = $_GET['parentNode']; $columnLength = sizeof($_SESSION['ColumnArray']); //create Connection $db = new DatabaseConnection(); $conn = $db->createConnection(); //Get the max artefactPK $artefactPK = 0; $artefactPKfromNameQuery = 'Select artefactCode,(artefactPK*1) as artefactPK from artefact;'; $result = $db->setQuery($artefactPKfromNameQuery); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $artefactPK = $row['artefactPK']; } } //$artefactPK++; //Getting ArtefactCode of the parent $artefactCode = 0; $artefactCodefromNameQuery = 'Select artefactCode from artefact where artefactName=\'' . $parentNode . '\';'; $result = $db->setQuery($artefactCodefromNameQuery); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $artefactCode = $row['artefactCode']; } } $artefactPK = $db->getMax();
define("PAGENAME", "Home"); session_start(); include '../common/Config.php'; include '../common/DatabaseConnection.php'; if (!isset($_SESSION['artefactUser'])) { header("Location: ../../index.php"); } $user = $_SESSION['artefactUser']; $obj = new DatabaseConnection(); $conn = $obj->createConnection(); $fullName = ""; $location = ""; $locationFK = ""; $userPK = ''; $userRole = ''; $user1 = $obj->setQuery("select u.FirstName,u.LastName,u.UserPk,u.RoleFk,u.LocationFK,l.Description from user u inner join archivelocation l on u.LocationFk = l.LocationPk where u.AbhyasiID = '{$user}'"); if ($user1->num_rows == 1) { while ($row = $user1->fetch_assoc()) { $fullName = $row['FirstName'] . " " . $row['LastName']; $location = $row['Description']; $locationFK = $row['LocationFK']; $userPK = $row['UserPk']; $userRole = $row['RoleFk']; } $_SESSION['userLoc'] = $locationFK; $_SESSION['userPK'] = $userPK; $_SESSION['userRole'] = $userRole; $_SESSION['userLocationDesc'] = $location; $_SESSION['fullName'] = $fullName; } //echo $locationFK;
<?php include "../common/DatabaseConnection.php"; $db = new DatabaseConnection(); $db->createConnection(); $user = $_GET['userpk']; $sql = "update user set ActiveStatus='off' where userpk='{$user}'"; if ($db->setQuery($sql)) { echo "success"; } else { echo "fail"; }
$type = $_GET['type']; //Query to Check wheather to update a old record or new Record by checking the datas $attributeValuePK = array(); $user = $_SESSION['userPK']; //argument /** * http://localhost:81/final/SaveAttributes.php? * * dataArray=North%20American%20gathering,NULL,10,1986,Italian,120,NULL,People%20may%20say,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL& * artefactCode=8783& * artefactName=NVHN-1986-007-1-1& * type=VHS * * */ $artefactDatasQuery = "Select * from attributevalue where artefactCode='{$artefactCode}' and artefactTypeCode='{$type}';"; $resultData = $db->setQuery($artefactDatasQuery); //echo $artefactDatasQuery; //$resultData->num_rows==0. if there is no data so insert else update if ($resultData->num_rows > 0) { //Query to fetch a attributeValuePK to update data $attributeValuePKQuery = "Select attributeValuePK,AttributeCode from attributevalue where artefactCode='{$artefactCode}';"; //echo $attributeValuePKQuery; $attributeCode = array(); $resultSelect = $db->setQuery($attributeValuePKQuery); if ($resultSelect->num_rows > 0) { while ($rowData = $resultSelect->fetch_assoc()) { $attributeValuePK[] = $rowData['attributeValuePK']; $attributeCode[] = $rowData['AttributeCode']; } } //Query to update data
include_once '../common/DatabaseConnection.php'; session_start(); $artefactName = $_GET['artefactName']; $level = $_GET['level']; $db = new DatabaseConnection(); $conn = $db->createConnection(); //Query to get Max of artefactPK... $artefactPK = 0; $artefactCode = 0; $maxartefactQuery = "Select max(artefactPK) as MaxPK,max(artefactCode*1) as MaxCode from artefact;"; $result = $db->setQuery($maxartefactQuery); if ($result->num_rows > 0) { while ($rows = $result->fetch_assoc()) { $artefactPK = $rows['MaxPK']; $artefactCode = $rows['MaxCode']; } } $artefactCode++; $artefactPK++; $artefactNameAddQuery = "insert into artefact (artefactPK,artefactCode,artefactName,artefactTypeCode,LevelNumber,CreatedDate,CreatedBy) values ({$artefactPK},{$artefactCode},'{$artefactName}','{$_SESSION['type']}',0,CURRENT_TIMESTAMP,'{$_SESSION['userPK']}');"; //echo $artefactNameAddQuery; $db = new DatabaseConnection(); $conn = $db->createConnection(); $result = $db->setQuery($artefactNameAddQuery); //$result1=$db->setQuery("call insertAttribute('$artefactCode','$_SESSION[type]')"); if ($result) { echo "Artefact Added. Now just click your Artefact from Tree and add their attributes"; } else { echo "Error in Query"; }
<?php include_once '../common/DatabaseConnection.php'; include 'mail.php'; require 'PHPMailerAutoload.php'; $db1 = new DatabaseConnection(); $db1->createConnection(); $res = wwwcopy("todayTask.php"); $sqlC = "select\n\t\t\t\ts.ScheduleMaintenancePK,\n\t\t\t\ts.ArtefactCode,\n\t\t\t\ta.ArtefactName,\n\t\t\t\ts.ScheduledServiceDate\n\t\t\t\tfrom scheduledmaintenance s\n\t\t\t\tinner join artefact a\n\t\t\t\ton s.ArtefactCode = a.ArtefactCode\n\t\t\t\twhere s.ScheduleMaintenancePK\n\t\t\t\tnot in (select ScheduleMaintenanceFK from tasklist)\n\t\t\t\tand s.ScheduledServiceDate <= current_date()\n\t\t\t\tand a.visiblestatus='on'"; $resu1 = $db1->setQuery($sqlC); if ($resu1->num_rows > 0) { $sql1 = "select FirstName,LastName,EmailId\n\t\t\t\t\tfrom user"; $resu1 = $db1->setQuery($sql1); if ($resu1->num_rows > 0) { while ($r = $resu1->fetch_assoc()) { $name = $r['FirstName'] . " " . $r['LastName']; $email = $r['EmailId']; $res1 = str_replace("{{user}}", $name, $res); echo sendMail($email, $res1); } } }
<div class='tile col-md-12'> <div class='col-md-12 border-low'> <div class="col-md-3 text-left heading-Bg"> <i class="fa fa-pencil-square-o fa-2x heading-Bg"></i> <span style="font-size: 22px;">Condition report</span><br> </div> <div class="col-md-9 form-group" style=""> <?php $query = "SELECT * FROM maintenancecycle where ArtefactCode ='{$artefactCode}'"; $result1 = $db->setQuery($query); if ($result1->num_rows > 0) { while ($rows = $result1->fetch_assoc()) { $scheduledMaintainancedate = $rows['NextServiceDate']; } } else { $scheduledMaintainancedate = ""; } echo "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-5 text-right marginT10'>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for='LocationDropdown'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLocation\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-7'>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t <select id='LocationList' class='selectDropdown form-control'>\n\t\t\t\t\t\t\t\t\t\t\t\t"; $query = "select LocationPk,Code,Description from ArchiveLocation;"; if ($result = $db->setQuery($query)) { echo "<option value=''> Select Location </option>"; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { ?> <option value='<?php
<?php include '../common/DatabaseConnection.php'; $db = new DatabaseConnection(); $db->createConnection(); $id = $_GET['id']; $rolesDetail = array(); $sql = "SELECT code,description FROM role WHERE RolePk = '{$id}'"; $res = $db->setQuery($sql); while ($row = $res->fetch_assoc()) { $rolesDetail[] = $row; } echo json_encode($rolesDetail);
<?php session_start(); $user = $_SESSION['userPK']; include '../common/DatabaseConnection.php'; $db = new DatabaseConnection(); $db->createConnection(); $role = $_GET['role']; $ids = explode(',', substr($_GET['permission'], 1)); if ($db->setQuery("delete from role_page_mapping where rolefk='{$role}'")) { $result; for ($i = 0; $i < sizeof($ids); $i++) { $sql = " INSERT INTO role_page_mapping\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(NULL,\n\t\t\t\t\t\t\t'{$role}',\n\t\t\t\t\t\t\t'{$ids[$i]}',\n\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\tCURRENT_TIMESTAMP)"; $result = $db->setQuery($sql); } if ($result) { echo "success"; } else { echo "fail"; } } else { echo "fail"; }
// Starting Session //include ''; include "../common/DatabaseConnection.php"; // Define $username and $password $username = $_POST['username']; $password = $_POST['password']; // Establishing Connection with Server by passing server_name, user_id and password as a parameter $obj = new DatabaseConnection(); $conn = $obj->createConnection(); // To protect MySQL injection for Security purpose $username = stripslashes($username); $password = stripslashes($password); //$username = mysql_real_escape_string($username); //$password = mysql_real_escape_string($password); // SQL query to fetch information of registerd users and finds user match. $query = $obj->setQuery("select * from user where abhyasiid='{$username}' AND password='******' AND login_attempts < 3 and ActiveStatus='on'"); $rows = $query->num_rows; if ($rows == 1) { $_SESSION['artefactUser'] = $username; header("location: ../dashboard/dashboard.php"); // Redirecting To Other Page } else { $data = $obj->setQuery("select * from user where abhyasiid='{$username}'"); $rows1 = $data->num_rows; //echo "inside".$rows1; if ($rows1 == 1) { $obj->setLoginAttempts($username); //echo "inside"; $num = $obj->getLoginAttempts($username); if ($num >= 3) { $obj->deactiveUser($username);
session_start(); include '../common/DatabaseConnection.php'; $params = array(); foreach ($_GET as $key => $value) { $params[$key] = $value; } $artefactCode = $params['artefactCode']; $scheduledKey = $params['scheduledKey']; $location = $_SESSION['userLoc']; $user = $_SESSION['userPK']; $currentDate = date('Y-m-d'); $db = new DatabaseConnection(); $conn = $db->createConnection(); $taskListQuery = "\n\t\t\t\tINSERT INTO tasklist\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(NULL,\n\t\t\t\t\t\t'{$artefactCode}',\n\t\t\t\t\t\t'{$scheduledKey}',\n\t\t\t\t\t\t'{$location}',\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t'{$currentDate}',\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\tCURRENT_TIMESTAMP)"; $taskResult = $db->setQuery($taskListQuery); $latRecordId = $conn->insert_id; $reportQuery; foreach ($params as $paramkey => $paramvalue) { if ($paramkey != 'artefactCode' || $paramkey != 'scheduledKey') { $reportQuery = "\n\t\t\t\t\t\t\tINSERT INTO conditionalreport\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'NULL',\n\t\t\t\t\t\t\t\t'{$paramkey}',\n\t\t\t\t\t\t\t\t'{$latRecordId}',\n\t\t\t\t\t\t\t\t'{$paramvalue}',\n\t\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\t\t'{$currentDate}',\n\t\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\t\t'{$currentDate}'\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\n\t\t\t\t"; $db->setQuery($reportQuery); } } $updateSMsql = "UPDATE scheduledmaintenance\n\t\t\t\tSET CurrentStatus = 'Completed'\n\t\t\t\tWHERE ScheduleMaintenancePK = {$scheduledKey}"; $db->setQuery($updateSMsql); if ($taskResult) { echo 'success'; } else { echo $reportQuery; }
id='userTable'> <thead> <tr class='' style="background-color: #8bc2cb;"> <th>AbhyasiID</th> <th>Location</th> <th>FirstName</th> <th>Lastname</th> <th>Email Id</th> <th>Role</th> <th>Action</th> </tr> </thead> <tbody> <?php $result = $db->setQuery("select l.description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tr.Description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.firstname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.lastname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.userpk,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.AbhyasiID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.EmailId ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.ActiveStatus\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom user u inner join archivelocation l \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton u.locationfk = l.locationpk\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join role r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton u.rolefk = r.rolepk;"); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $btntext = ""; if ($row['ActiveStatus'] == 'on') { $btntext = "De-active"; } else { $btntext = "Active"; } echo "<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['AbhyasiID'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['description'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['firstname'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['lastname'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['EmailId'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['Description'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td><input type='button' id='edit' class='btn btn-success editButton' name='" . $row['userpk'] . "' value='Edit' data-toggle='modal' data-target='#editModel' title='Click to Edit User Information'/> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='button' class='btn btn-danger deleteButton' id='delete' name='" . $row['userpk'] . "' value='" . $btntext . "' title='" . $btntext . " this user'/></td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t </tr>"; } } ?> </tbody> </table> </div>
<div class='tile col-md-12'> <div class='col-md-12 border-low'> <div class="col-md-3 text-left heading-Bg"> <i class="fa fa-pencil-square-o fa-2x heading-Bg"></i> <span style="font-size: 22px;">Conditional report</span><br> </div> <div class="col-md-9 form-group" style=""> <?php $query = "SELECT * FROM maintenancecycle where ArtefactCode ='{$artefactCode}'"; $result1 = $db->setQuery($query); if ($result1->num_rows > 0) { while ($rows = $result1->fetch_assoc()) { $scheduledMaintainancedate = $rows['NextServiceDate']; } } else { $scheduledMaintainancedate = ""; } echo "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-4'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-5 text-right marginT10'>\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for='LocationDropdown'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLocation\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-7'>\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t <select id='LocationList' class='selectDropdown form-control'>\r\n\t\t\t\t\t\t\t\t\t\t\t\t"; $query = "select LocationPk,Code,Description from ArchiveLocation;"; if ($result = $db->setQuery($query)) { echo "<option value=''> Select Location </option>"; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { ?> <option value='<?php
<?php //It delete the artefact in the table //it need to delete data from following table //Atribute value //Artefact //VHS->BOK-> //http://localhost:81/final/deleteArtefact.php?artefactType=BOK&artefactCode=109788 include '../common/DatabaseConnection.php'; $db = new DatabaseConnection(); $conn = $db->createConnection(); $type = $_GET['artefactType']; $code = $_GET['artefactCode']; //check for maintenance $sqlMQ = "SELECT count(MaintenanceCyclePK) as result FROM maintenancecycle where ArtefactCode='{$code}'"; $resMQ = $db->setQuery($sqlMQ); $c; if ($row = $resMQ->fetch_assoc()) { $c = $row['result']; } if ($c > 0) { echo "failed to delete parent"; } else { //delete from temp table $sql = "update " . $type . "attributes set visiblestatus='off' WHERE artefactCode = '{$code}'"; //delete from attribute value table //$sql1 = "update attributevalue WHERE artefactCode = '$code'"; //delete from artefact Table $sql2 = "update artefact set visiblestatus='off' WHERE artefactCode = '{$code}'"; $db->setQuery("SET SQL_SAFE_UPDATES=0"); if ($res = $db->setQuery($sql2)) {
<?php session_start(); include '../common/DatabaseConnection.php'; $params = array(); foreach ($_GET as $key => $value) { $params[$key] = $value; } $artefactCode = $params['artefactCode']; $scheduledKey = $params['scheduledKey']; $taskid = $params['taskid']; $location = $_SESSION['userLoc']; $user = $_SESSION['userPK']; $currentDate = date('Y-m-d'); $db = new DatabaseConnection(); $conn = $db->createConnection(); $result = ""; foreach ($params as $paramkey => $paramvalue) { if ($paramkey != 'artefactCode' || $paramkey != 'scheduledKey') { $updatequery = "UPDATE conditionalreport\n SET Result='{$paramvalue}'\n WHERE CheckListFK='{$paramkey}'\n AND TaskListFK='{$taskid}'"; $result = $db->setQuery($updatequery); } } $updateSMsql = "UPDATE scheduledmaintenance\n\t\t\t\tSET CurrentStatus = 'Completed'\n\t\t\t\tWHERE ScheduleMaintenancePK = {$scheduledKey}"; $db->setQuery($updateSMsql); if ($result) { echo 'success'; } else { echo $updatequery; } //print_r($params);
<?php include "../common/DatabaseConnection.php"; $db = new DatabaseConnection(); $db->createConnection(); $role = $_GET['role']; $res1 = " select p.PagePk from page p inner join\n\t\t\t\trole_page_mapping rm\n\t\t\t\ton p.pagepk = rm.pagefk\n\t\t\t\twhere rm.rolefk='{$role}'"; $res = $db->setQuery($res1); $pages = array(); if ($res->num_rows > 0) { while ($r = $res->fetch_assoc()) { $pages[] = $r['PagePk']; } } $res2 = $db->setQuery("select * from page where iscommon='n' or iscommon is null"); if ($res2->num_rows > 0) { ?> <form name='rolemapForm' id='rolemapForm'> <table class='table table-striped table-hover dataTable no-footer clearfix '> <thead> <tr> <th class='col-md-6'>Module</th> <th class='col-md-3'>Page</th> <th class='col-md-3'>Allow All <input type="checkbox" id='selectall' onclick="selectAll(this)"></th> </tr> </thead> <tbody> <?php while ($row = $res2->fetch_assoc()) { $checked = '';
<?php include '../common/DatabaseConnection.php'; $db = new DatabaseConnection(); $db->createConnection(); $oldName = $_GET['oldName']; $newName = $_GET['newName']; if ($db->setQuery("call RenameArtefact('{$oldName}','{$newName}')")) { echo "success"; } else { echo "fail"; }
<?php include_once 'DatabaseConnection.php'; $db = new DatabaseConnection(); $conn = $db->createConnection(); echo " <div class='col-md-12'>\r\n\t\t\t\t\t\t<div class='col-md-5'>\t<label id='typeLabel' for='categoryListinAdd' style='margin-top: 10px;'> Artefact Type </label></div>"; //Query to get ArtefactTypeCode and Description of Parent $query = "Select ArtefactTypeCode, ArtefactTypeDescription\r\n\t\tfrom ArtefactType\r\n\t\tWhere ArtefactTypePID is NULL;"; $result = $db->setQuery($query); if ($result->num_rows > 0) { echo "<div class='col-md-7'><select id='typeSelect' class='selectDropdown form-control' id='categoryListinAdd' onchange='getTree(this.value)'>"; echo "<option value=''> Select Artefact Type </option>"; while ($row = $result->fetch_assoc()) { echo "<option value=" . $row['ArtefactTypeCode'] . ">" . $row['ArtefactTypeDescription'] . "</option>"; } echo "</select></div>"; } else { echo "Sorry No Categories"; }
$result[] = $notifyDates[$i]; } } /* * Query if data already exista in maintainance cycle * if exists update * else * insert * */ $query; if ($maintainKey == 'NO') { $query = "select * from maintenancecycle where ArtefactTypeCode='{$artefactType}' and ArtefactCode='{$artefactCode}'"; } else { $query = "select * from maintenancecycle where ArtefactTypeCode='{$artefactType}' and ArtefactCode='{$artefactCode}' and MaintenanceCyclePK='{$maintainKey}'"; } $res = $db->setQuery($query); $rowCount = $res->num_rows; if ($rowCount > 0) { //update $deleteSMT = "delete from scheduledmaintenance where ArtefactCode='{$artefactCode}' and MaintenanceCycleFK='{$maintainKey}'"; $deleteMT = "delete from maintenancecycle where ArtefactCode='{$artefactCode}' and MaintenanceCyclePK='{$maintainKey}'"; if ($db->setQuery($deleteSMT)) { if ($db->setQuery($deleteMT)) { $q; $message = ''; $res1; $q = "INSERT INTO maintenancecycle\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(NULL,\n\t\t\t\t\t\t'{$location}',\n\t\t\t\t\t\t'{$artefactType}',\n\t\t\t\t\t\t'{$artefactCode}',\n\t\t\t\t\t\t'{$currentdate}',\n\t\t\t\t\t\t'{$freq}',\n\t\t\t\t\t\t'{$units}',\n\t\t\t\t\t\t'{$nextDate}',\n\t\t\t\t\t\t'{$lastDateModified}',\n\t\t\t\t\t\t'{$userPK}',\n\t\t\t\t\t\t'{$currentdate}',\n\t\t\t\t\t\t'{$userPK}',\n\t\t\t\t\t\t'{$currentdate}'\n\t\t\t\t\t\t)"; $maintainResult = $db->setQuery($q); $latRecordId = $conn->insert_id; for ($i = 0; $i < count($result); $i++) { $sql = "INSERT INTO scheduledmaintenance\n\t\t\t\t\t\t\t\t(\tScheduleMaintenancePK,\n\t\t\t\t\t\t\t\tMaintenanceCycleFK,\n\t\t\t\t\t\t\t\tArtefactTypeCode,\n\t\t\t\t\t\t\t\t\tArtefactCode,\n\t\t\t\t\t\t\t\t\tLocationFK,\n\t\t\t\t\t\t\t\t\tScheduledServiceDate,\n\t\t\t\t\t\t\t\t\tCurrentStatus,\n\t\t\t\t\t\t\t\t\tCreatedDate,\n\t\t\t\t\t\t\t\t\tCreatedBy,\n\t\t\t\t\t\t\t\t\tModifiedDate,\n\t\t\t\t\t\t\t\t\tModifiedBy\n\t\t\t\t\t\t\t\t\t) VALUES\n\t\t\t\t\t\t\t\t\t(\tNULL,\n\t\t\t\t\t\t\t\t\t'{$latRecordId}',\n\t\t\t\t\t\t\t\t\t'{$artefactType}',\n\t\t\t\t\t\t\t\t\t'{$artefactCode}',\n\t\t\t\t\t\t\t\t\t'{$location}',\n\t\t\t\t\t\t\t\t\t'{$result[$i]}',\n\t\t\t\t\t\t\t\t\t'Pending',\n\t\t\t\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t\t\t\t'{$userPK}',\n\t\t\t\t\t\t\t\t\t'{$currentdate}',\n\t\t\t\t\t\t\t\t\t'{$userPK}'\n\t\t\t\t\t\t\t\t\t)";
$_SESSION['type'] = $_GET['type']; if (isset($_GET['artefactCode'])) { $artefactCode = $_GET['artefactCode']; $_SESSION['seesionSelectedCode'] = $artefactCode; } if (isset($_GET['artefactTitle'])) { $artefactTitle = $_GET['artefactTitle']; } $_SESSION['seesionSelectedtype'] = $_GET['type']; $maintainFull = $_GET['full']; unset($_SESSION['maintainStatus']); $db = new DatabaseConnection(); $db->createConnection(); if ($maintainFull == 'NO') { $sql = "select * from maintenancecycle where ArtefactTypeCode='" . $_GET['type'] . "' and ArtefactCode='{$artefactCode}'"; $result = $db->setQuery($sql); ?> <div class='col-md-12 '> <span id='saveStatus' style='height: 200px; width: 100%; margin-top: 10%;'></span> </div> <div id='duration' class='duration col-md-12 marginT10 border-top'> <?php if (isset($result)) { if ($result->num_rows > 0) { //update $_SESSION['maintainStatus'] = 'update'; while ($row = $result->fetch_assoc()) {
<div class="col-md-12 text-left border-low heading-Bg"> <i class="fa fa-users fa-2x heading-Bg"></i> <span style="font-size: 22px;">Roles</span><br> </div> <div class='col-md-12 marginT20'> <table class='table table-hover dataTable no-footer clearfix' id='RoleTable'> <thead> <tr> <th class='col-md-6'>Role</th> <th class='col-md-3'>Action</th> </tr> </thead> <tbody> <?php $result = $db->setQuery("select * from role"); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { ?> <tr> <td class='col-md-6'><?php echo $row['Description']; ?> </td> <td class='col-md-3'><input type='button' value='Edit' class='btn btn-primary editRole' name="<?php echo $row['RolePk']; ?> "
if (isset($_SESSION['type'])) { $db = new DatabaseConnection(); $db->createConnection(); //print_r($attributeColumns); for ($i = 0; $i < sizeof($supportedType); $i++) { if ($_GET['type'] == $supportedType[$i]) { $isSupported = true; } } //Calling Procedure based on the Category to create a new Table //$temptable="call AttributeList('$_SESSION[type]')"; //$procedure=$db->setQuery($temptable); //Query to get temp table columns. temp table created via procedure and columns are hardcoded $tempTableColumnQuery = 'show columns from ' . $_SESSION['type'] . 'Attributes'; //echo $tempTableColumnQuery; $tempcolumns = $db->setQuery($tempTableColumnQuery); $tempTableColumnNames = array(); echo <<<endl endl; //Columns for the result // echo "<table id='datatable1' class='table table-hover dataTable no-footer clearfix'>"; // echo "<thead><tr role='row'>"; if (isset($tempcolumns->num_rows)) { if ($tempcolumns->num_rows > 0) { while ($row = $tempcolumns->fetch_assoc()) { $tempTableColumnNames[] = $row['Field']; } } } else { echo "No Columns for your Search"; }
<?php session_start(); // Starting Session include ''; include "../common/DatabaseConnection.php"; // Define $username and $password $username = $_POST['username']; $password = $_POST['password']; // Establishing Connection with Server by passing server_name, user_id and password as a parameter $obj = new DatabaseConnection(); $conn = $obj->createConnection(); // To protect MySQL injection for Security purpose $username = stripslashes($username); $password = stripslashes($password); //$username = mysql_real_escape_string($username); //$password = mysql_real_escape_string($password); // SQL query to fetch information of registerd users and finds user match. $query = $obj->setQuery("select * from user where abhyasiid='{$username}' AND password='******' and ActiveStatus='on'"); $rows = $query->num_rows; if ($rows == 1) { $_SESSION['artefactUser'] = $username; header("location: ../dashboard/dashboard.php"); // Redirecting To Other Page } else { //echo $query; header("location: ../../index.php?error=invalid"); } ?>
ini_set('max_execution_time', 30000); include_once 'DatabaseConnection.php'; $type = $_GET['type']; session_start(); $_SESSION['type'] = $type; $db = new DatabaseConnection(); $conn = $db->createConnection(); $parentArray = array(); //Associate Array with ArtefactCode and ArtefactPID //$single = array('Photos'); $NoChild = array(); //Query to Get Parent elements $parentQuery = "select artefactname,artefactcode from artefact\n\t\t\t\twhere artefactPID is null and artefactTypeCode='{$type}' and visiblestatus='on' order by CreatedDate DESC"; //echo $parentQuery; $result = $db->setQuery($parentQuery); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $parentArray[$row['artefactcode']] = $row['artefactname']; //echo '>>'.$row['artefactcode'].'>>'.$row['artefactname'].'</br>'; } } else { echo "Sorry No Data for this Artefact..."; } $childrenArray = array(); //Associate Array with ParentArtefactCode and array(Child: ArtefactCode and ArtefactName) //Query to Get Children $childChild = array(); //to store parent->child[This Name... Code is in associate array]->child foreach ($parentArray as $parentCode => $parentValue) { $childrenQuery = "select ArtefactCode,ArtefactName from Artefact where ArtefactPID=";
<?php /** * Created by PhpStorm. * User: poovarasan * Date: 22/8/15 * Time: 7:44 PM */ include "../common/DatabaseConnection.php"; $db = new DatabaseConnection(); $db->createConnection(); $id = $_GET['id']; $deleteSMT = "delete from scheduledmaintenance where MaintenanceCycleFK='{$id}'"; $deleteMT = "delete from maintenancecycle where MaintenanceCyclePK='{$id}'"; if ($db->setQuery($deleteSMT)) { if ($db->setQuery($deleteMT)) { echo "success"; } else { echo "fail"; } } else { echo "fail"; }