aboutsummaryrefslogtreecommitdiff
path: root/www/functions/notused/func_rewrite.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/functions/notused/func_rewrite.php')
-rwxr-xr-xwww/functions/notused/func_rewrite.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/www/functions/notused/func_rewrite.php b/www/functions/notused/func_rewrite.php
new file mode 100755
index 0000000..0a123d6
--- /dev/null
+++ b/www/functions/notused/func_rewrite.php
@@ -0,0 +1,30 @@
+<?php
+function rewrite($db){
+
+ /* test if first argument a username or folder */
+
+ $name = user_id($db, $_GET["name"]);
+
+ if($name == ""){
+
+ /* if first argument wasn't valid, rewrite the URL to include the username */
+
+ $folder = $_GET["folder"];
+
+ if(preg_match("/\/$/", $_GET["folder"])){
+ $folder = substr($_GET["folder"], 0, -1);
+ }
+
+ if($_SESSION["login"]){
+ $scheme = $GLOBALS["scheme"];
+ header("Refresh: 0; ".$scheme.$_SERVER["HTTP_HOST"]."/" . $_SESSION['username'] . "/" . $_GET["name"] . "/" . $folder . "");
+ exit;
+ }
+
+ return false;
+
+ } else {
+ return true;
+ }
+}
+