Ik zoek een script die alleen bepaalde ip-adressen toelaat.
Stuur desnoods een pbtje.
Vriendelijke groet,
Sander
Stuur desnoods een pbtje.
Vriendelijke groet,
Sander
deny from all
Allow from (ip hier)
Allow from (ip hier)
Allow from (ip hier) Sevvlor schreef:http://stackoverflow.com/questions/7667004/htaccess-using-password-or-ip-whitelist
Plaats dit in je .htaccess
deny from all
Allow from (ip hier)
Allow from (ip hier)
Allow from (ip hier) <!-- Wachtwoord functie -->
<script>
<!--Hide from non-JavaScript Browsers
var password = prompt("n4mm0hutr4d10","");
//EERSTE PASSWORD
switch(password){
case"wachtwoord1" : window.location="javascript:correct()"
break ;
//TWEEDE PASSWORD
case"wachtwoord2" : window.location="javascript:correct()"
break ;
//DERDE PASSWORD
case"wachtwoord3" : window.location="javascript:correct()"
break ;
//FOUT WACHTWOORD
default : window.location="javascript:error()"
break ;
}
//Stop hiding-->
</script>
</body>
</html> [COLOR= #0000BB]<?php
$ips[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]IP[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]IP[/COLOR] [COLOR= #007700],[/COLOR] [COLOR= #DD0000]IP[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ips[/COLOR][COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]U heeft geen toegang om deze pagina te bekijken.[/COLOR][COLOR= #007700]);
}[/COLOR]
?> [COLOR= #0000BB]<?php
$ips[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxxx"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ips[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Hoi Sander.[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]onderhoud.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
}[/COLOR]
?> Sanderosz schreef:Dankje, en er zit een foutje in mijn wachtwoord script, want je kan hem wegklikken.Plaats dit in je .htaccessEerdere citaten tonen
deny from all Allow from (ip hier) Allow from (ip hier) Allow from (ip hier)
<!-- Wachtwoord functie -->
<script>
<!--Hide from non-JavaScript Browsers
var password = prompt("n4mm0hutr4d10","");
//EERSTE PASSWORD
switch(password){
case"wachtwoord1" : window.location="javascript:correct()"
break ;
//TWEEDE PASSWORD
case"wachtwoord2" : window.location="javascript:correct()"
break ;
//DERDE PASSWORD
case"wachtwoord3" : window.location="javascript:correct()"
break ;
//FOUT WACHTWOORD
default : window.location="javascript:error()"
break ;
}
//Stop hiding-->
</script>
</body>
</html> Sanderc schreef:Ik heb overlaatst zelf een IP allower gemaakt voor mijn site die nu in onderhoud is:
[COLOR= #0000BB]<?php
$ips[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxxx"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ips[/COLOR][COLOR= #007700]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Hoi Sander.[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]onderhoud.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700];
}[/COLOR]
?> Joeey schreef:Een vraagje; Waarom exit()? Zonder exit() functioneert de snippet toch ook?Eerdere citaten tonen
Sanderc schreef:Ik heb overlaatst zelf een IP allower gemaakt voor mijn site die nu in onderhoud is:[COLOR= #0000BB]<?php $ips[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxxx"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ips[/COLOR][COLOR= #007700])) {[/COLOR] [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Hoi Sander.[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]onderhoud.php[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]; }[/COLOR] ?>

Aarclay schreef:Nee, alles na de include van onderhoud.php wordt ook meegenomen. Niet echt wenselijkEen vraagje; Waarom exit()? Zonder exit() functioneert de snippet toch ook?Eerdere citaten tonen
Joeey schreef:Eerdere citaten tonen
Sanderc schreef:Ik heb overlaatst zelf een IP allower gemaakt voor mijn site die nu in onderhoud is:[COLOR= #0000BB]<?php $ips[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxxx"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/in_array"]in_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]],[/COLOR] [COLOR= #0000BB]$ips[/COLOR][COLOR= #007700])) {[/COLOR] [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Hoi Sander.[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]onderhoud.php[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]; }[/COLOR] ?>
