From 438d3c56d2d6b34195d8e7d83c854ac9a8da1978 Mon Sep 17 00:00:00 2001 From: Raghav <raghavsmart1213@gmail.com> Date: Wed, 26 Mar 2025 04:36:02 +0000 Subject: [PATCH] RDBMS Integration tested --- _includes/Session.class.php | 6 +++--- _includes/User.class.php | 26 ++++++++++++++++++++++++++ _includes/__migration.sql | 2 ++ signup.php | 8 ++++---- testhash.php | 4 +--- 5 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 _includes/__migration.sql diff --git a/_includes/Session.class.php b/_includes/Session.class.php index 28ba8ef..b6a8c8b 100644 --- a/_includes/Session.class.php +++ b/_includes/Session.class.php @@ -41,11 +41,11 @@ class Session // To get the key value public static function get($key, $default = false) { - if(Session::isset($key)){ + // Check if the key exists return key else return default value. + if (Session::isset($key)) { return $_SESSION[$key]; - }else{ + } else { return $default; } - } } diff --git a/_includes/User.class.php b/_includes/User.class.php index 867df2b..b66329c 100644 --- a/_includes/User.class.php +++ b/_includes/User.class.php @@ -66,4 +66,30 @@ class User } } + + // public function __construct($username) + // { + // $this -> conn = Database::getConnection(); + // } + public function authenticate() + { + + } + + public function setBio() + { + + } + public function getBio() + { + + } + public function setAvatar() + { + + } + public function getAvatar() + { + + } } diff --git a/_includes/__migration.sql b/_includes/__migration.sql new file mode 100644 index 0000000..3889a35 --- /dev/null +++ b/_includes/__migration.sql @@ -0,0 +1,2 @@ +-- 24 March, 2025 +ALTER TABLE `auth` ADD `sec_email` varchar(256) NULL; \ No newline at end of file diff --git a/signup.php b/signup.php index dd85d48..3fd1a27 100644 --- a/signup.php +++ b/signup.php @@ -6,7 +6,7 @@ include 'libs/load.php'; <!doctype html> <html lang="en" data-bs-theme="auto"> <!-- To load head --> -<? load_template('head') ?> +<?php load_template('head') ?> <body> <!-- Style for toggle button --> @@ -161,19 +161,19 @@ include 'libs/load.php'; <!--To load header file from template --> - <? load_template('header') ?> + <?php load_template('header') ?> <!-- To load signup-content form to sign-in --> - <? load_template('signup-content'); ?> + <?php load_template('signup-content'); ?> <!-- To load footer (footer.php) from template folder --> - <? load_template('footer'); ?> + <?php load_template('footer'); ?> <script src="/photogram-project-php/assets/dist/js/bootstrap.bundle.min.js"></script> </body> diff --git a/testhash.php b/testhash.php index 100f65b..58fff8c 100644 --- a/testhash.php +++ b/testhash.php @@ -11,13 +11,11 @@ echo "string length: " . strlen($str) . "\n"; echo "md5: ". md5($str) . "(length: ". strlen(md5($str)) . ")\n"; echo "base64: ". base64_encode($str) . "\n(Length: ". strlen(base64_encode($str)) . ")"; -// Testing type of hashing in php +// Testing type of hashing in php $data = "hello"; - - foreach (hash_algos() as $v) { $r = hash($v, $data, false); -- GitLab