diff --git a/_templates/_signup.php b/_templates/_signup.php index dacf04a2ac67cbdc09cc312af29884991a43fe5b..2a6c79840d60dfc208d73881f9ffcabfd45b52c2 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 0000000000000000000000000000000000000000..2cd09354239bf07a20970c8ce23d97d7916bdd35 --- /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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/libs/includes/User.class.php b/libs/includes/User.class.php new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/libs/load.php b/libs/load.php index d7e8ec0d1199863d5e00c5d1280656d2a0688031..9a434999eada86a41cff3313b3032f315334a3f3 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 4e5eabc9cbcaa73fcfcaaa4b2c625301a9ca4096..f3a020109be64e274d039af0c3f1d432ab5f82ab 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