webservice

parents
<?php
include 'server_mysql.php';
$konek = new Mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die(Mysqli_errno());
?>
\ No newline at end of file
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'himatif1');
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$kegiatan_id = $_POST['kegiatan_id'];
$query = "DELETE FROM kegiatan WHERE kegiatan_id ='$kegiatan_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil Menghapus data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal dihapus'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$nama_kegiatan = $_POST['nama_kegiatan'];
$waktu_kegiatan = $_POST['waktu_kegiatan'];
$tempat_kegiatan = $_POST['tempat_kegiatan'];
$deskripsi_kegiatan = $_POST['deskripsi_kegiatan'];
$query = "INSERT INTO kegiatan (nama_kegiatan, waktu_kegiatan, tempat_kegiatan, deskripsi_kegiatan) VALUES ('$nama_kegiatan','$waktu_kegiatan','$tempat_kegiatan','$deskripsi_kegiatan')";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil menambahkan data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal ditambahkan'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
$query = "SELECT * FROM kegiatan ORDER BY nama_kegiatan";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array):
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$kegiatan_id = $_POST['kegiatan_id'];
$nama_kegiatan = $_POST['nama_kegiatan'];
$waktu_kegiatan = $_POST['waktu_kegiatan'];
$tempat_kegiatan = $_POST['tempat_kegiatan'];
$deskripsi_kegiatan = $_POST['deskripsi_kegiatan'];
$query = "UPDATE kegiatan SET nama_kegiatan = '$nama_kegiatan',waktu_kegiatan = '$waktu_kegiatan', tempat_kegiatan= '$tempat_kegiatan', deskripsi_kegiatan= '$deskripsi_kegiatan' WHERE kegiatan_id='$kegiatan_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'data berhasil update')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal diupdate'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
// echo $_SERVER["DOCUMENT_ROOT"]; // /home1/demonuts/public_html
//including the database connection file
require_once '../Cn/koneksi.php';
$kegiatan_id = $_POST['kegiatan_id'];
$mahasiswa_id = $_POST['mahasiswa_id'];
$jab1 = $_POST['jab1'];
$jab2 = $_POST['jab2'];
$jab3 = $_POST['jab3'];
$jab4 = $_POST['jab4'];
$query1 = "INSERT INTO kuisioner_kegiatan (kegiatan_id,mahasiswa_id, jab1, jab2, jab3, jab4) VALUES ('$kegiatan_id','$mahasiswa_id',
'$jab1', '$jab2', '$jab3', '$jab4')";
// var_dump($con,$query1);
if(mysqli_query($konek,$query1)){
echo json_encode(array( "status" => "true","message" => "Suskses Mengirimkan Kuisioner!") );
}else{
echo json_encode(array( "status" => "false","message" => "Coba Lagi!") );
}
mysqli_close($konek);
}else{
echo json_encode(array( "status" => "false","message" => "Error occured, please try again!") );
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mahasiswa_id = $_POST['mahasiswa_id'];
$query = "DELETE FROM mahasiswa WHERE mahasiswa_id ='$mahasiswa_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil Menghapus data')) : jso n_encode(array('kode' =>2, 'pesan' => 'data gagal dihapus'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$nama = $_POST['nama'];
$username = $_POST['username'];
$password = $_POST['password'];
$nim = $_POST['nim'];
$kelas = $_POST['kelas'];
$angkatan = $_POST['angkatan'];
$alamat = $_POST['alamat'];
$email_akademik = $_POST['email_akademik'];
$tempat_lahir = $_POST['tempat_lahir'];
$tanggal_lahir = $_POST['tanggal_lahir'];
$role = $_POST['role'];
$query = "INSERT INTO mahasiswa (nama, username, password, nim, kelas, angkatan, alamat, email_akademik, tempat_lahir, tanggal_lahir, role) VALUES ('$nama','$username','$password','$nim','$kelas','$angkatan','$alamat','$email_akademik','$tempat_lahir','$tanggal_lahir','$role')";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil menambahkan data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal ditambahkan'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
$query = "SELECT * FROM mahasiswa";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array) :
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mahasiswa_id = $_POST['mahasiswa_id'];
$nama = $_POST['nama'];
$username = $_POST['username'];
$password = $_POST['password'];
$nim = $_POST['nim'];
$kelas = $_POST['kelas'];
$angkatan = $_POST['angkatan'];
$alamat = $_POST['alamat'];
$email_akademik = $_POST['email_akademik'];
$tempat_lahir = $_POST['tempat_lahir'];
$tanggal_lahir = $_POST['tanggal_lahir'];
$role = $_POST['role'];
$query = "UPDATE mahasiswa SET nama = '$nama',username = '$username', password = '$password',nim = '$nim', kelas = '$kelas', angkatan = '$angkatan', alamat = '$alamat', email_akademik = '$email_akademik', tempat_lahir= '$tempat_lahir', tanggal_lahir= '$tanggal_lahir' WHERE mahasiswa_id='$mahasiswa_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'data berhasil update')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal diupdate'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$pengumuman_id = $_POST['pengumuman_id'];
$query = "DELETE FROM pengumuman WHERE pengumuman_id ='$pengumuman_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil Menghapus data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal dihapus'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$judul_pengumuman = $_POST['judul_pengumuman'];
$detail_pengumuman = $_POST['detail_pengumuman'];
$tanggal_akhir_pengumuman = $_POST['tanggal_akhir_pengumuman'];
$query = "INSERT INTO pengumuman (judul_pengumuman, detail_pengumuman, tanggal_akhir_pengumuman) VALUES ('$judul_pengumuman','$detail_pengumuman','$tanggal_akhir_pengumuman')";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil menambahkan data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal ditambahkan'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
$query = "SELECT * FROM pengumuman ORDER BY judul_pengumuman";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array):
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
require_once 'koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$pengumuman_id = $_POST['pengumuman_id'];
$detail_pengumuman = $_POST['detail_pengumuman'];
$tanggal_akhir_pengumuman = $_POST['tanggal_akhir_pengumuman'];
$judul_pengumuman = $_POST['judul_pengumuman'];
$query = "UPDATE pengumuman SET judul_pengumuman = '$judul_pengumuman',detail_pengumuman = '$detail_pengumuman', tanggal_akhir_pengumuman = '$tanggal_akhir_pengumuman' WHERE pengumuman_id='$pengumuman_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'data berhasil update')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal diupdate'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$jumlah_bayar = $_POST['jumlah_bayar'];
$tanggal_berakhir = $_POST['tanggal_berakhir'];
$deskripsi_pembayaran = $_POST['deskripsi_pembayaran'];
$query = "INSERT INTO uang_kas (jumlah_bayar, tanggal_berakhir, deskripsi_pembayaran) VALUES ('$jumlah_bayar','$tanggal_berakhir','$deskripsi_pembayaran')";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'berhasil menambahkan data')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal ditambahkan'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once '../Cn/koneksi.php';
$query = "SELECT u.uang_kas_id,u.bph_id,u.periode_id,u.jumlah_bayar,u.tanggal_bayar,u.deskripsi_pembayaran,u.status_pembayaran,u.mahasiswa_id,m.nama FROM uang_kas u inner join mahasiswa m on u.mahasiswa_id = m.mahasiswa_id ";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array):
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
require_once 'koneksi.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$uang_kas_id = $_POST['uang_kas_id'];
$jumlah_bayar = $_POST['jumlah_bayar'];
$tanggal_berakhir = $_POST['tanggal_berakhir'];
$deskripsi_pembayaran = $_POST['deskripsi_pembayaran'];
$query = "UPDATE uang_kas SET jumlah_bayar = '$jumlah_bayar',ltanggal_berakhir = '$tanggal_berakhir', deskripsi_pembayaran = '$deskripsi_pembayaran' WHERE uang_kas_id='$uang_kas_id'";
$exeQuery = mysqli_query($konek, $query);
echo ($exeQuery) ? json_encode(array('kode' =>1, 'pesan' => 'data berhasil update')) : json_encode(array('kode' =>2, 'pesan' => 'data gagal diupdate'));
}
else
{
echo json_encode(array('kode' =>101, 'pesan' => 'request tidak valid'));
}
?>
\ No newline at end of file
<?php
require_once 'Cn/koneksi.php';
$tanggal_lahir = $_GET['birth_date'];
$query = "SELECT * FROM mahasiswa where tanggal_lahir LIKE '%$tanggal_lahir%' ";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array):
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
require_once 'Cn/koneksi.php';
$query = "SELECT * FROM bph inner join mahasiswa on bph.mahasiswa_id = mahasiswa.mahasiswa_id inner join periode on periode.periode_id = bph.periode_id";
$result = mysqli_query($konek,$query);
$array = array();
while ($row = mysqli_fetch_assoc($result))
{
$array[] = $row;
}
echo ($result) ?
json_encode($array):
json_encode(array("kode" => 0, "pesan"=>"data tidak ditemukan"));
?>
\ No newline at end of file
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','');
define('DB','himatif1');
$con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect');
if($_SERVER['REQUEST_METHOD']=='POST'){
//Getting values
$username = $_POST['email'];
$password = $_POST['password'];
//Creating sql query
$sql = "SELECT * FROM mahasiswa WHERE email='$username' AND password='$password'";
//executing query
$result = mysqli_query($con,$sql);
//fetching result
if(mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_array($result)) {
$user = array(
"mahasiswa_id"=>$row['mahasiswa_id'],
"nama"=>$row['nama'],
"username"=>$row['username'],
"password"=>$row['password'],
"nim"=>$row['nim'],
"kelas"=>$row['kelas'],
"angkatan"=>$row['angkatan'],
"alamat"=>$row['alamat'],
"email"=>$row['email'],
"status_mahasiswa"=>$row['status_mahasiswa'],
"tempat_lahir"=>$row['tempat_lahir'],
"tanggal_lahir"=>$row['tanggal_lahir'],
"role"=>$row['role'],
"foto_mahasiswa"=>$row['foto_mahasiswa']
);
}
echo json_encode(array( "status" => "true","message" => "Successfully Login!" , "DataUser" => $user) );
}else{
echo json_encode(array( "status" => "false","message" => "Error occured, please try again!") );
}
mysqli_close($con);
}else{
echo json_encode(array( "status" => "false","message" => "Error occured, please try again!"));
}
?>
Markdown is supported
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