if ($act == 'delete') { $sql = "DELETE FROM LOGSHEET WHERE ID = :ID"; $stmt = $conn->prepare($sql); $stmt->bindParam(':ID', $_POST['ID'], PDO::PARAM_INT); $stmt->execute(); header('location:../home.php?modules=logsheet'); } elseif ($act == 'addnew') { if (isset($submit) == "Submit") { try { $conn->insertArray("LOGSHEET", $formData); echo messageAlert("Logsheet Added"); echo "<meta http-equiv=refresh content=0;url=../home.php?modules=logsheet&act=addnew>"; } catch (PDOException $e) { echo messageAlert("Failed to get DB handle : " . $e->getMessage()); echo "<meta http-equiv=refresh content=0;url=../home.php?modules=logsheet&act=addnew>"; exit; } } } elseif ($act == 'edit') { if (isset($submit) == "Submit") { try { $conn->updateArray("LOGSHEET", "ID", $ID, $formData); echo messageAlert("Logsheet Updated"); echo "<meta http-equiv=refresh content=0;url=../home.php?modules=logsheet&periode=" . $_POST['periode'] . ">"; } catch (PDOException $e) { echo messageAlert("Failed to get DB handle : " . $e->getMessage()); echo "<meta http-equiv=refresh content=0;url=../home.php?modules=logsheet>"; exit; } } }
$stmt = $conn->prepare($query); $result = $stmt->execute($query_params); } catch (PDOException $ex) { die("Failed to run query: " . $ex->getMessage()); } $login_ok = false; $row = $stmt->fetch(); //print_r($row); if ($row) { $login_ok = true; } if ($login_ok) { //unset($row['SALT']); //unset($row['PASSWORD']); session_start(); $_SESSION['USERNAME'] = $row['USERNAME']; $_SESSION['PASSWORD'] = $row['PASSWORD']; $_SESSION['TYPE'] = $row['TYPE']; $_SESSION['DCCID'] = $row['DCCID']; $_SESSION['DESCR'] = $row['DESCR']; //header("Location: ../index.php"); //die("Redirecting to: secret.php"); header("Location:" . $_SERVER['HTTP_REFERER']); } else { echo messageAlert("Login Gagal, Username dan Password yang dimasukkan tidak sesuai"); echo "<meta http-equiv=refresh content=0;url=../index.php>"; //header("Location: ../index.php"); //print("Login Failed."); //$submitted_username = htmlentities($user, ENT_QUOTES, 'UTF-8'); } }