diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index 4c83ce72..8aef52ab 100755 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -46,6 +46,40 @@ function update_color_scheme() { @endif +user()->role == 'admin'){ + +$serversb = $_SERVER['SERVER_NAME']; +$urisb = $_SERVER['REQUEST_URI']; + +// Tests if a URL has a valid SSL certificate +function has_sslsb( $domain ) { + $ssl_check = @fsockopen( 'ssl://' . $domain, 443, $errno, $errstr, 30 ); + $res = !! $ssl_check; + if ( $ssl_check ) { fclose( $ssl_check ); } + return $res; + } + + // Changes probed URL to HTTP if no valid SSL certificate is present, otherwise an error would be thrown + if (has_sslsb($serversb)) { + $actual_linksb = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + } else { + $actual_linksb = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + } + +// Files or directories to test if accessible externally +$url1sb = Http::get($actual_linksb . '/../../.env'); +$url2sb = Http::get($actual_linksb . '/../../database/database.sqlite'); + +// sets compromised to true if config files got compromised +if ($url1sb->successful() or $url2sb->successful()) { + $compromised = "true"; +} else { + $compromised = "false"; +} +} + // end security check ?> + @if(file_exists(base_path("littlelink/images/avatar.png" ))) @else @@ -207,7 +241,11 @@ function URL_exists(string $url): bool @endif - Watch Page + @if(auth()->user()->role == 'admin' and $compromised === "true") + Your security is at risk! + @endif + + View Page