ae4fadd3 by Jeff Balicki

lock down files

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 9c352c62
......@@ -19,3 +19,23 @@ RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# require login for media files
# more info: https://m0n.co/11
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} (\.pdf|\.docx|\.xlsx|\.ppt)$ [NC]
RewriteCond %{HTTP_COOKIE} !stc_logged_in [NC]
RewriteRule (.*) https://stellervistaconnect.com/
</IfModule>
# END WordPress
Options -Indexes
......
......@@ -268,3 +268,15 @@ function wpa_91930() {
add_action( 'init', 'wpa_91930' );
add_action( 'wp_login', 'add_custom_cookie' );
function add_custom_cookie() {
setcookie( 'stc_logged_in',rand(5, 15), time()+WEEK_IN_SECONDS );
}
// To Remove Cookie
add_action( 'wp_logout', 'remove_custom_cookie' );
function remove_custom_cookie() {
setcookie( 'stc_logged_in', '', -1000000 );
}
\ No newline at end of file
......