dopaminadarktheme
Full Dopamina Dark Theme
|
1
2
3
4
5
6
7
8
9
10
11 |
<br>$_GET['f'] = "protectedImages/" . $_GET['f'];<br>$type = getFileType($_GET['f']);<br>if (acceptableType($type)) {<br> header("Content-type: $type");<p></p><p> echo file_get_contents($_GET['f']);<br> exit;<br>}<br>header('HTTP/1.1 403 Forbidden');<br>exit;<br></p> |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 |
<br>function getFileType($file) {<br> //Deprecated, but still works if defined...<br> if (function_exists("mime_content_type"))<br> return mime_content_type($file);<p></p><p> //New way to get file type, but not supported by all yet.<br> else if (function_exists("finfo_open")) {<br> $finfo = finfo_open(FILEINFO_MIME_TYPE);<br> $type = finfo_file($finfo, $file);<br> finfo_close($finfo);<br> return $type;<br> }</p><p> //Otherwise...just use the file extension<br> else {<br> $types = array(<br> 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png',<br> 'gif' => 'image/gif', 'bmp' => 'image/bmp'<br> );<br> $ext = substr($file, strrpos($file, '.') + 1);<br> if (key_exists($ext, $types)) return $types[$ext];<br> return "unknown";<br> }<br>}<br></p> |
|
1
2
3
4
5
6
7 |
<br>function acceptableType($type) {<br> $array = array("image/jpeg", "image/jpg", "image/png", "image/png");<br> if (in_array($type, $array))<br> return true;<br> return false;<br>}<br> |
|
1
2
3
4
5
6
7
8
9
10
11
12 |
<br><html><br><head><br> <title>Page Title</title><br></head><br><body><br> <div class="image"><br> <img src="image.php?f=image.jpg" alt="Image" /><br> <div class="cover"><img src="imageCover.gif" alt="" /></div><br> </div><br></body><br></html><br> |
|
1
2
3
4
5
6
7
8
9
10
11
12
13 |
<br>.image {<br> overflow: hidden;<br> position: relative;<br> float: left;<br>}<br>.image .cover, .image .cover img {<br> position: absolute;<br> top: 0px;<br> left: 0px;<br> width: 100%;<br> height: 100%;<br>}<br> |
|
1
2
3
4
5
6
7
8 |
<br>#Prevent directory listing<br>Options -Indexes<p></p><p>#Prevent images from being viewed<br><Files *><br> deny from all<br></Files><br></p> |
|
1
2
3
4
5 |
<br>RewriteEngine on<br>RewriteCond %{HTTP_REFERER} ^$<br>RewriteCond %{SCRIPT_FILENAME} image\.php<br>RewriteRule (.*) image.php?onlyHappensFromHTACCESS=denied [QSA,L]<br> |
|
1
2
3
4 |
<br>if (!isset($_GET['onlyHappensFromHTACCESS'])) {<br> //Our previous code here<br>}<br> |
|
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 |
<br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br><html><br><head><br> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /><br> <title>Image Denied</title><br> <style type="text/css" media="screen"><br> body {<br> background-color: #ccc;<br> font-family: Helvetica, Arial;<br> }<br> #wrapper {<br> margin: 30px auto;<br> background-color: #ffffff;<br> -moz-border-radius: 15px;<br> -webkit-border-radius: 15px;<br> border-radius: 15px;<br> width: 800px;<br> padding: 20px;<br> }<br> </style><br></head><p></p><p><div id="wrapper"><br> <h3>Access Denied!</h3><br> <p>You have tried to access an image, but due to security reasons, you cannot view the image.</p></p><p> <p>If you wish to use the image you requested, please contact me.</p><br></div><br></html><br></p> |
|
1
2
3 |
<br>session_start();<br>$_SESSION['lastcheck'] = time();<br> |
|
1
2
3
4
5
6
7
8 |
<br>function goodTiming() {<br> $n = time();<br> session_start();<br> if ($n - $_SESSION['lastcheck'] > 2 )<br> return false;<br> return true;<br>}<br> |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
<br>if (!isset($_GET['onlyHappensFromHTACCESS'])) {<br> $_GET['f'] = "pictures/" . $_GET['f'];<br> $type = getFileType($_GET['f']);<br> if (acceptableType($type)) {<br> if (goodTiming()) {<br> header("Content-type: $type");<p></p><p> echo file_get_contents($_GET['f']);<br> exit;<br> }<br> }<br> header('HTTP/1.1 403 Forbidden');<br> exit;<br>}<br></p> |
|
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 |
<br><?php<br>if (!isset($_GET['onlyHappensFromHTACCESS'])) {<br> $_GET['f'] = "protectedImages/" . $_GET['f'];<br> $type = getFileType($_GET['f']);<br> if (acceptableType($type)) {<br> if (goodTiming()) {<br> header("Content-type: $type");<p></p><p> echo file_get_contents($_GET['f']);<br> exit;<br> }<br> }<br> header('HTTP/1.1 403 Forbidden');<br> exit;<br>}</p><p>function getFileType($file) {<br> if (function_exists("mime_content_type"))<br> return mime_content_type($file);<br> else if (function_exists("finfo_open")) {<br> $finfo = finfo_open(FILEINFO_MIME_TYPE);<br> $type = finfo_file($finfo, $file);<br> finfo_close($finfo);<br> return $type;<br> }<br> else {<br> $types = array(<br> 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png',<br> 'gif' => 'image/gif', 'bmp' => 'image/bmp'<br> );<br> $ext = substr($file, strrpos($file, '.') + 1);<br> if (key_exists($ext, $types)) return $types[$ext];<br> return "unknown";<br> }<br>}</p><p>function acceptableType($type) {<br> $array = array("image/jpeg", "image/jpg", "image/png", "image/png");<br> if (in_array($type, $array))<br> return true;<br> return false;<br>}</p><p>function goodTiming() {<br> $n = time();<br> session_start();<br> if ($n - $_SESSION['lastcheck'] > 2 )<br> return false;<br> return true;<br>}</p><p>?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br><html><br><head><br> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /><br> <title>Image Denied</title><br> <style type="text/css" media="screen"><br> body {<br> background-color: #ccc;<br> font-family: Helvetica, Arial;<br> }<br> #wrapper {<br> margin: 30px auto;<br> background-color: #ffffff;<br> -moz-border-radius: 15px;<br> -webkit-border-radius: 15px;<br> border-radius: 15px;<br> width: 800px;<br> padding: 20px;<br> }<br> </style><br></head></p><p><div id="wrapper"><br> <h3>Access Denied!</h3><br> <p>You have tried to access an image, but due to security reasons, you cannot view the image.</p></p><p> <p>If you wish to use the image you requested, please contact me.</p><br></div><br></html><br></p> |
|
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 |
<br><?php session_start(); $_SESSION['lastcheck'] = time(); ?><br><html><br><head><br> <title>Page Title</title><br> <style type="text/css"><br> .image {<br> overflow: hidden;<br> position: relative;<br> float: left;<br> }<br> .image .cover, .image .cover img {<br> position: absolute;<br> top: 0px;<br> left: 0px;<br> width: 100%;<br> height: 100%;<br> }<br> </style><br></head><br><body><br> <div class="image"><br> <img src="image.php?f=image.jpg" alt="Image" /><br> <div class="cover"><img src="imageCover.gif" alt="" /></div><br> </div><br></body><br></html><br> |
|
1
2
3
4
5 |
<br>RewriteEngine on<br>RewriteCond %{HTTP_REFERER} ^$<br>RewriteCond %{SCRIPT_FILENAME} image\.php<br>RewriteRule (.*) image.php?onlyHappensFromHTACCESS=denied [QSA,L]<br> |
|
1
2
3
4
5
6
7
8 |
<br>#Prevent directory listing<br>Options -Indexes<p></p><p>#Prevent images from being viewed<br><Files *><br> deny from all<br></Files><br></p> |
Assine a newsletter para receber em seu email as publicações atualizadas neste blog