diff --git a/index.php b/index.php index a8210f0..c2d0462 100755 --- a/index.php +++ b/index.php @@ -27,8 +27,16 @@ session_start(); height: 100vh; background: url('img/sand.bmp'); } + form { + margin-top: 1rem; + } .center { margin: auto; + margin-top: 2rem; + margin-bottom: 2rem; + } + .main{ + width: 100%; } input::file-selector-button { font-family: "Pixelated MS Sans Serif",Arial; @@ -56,10 +64,15 @@ session_start(); outline-offset: -4px; box-shadow: inset -1px 1px #cee7ff,inset 1px 2px #98b8ea,inset -2px 2px #bcd4f6,inset 1px -1px #89ade4,inset 2px -2px #89ade4; } + @media screen and (min-width: 600px) { + .main{ + width: 600px; + } + } -
+
Trygves filopplasting!
@@ -67,49 +80,47 @@ session_start();
+

Hei! Her kan du laste opp filer du ønsker å dele med andre, eller bare deg selv. Fra tid til annen sletter jeg filene her for for å spare plass så denne sida er kun for midlertidig fillagring.

+ Her kan du bla gjennom alle offentlige filer +
- -
- - +
+ + +
+
+ + +
+
+ + + +
+
+
' . $title . '
+
+ +
+
+
+

'. $message . '

+
+
+
'; + } if(isset($_SESSION['fileupload-response'])) { - $errorMSG = ' -
-
-
' .$_SESSION['filename'] . '
-
- -
-
-
- Hmmmm... Her var det visst noe som gikk galt. - -
-
'; - - $bannedMSG = ' -
-
-
' . $_SESSION['filename'] . '
-
- -
-
-
- Denne filtypen er forbudt! - -
-
'; if($_SESSION['fileupload-response'] == "success") { - $successMSG = ' -
+
' . $_SESSION['filename'] . '
@@ -117,10 +128,10 @@ session_start();
- ' +

' . $_SESSION['linkData'] . - ' - + '

+
'; @@ -128,10 +139,10 @@ session_start(); echo($successMSG); } elseif ($_SESSION['fileupload-response'] == "failed") { - echo($errorMSG); + echo(popup($_SESSION['filename'], 'Oisan, noe gikk vist galt!', 'ERROR')); } elseif ($_SESSION['fileupload-response'] == "banned") { - echo($bannedMSG); + echo(popup($_SESSION['filename'], 'Stoppe en hall! Denne filtypen er forbudt!', 'ERROR')); } session_destroy(); } diff --git a/upload.php b/upload.php index 03e7a2d..f64e5ca 100755 --- a/upload.php +++ b/upload.php @@ -1,59 +1,67 @@ ' . $path . ''; - //echo $fillink;() - $buttonData = 'Filen ble lastet opp! Kopier lenke'; - $_SESSION['linkData'] = 'Filen ble lastet opp! ' . $filLink; - $_SESSION['link'] = $path; - $_SESSION['fileupload-response'] = 'success'; + foreach ($banned as $url) { + if (strpos($fileActualExt, $url) !== FALSE) { + $fileError = 2; } - } - elseif($fileError === 2) + } + + if ($file_name === 'index.htm' || $file_name === 'index.html') { + $fileError = 2; + } + + if (!empty($_POST['new_filename'])) { + $file_name = $_POST['new_filename'] . '.' .$fileActualExt; + } + + if ($_POST['public'] == True) { + $file_destination = 'offentlig/' . $file_name; + } + else { + $file_destination = 'privat/' . $file_name; + } + + if($fileError == 0) + { + if(move_uploaded_file($file_tmp, $file_destination)) { - $_SESSION['fileupload-response'] = 'banned'; - } - else - { - $_SESSION['fileupload-response'] = 'failed'; + $path = 'https://trygve.me/filopplasting/' . $file_destination; + $filLink = '' . $path . ''; + //echo $fillink;() + $buttonData = 'Filen ble lastet opp! Kopier lenke'; + $_SESSION['linkData'] = 'Filen ble lastet opp! ' . $filLink; + $_SESSION['link'] = $path; + $_SESSION['fileupload-response'] = 'success'; } + } + elseif($fileError === 2) + { + $_SESSION['fileupload-response'] = 'banned'; + } + else + { + $_SESSION['fileupload-response'] = 'failed'; + } } header("location:../filopplasting");