F diff --git a/css/style.css b/css/style.css
--- a/css/style.css
+++ b/css/style.css
z-index: -200;
}
- #loginform {
+ #signupform {
display: none;
}
F diff --git a/loginregister.js b/loginregister.js
--- a/loginregister.js
+++ b/loginregister.js
-
function clear_hero_errors()
{
let errors = document.getElementsByClassName("hero_form_error");
F diff --git a/php/.database.php.swp b/php/.database.php.swp
new file mode 100644
B Binary files /dev/null and b/php/.database.php.swp differ
F diff --git a/php/.node.php.swp b/php/.node.php.swp
new file mode 100644
B Binary files /dev/null and b/php/.node.php.swp differ
F diff --git a/php/database.php b/php/database.php
--- a/php/database.php
+++ b/php/database.php
require_once "configuration.php";
require_once "user.php";
require_once "misc.php";
+ require_once "node.php";
/*handles database stuff*/
class Database
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;
//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
{
}
}
-
+ $database=new Database();
?>
F diff --git a/php/node.php b/php/node.php
new file mode 100644
--- /dev/null
+++ b/php/node.php
+ <?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;
+ }
+
+ }
+ }
+
+ ?>
F diff --git a/sql/.fileshare.sql.swp b/sql/.fileshare.sql.swp
new file mode 100644
B Binary files /dev/null and b/sql/.fileshare.sql.swp differ
F diff --git a/sql/fileshare.sql b/sql/fileshare.sql
--- a/sql/fileshare.sql
+++ b/sql/fileshare.sql
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)
);