Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cihaneken committed Aug 6, 2018
1 parent aaf6461 commit fa51be8
Show file tree
Hide file tree
Showing 13 changed files with 390 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^image\.php$ - [L]
RewriteRule ^sss\.php$ - [L]
RewriteRule ^kosullar\.php$ - [L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
</IfModule>
13 changes: 13 additions & 0 deletions db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php


/* Veritabanı Bağlantısı başı */
$dbtype = "mysql";
$servername = "localhost";
$dbname = "dbname";
$dbusername = "dbuser";
$dbpassword = "dbpass";

$conn = new PDO("$dbtype:host=$servername;dbname=$dbname", $dbusername ,$dbpassword);
/* Veritabanı Bağlantısı sonu */
?>
11 changes: 11 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="w3-card-4 w3-margin">

<header class="w3-container w3-blue">
<h1>Hızlı Resim Yükle</h1>
</header>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="upload.js"></script>
</body>
</html>
25 changes: 25 additions & 0 deletions gallery.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php


?>
<?php include 'header.php'; ?>
<div class="w3-row">
<?php

include 'db.php';
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$gallerytable = $conn->prepare('SELECT image_name, image_url, image_md5name FROM hr_images');
$gallerytable->execute();
$result = $gallerytable->setFetchMode(PDO::FETCH_ASSOC);

foreach ($gallerytable as $result) {

echo '<div class="w3-container w3-col m3 l3 w3-padding "><a href="/image/' . $result['image_md5name'].'"><img class="w3-mobile" src="' . $result['image_url'].'" width="304px" height="260px"/></a></div>';

}
$conn = null;
?>

</div>
<hr>
<?php include 'footer.php'; ?>
49 changes: 49 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
$path_parts = pathinfo($_SERVER['REQUEST_URI']);
$scriptpath = $path_parts['dirname'];
$serverpath = $_SERVER['SERVER_NAME']
?>
<!DOCTYPE html>
<html lang="tr-TR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#fffff"/>
<meta name="msapplication-navbutton-color" content="#ffffff"/>
<meta name="apple-mobile-web-app-status-bar-style" content="#ffffff"/>
<meta name="description" content="Tek tıkla hızlıca resmini yükle, linkini al."/>
<meta property="og:locale" content="tr_TR" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Hızlı Resim Yükle" />
<meta property="og:description" content="Tek tıkla hızlıca resmini yükle, linkini al." />
<meta property="og:url" content="https://hizliresim.gq/" />
<meta property="og:site_name" content="Hızlı Resim Yükle" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:description" content="Tek tıkla hızlıca resmini yükle, linkini al." />
<meta name="twitter:title" content="Hızlı Resim Yükle" />
<link rel="canonical" href="https://hizliresim.gq/" />
<link rel="publisher" href="https://plus.google.com/u/0/117657139241316405760"/>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<meta name="google-site-verification" content="uAqOPhKRryAZeWN_AwD9Ka2oRbszkOZIoeiUqAFAGzY" />
<title>Hızlı Resim Yükle - BETA</title>
</head>
<body class="w3-white w3-container">
<div class="w3-card-4 w3-margin">

<header class="w3-container w3-blue">
<h1>Hızlı Resim Yükle</h1>
</header>

<div class="w3-container">
<p>Resim yüklemenin en hızlı yöntemi.</p>
</div>

<div class="w3-bar w3-border w3-light-grey">
<a href="../" class="w3-bar-item w3-button w3-border-right">Anasayfa</a>
<a href="../gallery" class="w3-bar-item w3-button w3-border-right">Galeri</a>
<a href="../sss" class="w3-bar-item w3-button w3-border-right">SSS</a>
<a href="../kosullar" class="w3-bar-item w3-button w3-border-right">Gizlilik/Koşullar</a>
</div>

</div>
<hr>
12 changes: 12 additions & 0 deletions image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$request = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$params = explode("/", $request);
$endparams = end($params);

include 'header.php';

echo '<div class="w3-container w3-center"><img class="w3-image" src="../images/'.$endparams.'"/></div>';

include 'footer.php';
?>
28 changes: 28 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php include 'header.php'; ?>




<div class="w3-card-4 w3-margin w3-center">

<div class="w3-center w3-padding">
<h3>Lütfen Yüklemek İstediğiniz Resim Dosyasını Seçiniz.</h3>
<p><b>JPEG</b>,<b>PNG</b> ve <b>GIF</b> dosya formatları desteklenmektedir.<br>Dosya boyutu limiti <b>10 MB</b>'dır.<br>Aksi durumlarda hiç bir işlem yapılmayacaktır.</p>
<div class="w3-cell w3-bar w3-margin">

<form id="uploadimage" method="post" enctype="multipart/form-data">
<input id="filetoupload" class="w3-input w3-border w3-border-blue" type="file" name="filetoupload" accept="image/*" required>
<input id="submit" class="w3-input w3-blue" type="submit" name="submit">
</form>

</div>
<div id="result" class="w3-center w3-margin"></div>


<br>
<br>


</div>
</div>
<?php include 'footer.php'; ?>
20 changes: 20 additions & 0 deletions kosullar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php include 'header.php'; ?>

<div class="w3-card-4 w3-margin w3-center">

<div class="w3-center w3-padding">
<h3>Hızlı Resim Gizlilik ve Koşullar</h3>
<p>
Hızlı resim yüklemek için gereken bilgileri bu sayfadan bulabileceksiniz.
<br>
Teşekkürler.
</p>
</div>
<br>
<br>


</div>


<?php include 'footer.php'; ?>
3 changes: 3 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow: /images/
Allow: /
21 changes: 21 additions & 0 deletions sss.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php include 'header.php'; ?>

<div class="w3-card-4 w3-margin w3-center">

<div class="w3-center w3-padding">
<h3>Hızlı Resim SSS</h3>
<p>
Hızlı resim yüklemek için gereken bilgileri bu sayfadan bulabileceksiniz.
<br>
Teşekkürler.
</p>
</div>
<br>
<br>


</div>


<?php include 'footer.php'; ?>

17 changes: 17 additions & 0 deletions upload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$('form').on('submit',function(e){
e.preventDefault();

$.ajax({
url: 'upload.php', // Verileri Post Ettiğimiz dosya adı
type: 'POST', // Form Metodumuz
data: new FormData(this), // Form ile gelen verilerimiz
contentType: false,
cache: false,
processData: false,
success: function(data){
// upload.php dosyamıza verilerin gönderildikten sonra işlem başarılı ise upload.php ile gelen sonuç değerini yazdıracağımız satır
$('#result').html(data);
$('form')[0].reset(); // İşlem başarılı olduktan sonra formu sıfırlar
} });

});
75 changes: 75 additions & 0 deletions upload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php





error_reporting(0); // PHP hatalarını gizle.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$fileinname = basename($_FILES["filetoupload"]["name"]);
$filemovedir = "images/";
$fileinfo = new finfo(FILEINFO_MIME_TYPE);
if (false === $ext = array_search(
$fileinfo->file($_FILES['filetoupload']['tmp_name']),
array(
'jpg' => 'image/jpeg',
'png' => 'image/png',
'gif' => 'image/gif',
),
true
)){
//İzin verilen dosya türü değilse çalıştır.
echo '<div class="w3-tag w3-padding w3-round-large w3-red w3-center">
Hata: Bu izin verilen türde bir dosya değil.</div>';
exit;
}
$fileinfo2 = getimagesize($_FILES['filetoupload']['tmp_name']);
if ($fileinfo2['mime'] != 'image/jpeg' &&
$fileinfo2['mime'] != 'image/png' &&
$fileinfo2['mime'] != 'image/gif'){
//İzin verilen dosya türü değilse çalıştır.
echo '<div class="w3-tag w3-padding w3-round-large w3-red w3-center">
Hata: Bu izin verilen türde bir dosya değil.</div>';
exit;
}
if ($_FILES['filetoupload']['size'] > 10000000) {
//İzin verilen dosya boyutu aşılmışsa çalıştır.
echo '<div class="w3-tag w3-padding w3-round-large w3-red w3-center">
Hata: Bu izin verilen dosya boyutu aşıldı.</div>';
exit;
}
$fileintype = $_FILES['filetoupload']['type'];
$fileoutname = md5(mt_rand()).'.jpg';
if (move_uploaded_file($_FILES["filetoupload"]["tmp_name"],$filemovedir.$fileoutname)) {
include 'db.php';
$imagedate = date("Y-m-d H:i:s");
$imageurl = $filemovedir.$fileoutname;
$imagetype = $fileinfo2["mime"];
$insertdb = "INSERT INTO hr_images (image_date, image_name, image_md5name, image_url, image_type)
VALUES (
'$imagedate',
'$fileinname',
'$fileoutname',
'$imageurl',
'$imagetype'
)";
$conn->exec($insertdb);
include 'uploadend.php';
} else {
echo '<div class="w3-tag w3-padding w3-round-large w3-red w3-center">
Hata: Dosyanız bir hata sonucu yüklenemedi.</div>';
exit;
}





}//REQUEST_METHOD POST kontrol.
else{
echo "Hata: Bu işlem POST ile yapılmalıdır.";
exit;
}


?>
Loading

0 comments on commit fa51be8

Please sign in to comment.