diff options
-rw-r--r-- | css/style.css | 2 | ||||
-rw-r--r-- | loginregister.js | 1 | ||||
-rw-r--r-- | php/.database.php.swp | bin | 0 -> 16384 bytes | |||
-rw-r--r-- | php/.node.php.swp | bin | 0 -> 12288 bytes | |||
-rw-r--r-- | php/database.php | 37 | ||||
-rw-r--r-- | php/node.php | 26 | ||||
-rw-r--r-- | sql/.fileshare.sql.swp | bin | 0 -> 12288 bytes | |||
-rw-r--r-- | sql/fileshare.sql | 2 |
8 files changed, 65 insertions, 3 deletions
diff --git a/css/style.css b/css/style.css index aa29cf6..75d3f02 100644 --- a/css/style.css +++ b/css/style.css @@ -222,7 +222,7 @@ input[type=submit]:hover { z-index: -200; } -#loginform { +#signupform { display: none; } diff --git a/loginregister.js b/loginregister.js index cb87444..cb49607 100644 --- a/loginregister.js +++ b/loginregister.js @@ -37,7 +37,6 @@ update(); - function clear_hero_errors() { let errors = document.getElementsByClassName("hero_form_error"); diff --git a/php/.database.php.swp b/php/.database.php.swp Binary files differnew file mode 100644 index 0000000..5193729 --- /dev/null +++ b/php/.database.php.swp diff --git a/php/.node.php.swp b/php/.node.php.swp Binary files differnew file mode 100644 index 0000000..2046c2b --- /dev/null +++ b/php/.node.php.swp diff --git a/php/database.php b/php/database.php index a5a8c20..a46bdd2 100644 --- a/php/database.php +++ b/php/database.php @@ -2,6 +2,7 @@ require_once "configuration.php"; require_once "user.php"; require_once "misc.php"; +require_once "node.php"; /*handles database stuff*/ class Database @@ -72,6 +73,17 @@ require_once "misc.php"; return false; } } + function get_home_id($user_id) + { + $statement=$this->pdo->prepare("select home_directory + from users + where user_id=:id + "); + $statement->bindParam(':id',$user_id); + + $ret=$statement->execute(PDO::FETCH_ASSOC); + return $ret["home_directory"]; + } function get_node_id($name,$directory_id) { $hold=NULL; @@ -152,6 +164,29 @@ require_once "misc.php"; //print count($id); return $id[0]; } + function are_linked(int $directory_id,int $node_id): bool + { + $prepare=$this->pdo->prepare("select node_id + from node_links + where node_id=:node_id and directory_id=:dir_id + "); + $prepare->bindParam(':node_id',$node_id); + $prepare->bindParam(':dir_id',$directory_id); + if($prepare->execute()==false) + { + error_log("there is an sql error in are_linked"); + /*quiet error*/ + return false; + } + if(count($prepare->fetch(PDO::FETCH_ASSOC))==1) + { + return true; + }else + { + return false; + } + } + /*returns false if username is taken, email is not checked here*/ function register_user(string $user,string $password,string $email) : bool { @@ -190,5 +225,5 @@ require_once "misc.php"; } } - +$database=new Database(); ?> diff --git a/php/node.php b/php/node.php new file mode 100644 index 0000000..b6c3428 --- /dev/null +++ b/php/node.php @@ -0,0 +1,26 @@ +<?php +require_once "database.php"; + + class Current_Directory + { + public $node_id; + /*an array of the dir_ids taken to reach here*/ + public $path; + + function __construct($user_id) + { + $this->dir_id=get_home_id($user_id); + $this->path=[$dir_id]; + } + function change_directory($directory_id):bool + { + global $database; + if(!$database->is_directory($directory_id)) + { + return false; + } + + } + } + +?> diff --git a/sql/.fileshare.sql.swp b/sql/.fileshare.sql.swp Binary files differnew file mode 100644 index 0000000..504ee7e --- /dev/null +++ b/sql/.fileshare.sql.swp diff --git a/sql/fileshare.sql b/sql/fileshare.sql index 5740a48..247a21e 100644 --- a/sql/fileshare.sql +++ b/sql/fileshare.sql @@ -4,6 +4,8 @@ create table nodes ( relative_path varchar(500) not null, type varchar(20) not null default 'data', name varchar(100) not null default 'no name', + note varchar(200) not null default "", + code char(30) not null default "error", primary key (node_id) ); |