-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresimkontrol.php
83 lines (63 loc) · 1.59 KB
/
resimkontrol.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/*
_____ _ ____ _
| ___| _ _ __| | ____ _ _ __ / ___| ___ ______ _(_)_ __
| |_ | | | | '__| |/ / _` | '_ \ \___ \ / _ \_ / _` | | '_ \
| _|| |_| | | | < (_| | | | | ___) | __// / (_| | | | | |
|_| \__,_|_| |_|\_\__,_|_| |_| |____/ \___/___\__, |_|_| |_|
|___/
*/
indir("http://resimdiyari.com/upload/2014/06/18/20140618121439-338f255e.jpg");
function indir($adres)
{
$ch = curl_init("$adres");
if (!$ch) {
die("Oturum açılamadı");
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$file = get_headers($adres);
if($file['0'] == 'HTTP/1.0 200 OK') {
$IlkSayi = rand(1000, 10000);
if(!file_exists('images/'.$IlkSayi.'.'.uzanti($adres)))
{
$islem = fopen("images/".$IlkSayi.'.'.uzanti($adres), "a+");
?>
<img src="<?php echo'images/'.$IlkSayi.'.'.uzanti($adres); ?>">
<?php
fwrite($islem, $data);
fclose($islem);
if ($islem) {
echo 'OK';
} else {
echo 'Dosya Yüklenenemedi.';
}
}
else
{
$IlkSayi = rand(1000, 10000);
$islem = fopen("images/".$IlkSayi.'.'.uzanti($adres), "a+");
?>
<img src="<?php echo'images/'.$IlkSayi.'.'.uzanti($adres); ?>">
<?php
fwrite($islem, $data);
fclose($islem);
if ($islem) {
echo 'OK';
} else {
echo 'Dosya Yüklenenemedi.';
}
}
}
else
{
echo 'Resim uzak sunucuda bulunamadı.';
}
}
function uzanti($link) {
$uzanti = pathinfo($link);
$uzanti = $uzanti["extension"];
return $uzanti;
}
?>