54.210.143.119 |    

Navigation

Google Advertisement

Die Funktion check_referer(), prüft wenn ein Referer existiert, ob dieser in einer Whitelist vorhanden ist.

referer
  1. #!/usr/bin/perl
  2.  
  3. # List of allowed domains.
  4. my @domains=('newmedia24.de','tuxnet24.de');
  5.  
  6. # Go away if your referer is not in the domain list.
  7. if (!referer($ENV{'HTTP_REFERER'})) {
  8.     print "Location: https://www.cia.gov/\n\n";
  9. }
  10.  
  11. # ********************************************************************
  12. # This function check if the $ENV{'HTTP_REFERER'} can access this page.
  13.  
  14. sub check_referer {
  15.  
  16. my $referer=shift;
  17. if ($referer) {
  18.     foreach $domain(@domains) {
  19.         if ($referer =~ m|https?://([^/]*)$domain|i) {
  20.             return 1;
  21.             last;
  22.         }
  23.     }
  24. } else {
  25.     return 1;
  26. }
  27.  
  28. }
  29.  
Parsed in 0.001 seconds at 695.53 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 10 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)