diff --git a/public/auth/login/index.php b/public/auth/login/index.php
new file mode 100644
index 0000000..e1cab54
--- /dev/null
+++ b/public/auth/login/index.php
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+ Login | Chiro - Canto
+
+
+
+
+
+
+ Login
+ =(isset($_SESSION['error_msg']) and ! $_SESSION['error_msg'] == "" ) ? ''.$_SESSION['error_msg'].'
' : ""?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/auth/login/login.php b/public/auth/login/login.php
new file mode 100644
index 0000000..f16228e
--- /dev/null
+++ b/public/auth/login/login.php
@@ -0,0 +1,80 @@
+ PDO::ERRMODE_EXCEPTION
+ ));
+ }catch (Exception $e){
+ die("Error : ".$e->getMessage());
+ }
+ $req = $db->prepare('SELECT password FROM `authors` WHERE `username`=:username');
+ $req->execute(array(
+ "username"=>$username,
+ ));
+ if ($data = $req->fetch()){
+ $password_hash = $data['password'];
+ if (password_verify($userpw, $password_hash)) {
+ echo "Error 1";
+ return True;
+ } else {
+ echo "Error";
+ return False;
+ }
+ } else {
+ echo "Error 0";
+ return False;
+ }
+
+}
+
+$_SESSION['error_msg'] = "";
+
+if (isset($_POST['submit']))
+{
+ if (isset($_POST['username']))
+ {
+ $username = $_POST['username'];
+ } else
+ {
+ $_SESSION['error_msg'] .= "You did not enter a proper username.\n";
+ }
+ if (isset($_POST['password'])) {
+ $password = $_POST['password'];
+ } else {
+ $_SESSION['error_msg'] .= "You did not enter a proper password.\n";
+ }
+} else
+{
+ $_SESSION['error_msg'] .= "You did not submit the register form.\n";
+}
+
+if ($_SESSION['error_msg'] == "")
+{
+
+ if (check_credentials($username, $password))
+ {
+ $_SESSION['logged'] = True;
+ $_SESSION['username'] = $username;
+ header('Location: '."/");
+ } else {
+ $_SESSION['error_msg'] = "Incorrect password, please try again.\n";
+ header('Location: '."../../auth/login");
+ }
+} else
+{
+ // header('Location: '."../../auth/login");
+}
+?>
\ No newline at end of file
diff --git a/public/auth/register/index.php b/public/auth/register/index.php
new file mode 100644
index 0000000..f9034c0
--- /dev/null
+++ b/public/auth/register/index.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+ Register | Chiro - Canto
+
+
+
+
+
+
+ Register
+ =(isset($_SESSION['error_msg']) and ! $_SESSION['error_msg'] == "") ? ''.$_SESSION['error_msg'].'
' : ""?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/auth/register/register.php b/public/auth/register/register.php
new file mode 100644
index 0000000..4092825
--- /dev/null
+++ b/public/auth/register/register.php
@@ -0,0 +1,85 @@
+ PDO::ERRMODE_EXCEPTION
+ ));
+ }catch (Exception $e){
+ die("Error : ".$e->getMessage());
+ }
+ $req = $db->prepare('INSERT INTO `authors` (`id`, `firstname`, `lastname`, `username`, `email`, `website`, `password`, `entry_timestamp`) VALUES (NULL, :fname, :lname, :username, :email, :website, :password, current_timestamp());');
+ $req->execute(array(
+ 'fname' => $fname,
+ 'lname' => $lname,
+ 'username' => $username,
+ 'email' => $email,
+ 'website' => $website,
+ 'password' => $password_hash
+ ));
+}
+
+$_SESSION['error_msg'] = "";
+
+if (isset($_POST['submit']))
+{
+ if (isset($_POST['firstname']))
+ {
+ $fname = $_POST['firstname'];
+ } else
+ {
+ $_SESSION['error_msg'] .= "You did not enter a proper first name.\n";
+ }
+ if (isset($_POST['lastname']))
+ {
+ $lname = $_POST['lastname'];
+ } else
+ {
+ $_SESSION['error_msg'] .= "You did not enter a proper last name.\n";
+ }
+ if (isset($_POST['username']))
+ {
+ $username = $_POST['username'];
+ } else
+ {
+ $_SESSION['error_msg'] .= "You did not enter a proper username.\n";
+ }
+ if (isset($_POST['email']))
+ {
+ $email = $_POST['email'];
+ } else
+ {
+ $_SESSION['error_msg'] .= "You did not enter a proper email address.\n";
+ }
+ $website = isset($_POST['website']) ? $_POST['website'] : "";
+ if (isset($_POST['password'])) {
+ $password_hash = password_hash($_POST['password'], PASSWORD_DEFAULT);
+ } else {
+ $_SESSION['error_msg'] .= "You did not enter a proper password.\n";
+ }
+} else
+{
+ $_SESSION['error_msg'] .= "You did not submit the register form.\n";
+}
+
+if ($_SESSION['error_msg'] == "")
+{
+ database_entry($fname, $lname, $username, $password_hash, $email, $website, $password);
+ header('Location: '."../../auth/login");
+} else
+{
+ header('Location: '."../../auth/register");
+}
+?>
\ No newline at end of file
diff --git a/public/database/chiro-canto.odb b/public/database/chiro-canto.odb
deleted file mode 100644
index 4d9d43d..0000000
Binary files a/public/database/chiro-canto.odb and /dev/null differ
diff --git a/public/database/create_authors.sql b/public/database/create_authors.sql
new file mode 100644
index 0000000..cb7c415
--- /dev/null
+++ b/public/database/create_authors.sql
@@ -0,0 +1,2 @@
+Preview SQL
+CREATE TABLE `chirocanto`.`authors` ( `id` INT NOT NULL AUTO_INCREMENT , `firstname` VARCHAR(125) NOT NULL , `lastname` VARCHAR(125) NOT NULL , `email` VARCHAR(125) NOT NULL , `website` VARCHAR(125) NOT NULL , `entry_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB;
\ No newline at end of file
diff --git a/public/database/create_record.sql b/public/database/create_record.sql
new file mode 100644
index 0000000..3321ef4
--- /dev/null
+++ b/public/database/create_record.sql
@@ -0,0 +1,16 @@
+CREATE TABLE IF NOT EXISTS `chirocanto`.`records`
+( `id` INT NOT NULL AUTO_INCREMENT ,
+ `entry_timestamp` INT NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp when entered in database' ,
+ `author_id` INT NOT NULL COMMENT 'author_id associated with author table' ,
+ `file_name` VARCHAR(125) NOT NULL COMMENT 'Name of uploaded file.' ,
+ `license` VARCHAR(25) NOT NULL COMMENT 'License of uploaded file.' ,
+ `species` VARCHAR(50) NOT NULL COMMENT 'Species of uploaded sound.' ,
+ `subspecies` VARCHAR(50) NOT NULL COMMENT 'Subspecies of uploaded sound.' ,
+ `sound_type` VARCHAR(25) NOT NULL COMMENT 'Sound type of the file.' ,
+ `coordinates` POINT NOT NULL COMMENT 'Coordinates of the record.' ,
+ `country` VARCHAR NOT NULL COMMENT 'Country of the record.' ,
+ `date` DATE NOT NULL COMMENT 'Date of the record.' ,
+ `time` TIME NOT NULL COMMENT 'Time of the record.' ,
+ `remarks` TEXT NOT NULL COMMENT 'Remarks given for this record.' ,
+ PRIMARY KEY (`id`))
+ ENGINE = InnoDB;
diff --git a/public/database/database entries.txt b/public/database/database entries.txt
new file mode 100644
index 0000000..3e6d9c3
--- /dev/null
+++ b/public/database/database entries.txt
@@ -0,0 +1,23 @@
+database entries:
+# records
+id
+timestamp entry
+author_id
+recordist_name
+file_name
+license
+species
+subspecies
+sound type
+coordinates
+country
+date
+time
+remarks
+
+# authors
+id
+firstname
+lastname
+email
+website
diff --git a/public/styles/style.css b/public/styles/style.css
index 75af274..ae79add 100644
--- a/public/styles/style.css
+++ b/public/styles/style.css
@@ -79,7 +79,7 @@ input {
}
/* Style inputs with type="text", select elements and textareas */
-input[type=text], input[type=email], input[type=url], select, textarea {
+input[type=text], input[type=email], input[type=url], input[type=password], select, textarea {
width: 100%; /* Full width */
padding: 12px; /* Some padding */
border: 1px solid #ccc; /* Gray border */
@@ -239,4 +239,11 @@ div.coordinates input[type="text"] {
.sci-name {
font-style: italic;
+}
+
+.error {
+ border: solid red;
+ border-radius: 5px;
+ padding: 0.5em;
+ background-color: rgba(255, 0, 0, 0.4)
}
\ No newline at end of file
diff --git a/public/upload/characteristics.php b/public/upload/characteristics.php
deleted file mode 100644
index e69de29..0000000
diff --git a/public/upload/index.php b/public/upload/index.php
index 4c25eae..e006018 100644
--- a/public/upload/index.php
+++ b/public/upload/index.php
@@ -1,8 +1,10 @@
+
getMessage());
}
-/* Create Table if not exists */
-$req = $db->prepare('CREATE TABLE IF NOT EXISTS golden_book ( `id` INT NOT NULL AUTO_INCREMENT , `firstname` VARCHAR(25) NOT NULL , `lastname` VARCHAR(25) NOT NULL , `email` VARCHAR(125) NOT NULL, `date` DATE NOT NULL DEFAULT CURRENT_TIMESTAMP , `message` TEXT NOT NULL , `website` VARCHAR(125) NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;');
-$req->execute();
+// /* Create Table if not exists */
+// $sql = file_get_contents($root."/database/create_record.sql");
+// $db->exec($sql);
+
?>
diff --git a/public/upload/verify.php b/public/upload/verify.php
index e3898fb..5924134 100644
--- a/public/upload/verify.php
+++ b/public/upload/verify.php
@@ -65,7 +65,7 @@
-