aboutsummaryrefslogtreecommitdiffstats
path: root/php
diff options
context:
space:
mode:
authorAlex Vitkov <alexvitkov98@gmail.com>2021-01-29 13:43:53 +0200
committerAlex Vitkov <alexvitkov98@gmail.com>2021-01-29 13:43:53 +0200
commitdcf61354050bfe81d6983f1aec34d7d3d6733a0d (patch)
tree87535d87bc498d8d852f30bb1de96864d68e9ba4 /php
parent33e533d28dbf9ad7bfc7ad9af467e5efe25ae8a0 (diff)
downloadfileup-dcf61354050bfe81d6983f1aec34d7d3d6733a0d.tar.gz
index.html + login.html => index.php
those files had the entire HTML tree duplicated, which would make it difficult to make any changes to the front end. this commit combines the two files in one, with some front-end JS to switch between the login and register forms.
Diffstat (limited to 'php')
-rw-r--r--php/configuration.php18
-rw-r--r--php/database.php8
-rw-r--r--php/misc.php5
-rw-r--r--php/register.php7
4 files changed, 20 insertions, 18 deletions
diff --git a/php/configuration.php b/php/configuration.php
index 6b87508..89efb2a 100644
--- a/php/configuration.php
+++ b/php/configuration.php
@@ -3,15 +3,21 @@
$domain_name="localhost";
-$database_name="adam";
-$database_username="adam";
-$database_password="asdfd";
-$database_location="127.0.0.1";
-
+if (file_exists("/home/alex")) {
+ $database_name="alex";
+ $database_username="alex";
+ $database_password="lol";
+ $database_location="127.0.0.1";
+}
+else {
+ $database_name="adam";
+ $database_username="adam";
+ $database_password="asdfd";
+ $database_location="127.0.0.1";
+}
$password_hash_algo=PASSWORD_BCRYPT;
-
$has_email_verification=false;
?>
diff --git a/php/database.php b/php/database.php
index ef2b825..f472cbf 100644
--- a/php/database.php
+++ b/php/database.php
@@ -16,14 +16,8 @@ require_once "misc.php";
global $database_username;
global $database_password;
global $database_location;
- try
- {
+
$this->pdo=new PDO("mysql:dbname={$database_name};host={$database_location}",$database_username,$database_password);
- }catch(PDOException $e)
- {
- error_log("Could not get database {$database_name} from {$database_location}, {$e} ");
- die("The cow bought the farm");
- }
}
/*returns false if this isn't a user, otherwise returns the user*/
diff --git a/php/misc.php b/php/misc.php
index 3ab0277..69cd654 100644
--- a/php/misc.php
+++ b/php/misc.php
@@ -1,11 +1,6 @@
<?php
require_once "user.php";
-function validate_credentials(string $username,string $email,string $password,string $password2) : bool
-{
- return true;
-}
-
function generate_email_verification_link()
{
/*TODO*/
diff --git a/php/register.php b/php/register.php
index b6b164c..ef1f238 100644
--- a/php/register.php
+++ b/php/register.php
@@ -8,6 +8,13 @@ $password=$_POST["password"];
$password2=$_POST["password2"];
$email=$_POST["email"];
+
+function validate_credentials(string $username,string $email,string $password,string $password2) : bool
+{
+ return true;
+}
+
+
/*check if we are given shady credentials*/
if(!validate_credentials($username,$email,$password,$password2))
{