diff --git a/classes/DJ.php b/classes/DJ.php new file mode 100644 index 0000000..4aed297 --- /dev/null +++ b/classes/DJ.php @@ -0,0 +1,128 @@ +slug = $slug; + $this->db = $db; + if (!$this->load_from_slug()) { + return false; + } else { + return true; + } + } + + private function load_from_slug(): bool + { + $dj = $this->get_dj_by_slug($this->slug); + if ($dj) { + if (isset($dj['id'])) { + $this->id = $dj['id']; + } + if (isset($dj['name'])) { + $this->name = $dj['name']; + } + if (isset($dj['bio'])) { + $this->bio = $dj['bio']; + } + if (isset($dj['img'])) { + $this->img = $dj['img']; + } + if (isset($dj['email'])) { + $this->email = $dj['email']; + } + if (isset($dj['socials'])) { + $this->socials = json_decode($dj['socials'], true) ?? []; + } + if (isset($dj['created'])) { + $this->created = $dj['created']; + } + if (isset($dj['updated'])) { + $this->updated = $dj['updated']; + } + + return true; + } else { + return false; + } + } + + private function get_dj_by_slug($slug) + { + $stmt = $this->db->prepare("SELECT * FROM djs WHERE slug = ?"); + $stmt->bind_param("s", $slug); + $stmt->execute(); + $result = $stmt->get_result(); + $dj = $result->fetch_assoc(); + $stmt->close(); + return $dj; + } + + public function get_slug(): string + { + return $this->slug; + } + + public function get_id(): int + { + return $this->id; + } + + public function get_name(): string + { + return $this->name; + } + + public function get_bio(): string + { + return $this->bio; + } + + public function get_img(): string + { + return $this->img; + } + + public function get_active(): bool + { + return $this->active; + } + + public function get_email(): string + { + return $this->email; + } + + public function get_socials(): array + { + return $this->socials; + } + + public function get_created(): string + { + return $this->created; + } + + public function get_updated(): string + { + return $this->updated; + } + + +} \ No newline at end of file diff --git a/classes/Database.php b/classes/Database.php index fc77824..5b90b83 100644 --- a/classes/Database.php +++ b/classes/Database.php @@ -7,6 +7,6 @@ class Database extends mysqli public function __construct($config) { // call the parent constructor with the config file - parent::__construct($config['database']['host'], $config['database']['username'], $config['database']['password'], $config['database']['database'], $config['database']['port'] ?? 3306); + parent::__construct($config['database']['host'], $config['database']['user'], $config['database']['pass'], $config['database']['db'], $config['database']['port'] ?? 3306); } } \ No newline at end of file diff --git a/dj.php b/dj.php new file mode 100644 index 0000000..77f6690 --- /dev/null +++ b/dj.php @@ -0,0 +1,246 @@ +get_name() != "") { + $djFound = true; + } +} + + +?> + + +
+ + +$desc1
+$location1
+https://mdbootstrap.com
+mdbootstrap
+@mdbootstrap
+mdbootstrap
+mdbootstrap
+Full Name
+Johnatan Smith
+example@example.com
+Phone
+(097) 234-5678
+Mobile
+(098) 765-4321
+Address
+Bay Area, San Francisco, CA
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+assigment Project + Status +
+Web Design
+Website Markup
+One Page
+Mobile Template
+Backend API
+