diff options
| -rw-r--r-- | tmp/select.php (renamed from www/select.php) | 0 | ||||
| -rw-r--r-- | www/.functions.php.swp | bin | 0 -> 20480 bytes | |||
| -rw-r--r-- | www/.index.php.swp | bin | 12288 -> 12288 bytes | |||
| -rw-r--r-- | www/functions.php | 14 | ||||
| -rw-r--r-- | www/index.php | 7 | ||||
| -rw-r--r-- | www/interface_functions.php | 5 | ||||
| -rw-r--r-- | www/select_function.php | 23 |
7 files changed, 35 insertions, 14 deletions
diff --git a/www/select.php b/tmp/select.php index ffa12d1..ffa12d1 100644 --- a/www/select.php +++ b/tmp/select.php diff --git a/www/.functions.php.swp b/www/.functions.php.swp Binary files differnew file mode 100644 index 0000000..51599d7 --- /dev/null +++ b/www/.functions.php.swp diff --git a/www/.index.php.swp b/www/.index.php.swp Binary files differindex 7dc5069..ea0fadf 100644 --- a/www/.index.php.swp +++ b/www/.index.php.swp diff --git a/www/functions.php b/www/functions.php index c1cdca6..96f4010 100644 --- a/www/functions.php +++ b/www/functions.php @@ -2,7 +2,7 @@ /* --LOGIN-- */ -require_once("select_functions.php"); +require_once("select_function.php"); function login($db){ if($_SERVER['REQUEST_METHOD'] == 'POST') { @@ -267,7 +267,7 @@ function get_404(){ */ //} -function show($db){ +function rewrite($db){ /* test if first argument a username or folder */ @@ -286,14 +286,10 @@ function show($db){ } else { get_404(); } - } else { - - /* everything was okay, so show the content, please */ - - $content = select($db); - return $content; - //exit; + return false; } + + return true; } function failure($reason){ diff --git a/www/index.php b/www/index.php index d1f86ee..77a29e6 100644 --- a/www/index.php +++ b/www/index.php @@ -3,6 +3,7 @@ session_start(); require_once("functions.php"); +require_once("interface_functions.php"); $db = new SQLite3("../database/sqlite.db"); @@ -49,7 +50,9 @@ if(empty($_GET)){ /* shows the user content, main function */ - $content = show($db); - var_dump($content); + if(rewrite($db)){ + $content = select($db); + show($content); + } } } diff --git a/www/interface_functions.php b/www/interface_functions.php new file mode 100644 index 0000000..0116fe6 --- /dev/null +++ b/www/interface_functions.php @@ -0,0 +1,5 @@ +<? + +function show($content){ + var_dump($content); +} diff --git a/www/select_function.php b/www/select_function.php index b83fe04..6e4bc66 100644 --- a/www/select_function.php +++ b/www/select_function.php @@ -1,3 +1,4 @@ +<? function select($db){ if($_SESSION["login"]){ $share=""; @@ -47,9 +48,25 @@ function select($db){ } } - $content_db = $db->query("SELECT id, name, folder FROM files WHERE parent=" . $parentdir . " AND owner=" . $owner . ";"); - $content_ar = $conten_db->fetchArray(SQLITE3_NUM); +// echo "parent: " . $parentdir . "<br>"; + $content_db = $db->query("SELECT * FROM files WHERE parent=" . $parentdir . " AND owner=" . $owner . ";"); +// $content_ar = $content_db->fetchArray(SQLITE3_NUM); - return $content_ar; + $count=0; + while($row = $content_db->fetchArray(SQLITE3_NUM)){ + $content[$count][0] = $row[0]; + $content[$count][1] = $row[1]; + $content[$count][2] = $row[2]; + $content[$count][3] = $row[3]; + $content[$count][4] = $row[4]; + $content[$count][5] = $row[5]; + $content[$count][6] = $row[6]; + $content[$count][7] = $row[7]; + $content[$count][8] = $row[8]; + //echo "<a href='/". $user . "/" . $content[$count][3] . "'>" . $content[$count][3] . "</a><br>"; + $count++; + } + + return $content; } |
