Various reformats. Changed boolean variables from 1/0 to TRUE/FALSE in multiple files.
This commit is contained in:
@@ -11,39 +11,39 @@ include("functions.php");
|
||||
|
||||
|
||||
if (!isset($_SESSION['login'])) {
|
||||
header ("Location: login.php");
|
||||
header("Location: login.php");
|
||||
}
|
||||
|
||||
$loggedinas=$_SESSION['login'];
|
||||
$isadmin=dblookup($db,"techs","techid","admin",$loggedinas);
|
||||
$loggedinas = $_SESSION['login'];
|
||||
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
|
||||
|
||||
$print=$_REQUEST['print'] ?? NULL;
|
||||
$add=$_REQUEST['add'] ?? NULL;
|
||||
$edit=$_REQUEST['edit'] ?? NULL;
|
||||
$delete=$_REQUEST['delete'] ?? NULL;
|
||||
$print = $_REQUEST['print'] ?? NULL;
|
||||
$add = $_REQUEST['add'] ?? NULL;
|
||||
$edit = $_REQUEST['edit'] ?? NULL;
|
||||
$delete = $_REQUEST['delete'] ?? NULL;
|
||||
|
||||
$partid=$_REQUEST['partid'] ?? NULL;
|
||||
$uid=$_REQUEST['uid'] ?? NULL;
|
||||
$partnum=$_REQUEST['partnum'] ?? NULL;
|
||||
$sernum=$_REQUEST['sernum'] ?? NULL;
|
||||
$partname=$_REQUEST['partname'] ?? NULL;
|
||||
$submit=$_REQUEST['submit'] ?? NULL;
|
||||
$partid = $_REQUEST['partid'] ?? NULL;
|
||||
$uid = $_REQUEST['uid'] ?? NULL;
|
||||
$partnum = $_REQUEST['partnum'] ?? NULL;
|
||||
$sernum = $_REQUEST['sernum'] ?? NULL;
|
||||
$partname = $_REQUEST['partname'] ?? NULL;
|
||||
$submit = $_REQUEST['submit'] ?? NULL;
|
||||
|
||||
$logname=LOG_NAME;
|
||||
$uidtext=UID_TEXT;
|
||||
$logname = LOG_NAME;
|
||||
$uidtext = UID_TEXT;
|
||||
|
||||
if ($print) {
|
||||
$sbcolor=P_SIDEBAR_COLOR;
|
||||
$mbgcolor=P_MENUBG_COLOR;
|
||||
$sbcolor = P_SIDEBAR_COLOR;
|
||||
$mbgcolor = P_MENUBG_COLOR;
|
||||
} else {
|
||||
$sbcolor=SIDEBAR_COLOR;
|
||||
$mbgcolor=MENUBG_COLOR;
|
||||
$sbcolor = SIDEBAR_COLOR;
|
||||
$mbgcolor = MENUBG_COLOR;
|
||||
}
|
||||
if ($edit || $delete) {
|
||||
framework("begin","$logname","Part Edit",$print);
|
||||
framework("begin", "$logname", "Part Edit", $print);
|
||||
} else {
|
||||
$add=1;
|
||||
framework("begin","$logname","Part Entry",$print);
|
||||
$add = 1;
|
||||
framework("begin", "$logname", "Part Entry", $print);
|
||||
}
|
||||
|
||||
// ******** begin database manipulation ********
|
||||
@@ -53,11 +53,11 @@ if ($add) {
|
||||
if ($submit) {
|
||||
// add the entry if submit is pressed
|
||||
if ($uid || ($partnum && $sernum)) {
|
||||
$partexists=mysqli_num_rows(mysqli_query($db,"select partid from parts where uid=\"$uid\" or (partnum=\"$partnum\" and sernum=\"$sernum\")"));
|
||||
$partexists = mysqli_num_rows(mysqli_query($db, "select partid from parts where uid=\"$uid\" or (partnum=\"$partnum\" and sernum=\"$sernum\")"));
|
||||
if (! $partexists) {
|
||||
// add to parts table
|
||||
mysqli_query($db,"insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
||||
$partid=mysqli_insert_id($db);
|
||||
mysqli_query($db, "insert into parts(uid,partnum,sernum,partname) values(\"$uid\",\"$partnum\",\"$sernum\",\"$partname\")");
|
||||
$partid = mysqli_insert_id($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,18 +66,18 @@ if ($edit) {
|
||||
if ($submit) {
|
||||
if ($uid || ($partnum && $sernum)) {
|
||||
// update parts table
|
||||
mysqli_query($db,"update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$partid\"");
|
||||
mysqli_query($db, "update parts set uid=\"$uid\", partnum=\"$partnum\", sernum=\"$sernum\", partname=\"$partname\" where partid=\"$partid\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($delete) {
|
||||
// check for occurrence in logparts table
|
||||
$inlogparts=mysqli_num_rows(mysqli_query($db,"select logpartid from logparts where partid=\"$partid\""));
|
||||
$inlogparts = mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where partid=\"$partid\""));
|
||||
// check for occurrence in maintforms table
|
||||
$inmaintforms=mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mfpart=\"$partid\""));
|
||||
$inmaintforms = mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mfpart=\"$partid\""));
|
||||
// delete from parts table
|
||||
if(!$inlogparts && !$inmaintforms) {
|
||||
mysqli_query($db,"delete from parts where partid=\"$partid\"");
|
||||
if (!$inlogparts && !$inmaintforms) {
|
||||
mysqli_query($db, "delete from parts where partid=\"$partid\"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,24 +85,24 @@ if ($delete) {
|
||||
|
||||
pagetable("begin");
|
||||
if (!$print) {
|
||||
pageblock("left","begin");
|
||||
pageblock("left", "begin");
|
||||
sidemenu();
|
||||
pageblock("left","end");
|
||||
pageblock("left", "end");
|
||||
}
|
||||
pageblock("right","begin");
|
||||
pageblock("right", "begin");
|
||||
banner($print);
|
||||
// display the form
|
||||
$partdatainput=array();
|
||||
$partdatainput['partid']=$partid;
|
||||
$partinfo=get_part_data($partdatainput);
|
||||
if ($partinfo['result']==2) {
|
||||
$pdatamismatch=TRUE;
|
||||
$partdatainput = array();
|
||||
$partdatainput['partid'] = $partid;
|
||||
$partinfo = get_part_data($partdatainput);
|
||||
if ($partinfo['result'] == 2) {
|
||||
$pdatamismatch = TRUE;
|
||||
} else {
|
||||
$pdatamismatch=FALSE;
|
||||
$uid = (array_key_exists('uid',$partinfo)) ? $partinfo['uid'] : NULL;
|
||||
$partnum = (array_key_exists('partnum',$partinfo)) ? $partinfo['partnum'] : NULL;
|
||||
$sernum = (array_key_exists('sernum',$partinfo)) ? $partinfo['sernum'] : NULL;
|
||||
$partname = (array_key_exists('partname',$partinfo)) ? $partinfo['partname'] : NULL;
|
||||
$pdatamismatch = FALSE;
|
||||
$uid = (array_key_exists('uid', $partinfo)) ? $partinfo['uid'] : NULL;
|
||||
$partnum = (array_key_exists('partnum', $partinfo)) ? $partinfo['partnum'] : NULL;
|
||||
$sernum = (array_key_exists('sernum', $partinfo)) ? $partinfo['sernum'] : NULL;
|
||||
$partname = (array_key_exists('partname', $partinfo)) ? $partinfo['partname'] : NULL;
|
||||
}
|
||||
if ($delete) {
|
||||
if ($inmaintforms) {
|
||||
@@ -168,9 +168,7 @@ echo "
|
||||
</form>
|
||||
";
|
||||
banner($print);
|
||||
pageblock("right","end");
|
||||
pageblock("right", "end");
|
||||
pagetable("end");
|
||||
|
||||
framework("end","","",$print);
|
||||
|
||||
?>
|
||||
framework("end", "", "", $print);
|
||||
|
||||
Reference in New Issue
Block a user