Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vayupranaditya authored Oct 28, 2017
1 parent b34d2f8 commit 17ee347
Show file tree
Hide file tree
Showing 99 changed files with 18,095 additions and 0 deletions.
11 changes: 11 additions & 0 deletions batas_preview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?PHP
echo
"<div style='text-align:center'>"
."<b style='font-size:150px; color:#00F'>:(</b><br />"
."Maaf<br />"
."Untuk menuju ke halaman ini, silahkan "
."<a href='logout.php'>masuk</a>"
." atau "
."<a href='logout.php'>bergabung</a>"
."</div>";
?>
Expand Down
6 changes: 6 additions & 0 deletions batas_priview.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?PHP
echo
"<h1>:(</h1>"

."";
?>
Expand Down
75 changes: 75 additions & 0 deletions buat_kiriman.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?PHP
session_start();
//KONEK KE DATABASE
$db_tabel_kiriman="kiriman_user_publik";
require "koneksi_ke_mysql.php";
require "data_akun_masuk.php";
$email=$_SESSION["email"];
$id_user=$akun["id_user"];
if (!empty($_POST["isi_kiriman"]))
{
//ISI KIRIMAN
$isi_kiriman=$_POST["isi_kiriman"];
$isi_kiriman=str_replace("'", "\'", $isi_kiriman);
$isi_kiriman=str_replace("\ ", "\\", $isi_kiriman);
if (!empty($_FILES["foto_kiriman"]))
{
$allowed_extension=array("jpg", "jpeg", "png","gif");
$nama_foto_kiriman=$_FILES["foto_kiriman"]["name"];
$nama_foto_kiriman_terpisah=explode(".", $nama_foto_kiriman);
$ekstensi_foto_kiriman=end($nama_foto_kiriman_terpisah);
if ($_FILES["foto_kiriman"]["size"] > 2097152) //KALAU UKURAN FILE LEBIH BESAR DARI 2 MEGABYTE
{
echo "FOTO TIDAK BOLEH LEBIH DARI 2MB!";
header("location:".$_SERVER["HTTP_REFERER"]);
}
if (in_array($ekstensi_foto_kiriman, $allowed_extension))
{
$kiriman_sebelumnya=mysqli_query($link,
"SELECT * FROM `".$db_tabel_kiriman."`
ORDER BY id_kiriman DESC
LIMIT 1");
$kiriman_sebelumnya=mysqli_fetch_array($kiriman_sebelumnya, MYSQLI_ASSOC);
$id_kiriman_sebelumnya=$kiriman_sebelumnya["id_kiriman"];
$id_kiriman_sekarang=$id_kiriman_sebelumnya + 1;
$foto_kiriman_tersimpan="kiriman_".$id_kiriman_sekarang.".".$ekstensi_foto_kiriman;
$foto_kiriman_tmp=$_FILES["foto_kiriman"]["tmp_name"];
$direktori_penyimpanan_gambar_kiriman="images/kiriman/";
if (move_uploaded_file($foto_kiriman_tmp, $direktori_penyimpanan_gambar_kiriman.$foto_kiriman_tersimpan))
{
echo "Upload foto berhasil!<br>";
echo "<img src=".$direktori_penyimpanan_gambar_kiriman.$foto_kiriman_tersimpan." style='height:200px; width:200px'><br>";
echo "Nama gambar: ".$foto_kiriman_tersimpan."<br>";
echo "Lokasi penyimpanan gambar: ".$direktori_penyimpanan_gambar_kiriman."<br>";
}
else
{
echo "Upload foto gagal!";
}
}
else
{
$foto_kiriman_tersimpan="";
}
}
//ANTI CROSS SITE SCRIPTING
$isi_kiriman=strip_tags($isi_kiriman, "<a>, <b>, <br>, <i>, <p>, <strong>,");
if ($buat_kiriman=mysqli_query($link,"
INSERT INTO ".$db_tabel_kiriman." (id_user,isi_kiriman,foto_kiriman)
VALUES ('".$id_user."','".$isi_kiriman."','".$foto_kiriman_tersimpan."');"))
{
echo "BERHASIL!";
header("location:".$_SERVER['HTTP_REFERER']);
}
else
{
echo "GAGAL!";
header("location:".$_SERVER['HTTP_REFERER']);
}
}
else
{
header("location:".$_SERVER['HTTP_REFERER']);
}
?>

Expand Down
49 changes: 49 additions & 0 deletions buatakun.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?PHP
session_start();
if (isset($_SESSION["logged_in"]) AND $_SESSION["logged_in"]==true)
{
header("location:home.php");
}
else
{
if (isset($_GET["status"]))
{
if ($_GET["status"] == "daftargagal")
{
$pesan="Pembuatan akun gagal!<br><br>";
}
else
{
$pesan="";
}
}
else
{
$pesan="";
}
echo
"
<!DOCTYPE html>
<html>
<head>
<title>Buat Akun Baru - Tel-Med</title>
</head>
<body>
<h1>Buat akun <a href='index.php'>Tel-Med<a/a> baru</h1>
".$pesan."
<form action='daftarkan_akun.php' method='POST'>
Nama Lengkap: <input type='text' name='nama_lengkap'/>
<br>
Alamat Email: <input type='email' name='email'/>
<br>
Password: <input type='password' name='password'/>
<br>
Ulangi Password: <input type='password' name='password2'/>
<br>
<input type='submit' value='Daftar!'/>
</form>
</body>
</html>
";
}
?>
Expand Down
14 changes: 14 additions & 0 deletions cari.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
session_start();
require "koneksi_ke_mysql.php";
require "data_akun_masuk.php";
if ($akun["id_user"] == 1)
{
header("location:home.php?halaman=batas_preview");
}
else
{
$cari=$_GET["cari"];
header("location:home.php?halaman=pencarian&cari=".$cari);
}
?>
Expand Down
Loading

0 comments on commit 17ee347

Please sign in to comment.