public function verifyDatabase() { $db = new DatabaseConstants(); $dBase = new DBase($db->getHost(), $db->getUser(), $db->getPass()); $dBase->setDatabaseName($db->getDb()); if (!$dBase->connectDatabase()) { die('SQL ERROR at db class vd fn'); } $loginQuery = mysqli_query($dBase->getDbobj(), "SELECT id FROM members WHERE username=\"" . $this->_username . "\" AND passmd5=\"" . $this->_passmd5 . "\""); if (mysqli_num_rows($loginQuery)) { $loginData = mysqli_fetch_assoc($loginQuery); $this->_id = $loginData['id']; return true; } else { return false; } // while($loginData = mysqli_fetch_assoc($loginQuery)) { // if($loginData['username'] == $this->_username){ // echo 'gothere<br>'; // return true; // } // } // return false; }
include '../uses_classes/class.Login.php'; $login = new Login(); if ($login->isLoggedIn()) { $siteConstant->loggedIn = true; $siteConstant->addFile('css', 'account.css'); echo $siteConstant->getHead(); echo $siteConstant->getMenu(); } else { include 'logout.php'; header('location: index.php'); } if ($siteConstant->loggedIn) { require_once '../uses_constants/class.DatabaseConstants.php'; require_once '../uses_classes/class.DBase.php'; $db = new DatabaseConstants(); $dBase = new DBase($db->getHost(), $db->getUser(), $db->getPass()); $dBase->setDatabaseName($db->getDb()); if (!$dBase->connectDatabase()) { die('SQL ERROR at db class vd fn'); } $siteQuery = mysqli_query($dBase->getDbobj(), 'SELECT title,link,header FROM siteinfo WHERE id=1'); $siteData = mysqli_fetch_assoc($siteQuery); $userQuery = mysqli_query($dBase->getDbobj(), "SELECT * FROM members WHERE username=\"" . $_SESSION['username'] . "\""); if (mysqli_num_rows($userQuery)) { $userData = mysqli_fetch_assoc($userQuery); } else { die('User Not Found!'); } ?> <div style="padding-top: 100px">
public function validData() { if ($this->password != $this->cpassword) { $this->errors[] = 'Passwords does not match'; } if ($this->country == "Country...") { $this->errors[] = 'You must select a valid country'; } $db = new DatabaseConstants(); $dBase = new DBase($db->getHost(), $db->getUser(), $db->getPass()); $dBase->setDatabaseName($db->getDb()); if (!$dBase->connectDatabase()) { die('SQL ERROR at db class vd fn'); } $qry = "Select username FROM members WHERE username=\"" . $this->username . "\""; $res = mysqli_query($dBase->getDbobj(), $qry); if (mysqli_num_rows($res)) { $this->errors[] = 'Username Already Taken!'; } $qry = "Select email FROM members WHERE email=\"" . $this->email . "\""; $res2 = mysqli_query($dBase->getDbobj(), $qry); if (mysqli_num_rows($res2)) { $this->errors[] = 'Email Address is Already registered!'; } return count($this->errors) ? false : true; }