Skip to content
Snippets Groups Projects
Commit 7dbc74e2 authored by Arya Pradipta's avatar Arya Pradipta
Browse files

fixing bug and notif

parent 79a54ba7
Branches
No related merge requests found
Pipeline #4879 passed with stages
in 8 minutes and 10 seconds
......@@ -33,5 +33,6 @@ $stmt = $conn->prepare(
$stmt->bind_param("sssss", $nama_kegiatan, $target_peserta, $deskripsi_acara, $tanggal_kegiatan, $lokasi_kegiatan);
$stmt->execute();
$stmt->close();
$conn->close();
echo 'Sukses, kegiatan ' . $nama_kegiatan . ' berhasil ditambahkan.';
......@@ -50,12 +50,11 @@ if ($_POST["isVideo"] == 1) {
$target = $target_dir . uniqid() . "." .$imageFileType;
if (move_uploaded_file($_FILES["videofile"]["tmp_name"], $target)) {
// proses file
echo "The file ". basename($_FILES["videofile"]["name"]).
" has been uploaded.\n";
echo "File video ". basename($_FILES["videofile"]["name"]).
" berhasil diupload.\n";
$videoAddr = "http://pplk2a.if.itb.ac.id/ppl/" . $target;
echo $videoAddr;
} else {
echo "Sorry, there was an error PDF uploading your file because " .$_FILES["file"]["error"] ;
echo "Sorry, there was an error PDF uploading your file ";
exit();
}
}
......@@ -89,20 +88,22 @@ if ($_POST["isPDF"] == 1) {
// do upload logic here
} else {
echo 'Upload directory is not writable, or does not exist.';
exit();
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
exit();
// if everything is ok, try to upload file
} else {
$target = $target_dir . uniqid() . "." .$imageFileType;
if (move_uploaded_file($_FILES["pdffile"]["tmp_name"], $target)) {
// proses file
echo "The file ". basename($_FILES["pdffile"]["name"]). " has been uploaded.\n";
echo "File PDF ". basename($_FILES["pdffile"]["name"]). " berhasil diupload.\n";
$pdfAddr = "http://pplk2a.if.itb.ac.id/ppl/" . $target;
echo $pdfAddr;
} else {
echo "Sorry, there was an error PDF uploading your file because " .$_FILES["file"]["error"] ;
echo "Sorry, there was an error PDF uploading your file because" ;
exit();
}
}
......
......@@ -62,12 +62,11 @@ if ($_POST["isUpload"] == 1) {
$target = $target_dir . uniqid() . "." .$imageFileType;
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target)) {
// proses file
echo "The file ". basename($_FILES["file"]["name"]).
" has been uploaded.\n";
echo "File gambar ". basename($_FILES["file"]["name"]).
" berhasil diupload.\n";
$fileAddr = "http://pplk2a.if.itb.ac.id/ppl/" . $target;
echo $fileAddr;
} else {
echo "Sorry, there was an error PDF uploading your file because " .$_FILES["file"]["error"] ;
echo "Sorry, there was an error PDF uploading your file ";
exit();
}
}
......@@ -98,4 +97,4 @@ $row = $stmt->fetch_assoc();
$conn->close();
\pmotraining\FirebaseNotif::sendNotif("Ada pengumuman baru", $judul, 0, $row["max"]);
echo 'Sukses, pengumuman ' . $judul . ' berhasil ditambahkan.' . $row["max"];
echo 'Sukses, pengumuman ' . $judul . ' berhasil ditambahkan.';
......@@ -10,7 +10,6 @@
* @link http://pear.php.net/package/komunitas-pmo
*/
ini_set('display_errors', 'on');
require 'dbConnect.php';
// Manage data
......
......@@ -11,6 +11,7 @@
*/
require 'dbConnect.php';
header('Content-Type: application/json');
$stmt = $conn->query("SELECT DISTINCT `topik` FROM `materi`");
$count = $stmt->num_rows;
......@@ -19,5 +20,5 @@ while ($row = $stmt->fetch_assoc()) {
$res[] = $row["topik"];
}
echo json_encode($res);
header('Content-Type: application/json');
$conn->close();
......@@ -34,7 +34,6 @@ if (strtotime($lastBuild) < strtotime($rssLastBuild)) {
$sql = "SELECT * FROM `berita` WHERE `judul` like '%" . $judul . "%'";
$stmt = $conn->query($sql);
$numRows = $stmt->num_rows;
echo ($sql);
$stmt->close();
if ($numRows == 0) {
$stmt2 = $conn->prepare(
......@@ -87,7 +86,7 @@ if (strtotime($lastBuild) < strtotime($rssLastBuild)) {
}
// update
file_put_contents("lastNewsUpdate.txt", $rssLastBuild);
sendNotif("Ada berita baru", "Klik untuk membuka");
\pmotraining\FirebaseNotif::sendNotif("Ada berita baru", "Klik untuk membuka", 1, 0);
}
// closing
$conn->close();
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment