function login() { global $conn; if (postExist(array('username', 'password'))) { $username = sanitizeString($_POST['username']); $password = sanitizeString($_POST['password']); try { $response = $conn->prepare("SELECT * FROM users WHERE username = :username"); $response->bindParam(':username', $username, \PDO::PARAM_STR); $response->execute(); $datas = $response->fetchAll(); if (isset($datas[0])) { if (password_verify($password, $datas[0]['password'])) { initSession($datas[0]['id'], $username, 0); redirect('chat.php'); } else { echo 'Your password does not match your username'; } } else { echo 'Your username has not been found'; } } catch (Exception $e) { die("An error occured : " . $e); } } else { var_dump($_POST); die; } }
function execute() { $message = $this->message; $status = $this->status; $sourcePath = $this->sourcePath; //create default easy blog config if (!configExist()) { if (!createConfig()) { $message[] = 'Warning : The system encounter an error when it tries to create default config. Please kindly configure your Easy Blog manually.'; } } //update Db columns first before proceed. updateEasyBlogDBColumns(); //check if need to create default category if (!blogCategoryExist()) { if (!createBlogCategory()) { $message[] = 'Warning : The system encounter an error when it tries to create default blog categories. Please kindly create the categories manually.'; } } //check if need to create sample post if (!postExist()) { if (!createSamplePost()) { $message[] = 'Warning : The system encounter an error when it tries to create some sample post.'; } } //check if twitter table exist. if (twitterTableExist()) { //migrate twitter data if the table exist if (!twitterTableMigrate()) { $message[] = 'Warning : The system encounter an error when it tries to migrate your social share data to a new table. Please kindly migrate the data manually.'; } else { if (!twitterTableRemove()) { $message[] = 'Warning : The system encounter an error when it tries to remove the unused twitter table. Please kindly remove the table manually.'; } } } //truncate the table before recreating the default acl rules. if (!truncateACLTable()) { $message[] = 'Fatal Error : The system encounter an error when it tries to truncate the acl rules table. Please kindly check your database permission and try again.'; $status = false; } //update acl rules if (!updateACLRules()) { $message[] = 'Fatal Error : The system encounter an error when it tries to create the ACL rules. Please kindly check your database permission and try again.'; $status = false; } else { //update user group acl rules if (!updateGroupACLRules()) { $message[] = 'Fatal Error : The system encounter an error when it tries to create the user groups ACL rules. Please kindly check your database permission and try again.'; $status = false; } } //install default plugin. if (!installDefaultPlugin($sourcePath)) { $message[] = 'Warning : The system encounter an error when it tries to install the user plugin. Please kindly install the plugin manually.'; } if (!copyMediaFiles($sourcePath)) { $message[] = 'Warning: The system could not copy files to Media folder. Please kindly check the media folder permission.'; $status = false; } // migrating stream records from old JS to JS 2.8 migrateJomSocialStreamNameSpace(); if ($status) { $message[] = 'Success : Installation Completed. Thank you for choosing Easy Blog.'; } $this->message = $message; $this->status = $status; return $status; }