From 6c46a622d3a817df5765dd2e4025c4d41bf831ee Mon Sep 17 00:00:00 2001
From: Sibidharan <sibidharan@icloud.com>
Date: Thu, 20 Jan 2022 15:25:27 +0000
Subject: [PATCH] oops

---
 _templates/_signup.php       |  2 +-
 libs/includes/Mic.class.php  | 55 ++++++++++++++++++++++++++++++++++++
 libs/includes/Post.class.php |  0
 libs/includes/User.class.php |  0
 libs/load.php                |  2 ++
 test.php                     | 24 ++++++++++++----
 6 files changed, 77 insertions(+), 6 deletions(-)
 create mode 100644 libs/includes/Mic.class.php
 create mode 100644 libs/includes/Post.class.php
 create mode 100644 libs/includes/User.class.php

diff --git a/_templates/_signup.php b/_templates/_signup.php
index dacf04a2..2a6c7984 100644
--- a/_templates/_signup.php
+++ b/_templates/_signup.php
@@ -1,7 +1,7 @@
 <?php
 
 $signup = false;
-if (isset($_POST['username']) and isset($_POST['password']) and isset($_POST['email_address']) and isset($_POST['phone'])) {
+if (isset($_POST['username']) and isset($_POST['password']) and !empty($_POST['password']) and isset($_POST['email_address']) and isset($_POST['phone'])) {
     $username = $_POST['username'];
     $password = $_POST['password'];
     $email = $_POST['email_address'];
diff --git a/libs/includes/Mic.class.php b/libs/includes/Mic.class.php
new file mode 100644
index 00000000..2cd09354
--- /dev/null
+++ b/libs/includes/Mic.class.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * Access Specifiers
+ * -----------------
+ * pubic
+ * private
+ * protected
+ */
+
+class Mic
+{
+    private $brand;
+    public $color;
+    public $usb_port;
+    public $model;
+    private $light;
+    public $price;
+
+    public function __construct($brand)
+    {
+        printf("Constructing object...");
+        $this->brand = ucwords($brand);
+    }
+
+    public function setLight($light)
+    {
+        $this->light = $light;
+    }
+
+    public function getBrand()
+    {
+        return $this->brand;
+    }
+
+    public function add($a, $b)
+    {
+        return $a+$b;
+    }
+
+    private function getModel()
+    {
+        return $this->model;
+    }
+
+    public function setModel($model)
+    {
+        $this->model = ucwords($model);
+    }
+
+    public function getModelProxy()
+    {
+        return $this->getModel();
+    }
+}
diff --git a/libs/includes/Post.class.php b/libs/includes/Post.class.php
new file mode 100644
index 00000000..e69de29b
diff --git a/libs/includes/User.class.php b/libs/includes/User.class.php
new file mode 100644
index 00000000..e69de29b
diff --git a/libs/load.php b/libs/load.php
index d7e8ec0d..9a434999 100644
--- a/libs/load.php
+++ b/libs/load.php
@@ -1,5 +1,7 @@
 <?php
 
+include_once 'includes/Mic.class.php';
+
 function load_template($name)
 {
     include $_SERVER['DOCUMENT_ROOT']."/app/_templates/$name.php"; //not consistant.
diff --git a/test.php b/test.php
index 4e5eabc9..f3a02010 100644
--- a/test.php
+++ b/test.php
@@ -16,11 +16,25 @@ include 'libs/load.php';
 // print("_COOKIES \n");
 // print_r($_COOKIE);
 
-if (signup("sibidharan", "password", "sibi@selfmade.ninja", "9999999999")) {
-    echo "Success";
-} else {
-    echo "Fail";
-}
+// if (signup("sibidharan", "password", "sibi@selfmade.ninja", "9999999999")) {
+//     echo "Success";
+// } else {
+//     echo "Fail";
+// }
 
+$mic1 = new Mic("Roda"); //constructing the object
+$mic2 = new Mic("HyperX"); //constructing the object
+
+
+$mic1->setLight("White");
+$mic2->setLight("Green");
+
+print(ucwords("hyper quad cast"));
+$mic1->setModel("hyper quad cast");
+print("Model of 1st mic is ".$mic1->getModelProxy());
+print("\n".$mic1->getBrand());
+print("\n".$mic2->getBrand());
+
+print("Value of 10+12 is ".$mic1->add(10, 12));
 ?>
 </pre>
\ No newline at end of file
-- 
GitLab