$json = array("op" => "OK", "data" => $paginate, "aLink" => $pUrl); echo json_encode($json); } //---------------MAKE POST if ($_GET['makePost'] == true) { $makePostID = $_GET['makePostID']; $postID = getPostID($makePostID); // get post id. if ($photoFileOP->setRquery("UPDATE amistiPost SET postPost=? WHERE userID=? AND postID=?", array(1, $_SESSION['userID'], $postID))) { $photoFileOP->setRquery("UPDATE amistiPost SET postTime=? WHERE userID=? AND postID=?", array(time(), $_SESSION['userID'], $postID)); $photoFileOP->setRquery("SELECT * FROM amistiFolder WHERE userID=? AND folderName=?", array($_SESSION['userID'], "postImages")); $album = $photoFileOP->getRquery(); if (count($album) > 0) { $photoFileOP->setRquery("UPDATE amistiPic SET folderID=? WHERE userID=? AND postID=?", array($album[0]['folderID'], $_SESSION['userID'], $postID)); $json = array("op" => "YES", "postID" => $postID); echo json_encode($json); } else { $fID = autoID(); $photoFileOP->setRquery("INSERT INTO amistiFolder VALUES(?,?,?,?,?)", array($fID, $_SESSION['userID'], "postImages", time(), 1)); $photoFileOP->setRquery("UPDATE amistiPic SET folderID=? WHERE userID=? AND postID=?", array($fID, $_SESSION['userID'], $postID)); $json = array("op" => "YES", "postID" => $postID); echo json_encode($json); } } else { $data = "<p> We do not have image ID <strong> " . $makePostID . "</strong> on our database.<br><strong>Operation terminated</strong></P>"; $json = array("op" => "NO", "postRes" => $data); } } ?>
function AutoID() { global $db; $querycount = "SELECT count(id_servis) as LastID FROM servis"; $result = $db->query($querycount) or die($db->error()); $row = $result->fetch_assoc(); return $row['LastID']; } function IdKredit($num) { $num = $num + 1; switch (strlen($num)) { case 1: $NoTrans = "S0000" . $num; break; case 2: $NoTrans = "S000" . $num; break; case 3: $NoTrans = "S00" . $num; break; case 4: $NoTrans = "S0" . $num; break; default: $NoTrans = $num; } return $NoTrans; } echo IdKredit(autoID());
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- CSS --> <script src="js/sweetalert-dev.js"></script> <link rel="stylesheet" href="css/sweetalert.css"> <link href="css/custom.css" type="text/css" rel="stylesheet"> </head> <body> <?php require_once "connect.php"; session_start(); require_once "functionsparepart.php"; $id_sparepart = IdKredit(autoID()); $nama_sparepart = $_POST['nama_sparepart']; $harga_sparepart = $_POST['harga_sparepart']; $query = "INSERT INTO sparepart VALUES ('{$id_sparepart}','{$nama_sparepart}','{$harga_sparepart}')"; if (mysqli_query($db, $query)) { echo "<script>\n swal({\n title: \"Sukses!\",\n text: \"Data Servis Berhasil Ditambah\",\n type: \"success\"\n },\n function () {\n window.location.href = 'menuservis.php';\n });\n </script>"; } else { echo "<script>\n swal({\n title: \"Gagal!\",\n text: \"Data Servis Gagal ditambah\",\n type: \"error\"\n },\n function () {\n window.location.href = 'menuservis.php';\n });\n </script>"; } mysqli_close($db); ?> </body> </html>
$json = array('op' => 'NO'); echo json_encode($json); } else { $fOp->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=? AND userID=? ", array($commID, $_SESSION['userID'])); $res = $fOp->getRquery(); if (count($res) > 0) { if ($fOp->setRquery("DELETE FROM amistiApprove WHERE userID=? AND approveItemID=?", array($_SESSION['userID'], $commID))) { $fOp->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=? ", array($commID)); $res = $fOp->getRquery(); $cc = count($res) == 0 ? "" : count($res); $res = "<a href=#>approve</a> " . $cc; $json = array('op' => 'OK', 'Msg' => $res); echo json_encode($json); } } else { if ($fOp->setRquery("INSERT INTO amistiApprove VALUES(?,?,?,?)", array(autoID(), $_SESSION['userID'], $commID, time()))) { $fOp->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=? ", array($commID)); $res = $fOp->getRquery(); $cc = count($res) == 0 ? "" : count($res); $res = "<a href=#>Approve</a> " . $cc; $json = array('op' => 'OK', 'Msg' => $res); echo json_encode($json); } } } } //GET POST APPROVE POPUP NAMES LITTLE if ($_GET['postAproveC'] == true) { $postApproveID = $_GET['postApproveID']; $realD; $fOp->setRquery("SELECT * FROM amistiPic WHERE picID=? OR postID=?", array($postApproveID, $postApproveID));
if (count($res[0]['email']) > 0) { echo 2; } else { echo 0; } } else { echo 1; } } if ($_GET['reg'] == 1) { $fName = $_GET['rfName']; $sName = $_GET['rsName']; $uName = $_GET['ruName']; $email = $_GET['remail']; $ppass = $_GET['rpass']; $uID = autoID(); $pass = md5($ppass); //echo $uID; $handler->setRquery("SELECT * FROM amistiUser WHERE email=?", array($email)); //check if email is registered $eCheck = $handler->getRquery(); $handler->setRquery("SELECT * FROM amistiUser WHERE uName=?", array($uName)); // check if user name is resgistered $uCheck = $handler->getRquery(); if (count($eCheck[0]['email']) > 0) { echo 1; //error email exist } else { if (count($uCheck[0]['uName']) > 0) { echo 2; // error user name exists
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- CSS --> <script src="js/sweetalert-dev.js"></script> <link rel="stylesheet" href="css/sweetalert.css"> <link href="css/custom.css" type="text/css" rel="stylesheet"> </head> <body> <?php require_once "connect.php"; session_start(); require_once "functionservis.php"; $id_servis = IdKredit(autoID()); $jenis_servis = $_POST['jenis_servis']; $harga_servis = $_POST['harga_servis']; $query = "INSERT INTO servis VALUES ('{$id_servis}','{$jenis_servis}','{$harga_servis}')"; if (mysqli_query($db, $query)) { echo "<script>\n swal({\n title: \"Sukses!\",\n text: \"Data Servis Berhasil Ditambah\",\n type: \"success\"\n },\n function () {\n window.location.href = 'menuservis.php';\n });\n </script>"; } else { echo "<script>\n swal({\n title: \"Gagal!\",\n text: \"Data Servis Gagal ditambah\",\n type: \"error\"\n },\n function () {\n window.location.href = 'menuservis.php';\n });\n </script>"; } mysqli_close($db); ?> </body> </html>
<?php require_once "connect.php"; require_once "functionproduct.php"; $id_kredit = IdKredit(autoID()); $id_product = $_POST['id_product']; $uang_muka = $_POST['uang_muka']; $tahun1 = $_POST['tahun1']; $tahun2 = $_POST['tahun2']; $tahun3 = $_POST['tahun2']; $query = "INSERT INTO kredit VALUES ('{$id_kredit}','{$id_product}','{$uang_muka}','{$tahun1}','{$tahun2}','{$tahun3}')"; if (mysqli_query($db, $query)) { echo "<script>\n alert('Berhasil ditambah');\n window.location.href='menukredit.php';\n </script>"; exit; } else { echo "<script>\n alert('Product sudah ada');\n window.location.href='index.php';\n </script>"; } mysqli_close($db);
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <!-- CSS --> <script src="js/sweetalert-dev.js"></script> <link rel="stylesheet" href="css/sweetalert.css"> <link href="css/custom.css" type="text/css" rel="stylesheet"> </head> <body> <?php session_start(); require_once "connect.php"; require_once "functionbook.php"; $id_book = IdKredit(autoID()); $_SESSION['id_book'] = $id_book; $nopol = $_POST['nopol']; $jam = $_POST['jam']; $query = "INSERT INTO booking (id_book,tanggal,ktp,nopol,jam,status) VALUES ('{$id_book}',now(),'" . $_SESSION['ktp'] . "','{$nopol}','{$jam}','pending')"; if (mysqli_query($db, $query)) { echo "<script>\n swal({\n title: \"Sukses!\",\n text: \"Booking sukses\",\n type: \"success\"\n },\n function () {\n window.location.href = 'home.php';\n });\n </script>"; exit; } else { echo "<script> \n swal({\n title: \"Gagal!\",\n text: \"Booking gagal\",\n type: \"error\"\n },\n function () {\n window.location.href = 'home.php';\n });\n </script>"; } mysqli_close($db); ?> </body> </html>
$pProfile->editUserAddress(); } //DELETE NOTE ADDRESS if ($_GET['gUserDel']) { echo 'You are about to delete your Location Address'; } //DELETE NOW if ($_GET['gUserDelNow']) { $pProfile->setRquery("DELETE FROM amistiAddress WHERE userID=?", array(UID)); $pProfile->getUserAddress(); } //================================ TELEPHONE ================================================ //TEL SAVE if ($_GET['telSave'] == true) { $telC = cleanInput($_GET['telC']); $telN = cleanInput($_GET['telN']); $telT = cleanInput($_GET['telT']); $mTel = cleanInput($_GET['mPhone']); //get data out from amistiCountryData DB $pProfile->setRquery("SELECT * FROM amistiCountryData WHERE countryDataCode=?", array($telC)); $r = $pProfile->getRquery(); $id = autoID(); $pProfile->setRquery("SELECT * FROM amistiTel WHERE telMainTel=? AND userID=?", array(1, UID)); $res = $pProfile->getRquery(); if (count($res)) { $pProfile->setRquery("UPDATE amistiTel SET telMainTel=? WHERE userID=?", array(0, UID)); echo "found"; } $pProfile->setRquery("INSERT INTO amistiTel VALUES(?,?,?,?,?,?,?)", array($id, UID, $r[0]['countryDataName'], $r[0]['countryDataTelCode'], $telN, $telT, $mTel)); $pProfile->getMainPhone(); }