public function logLogin($user) { $user = $user->id_str; $date = date('Y-m-d H:i:s'); $sql = "INSERT INTO login(date, oauth_uid) VALUES ('{$date}',{$user})"; Database::performQuery($sql); }
public function getAll() { $sql = "SELECT * FROM privileges"; $database = new Database(); $result = $database->performQuery($sql); $database->disconnectDb(); return $result; }
<?php require_once 'database.php'; $hash = $_GET['x']; $email = $_GET['email']; $query = "SELECT * FROM users WHERE active='" . $hash . "' AND email='" . $email . "' "; $database = new Database(); $result = $database->performQuery($query); if (mysql_num_rows($result) == 1) { $query = "UPDATE users SET active='active' WHERE email='" . $email . "' "; $result = $database->performQuery($query); } else { header('Location:index.php'); }
public function unpublishArticle($id) { $sql = "UPDATE article SET published=0 WHERE id LIKE {$id}"; Database::performQuery($sql); $content = '<section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="fancy-title title-border topmargin"> <h4>Admin Dashboard</h4> </div> <a href="' . BASE_URL . '/?go=manageRsvp" class="button button-desc button-rounded button-red center">Manage RSVPs<span></span></a> <a href="' . BASE_URL . '/?go=manageEvents" class="button button-desc button-rounded button-green center">Manage Events<span></span></a> <a href="' . BASE_URL . '/?go=manageBlog" class="button button-desc button-rounded button-teal center">Manage Blogs<span></span></a> </div> <div class="alert alert-success"> <strong>Successfully!</strong> Unpublished Article. </div> </div> </div> </section> '; return $content; }
public function DoRegAddress() { $street1 = Database::prepData($_POST['street1']); $street2 = Database::prepData($_POST['street2']); $type = Database::prepData($_POST['type']); $city = Database::prepData($_POST['city']); $state = Database::prepData($_POST['state']); $zip = Database::prepData($_POST['zip']); $country = Database::prepData($_POST['country']); $user = $_SESSION['user_id']; $sql = "INSERT INTO `useraddress`(`address_type_id`, `Street1`, `Street2`, `City`, `State`, `ZIP`, `Country`, `user_id`) \n\t\t\tVALUES ('{$type}','{$street1}','{$street2}','{$city}','{$state}','{$zip}','{$country}','{$user}')"; Database::performQuery($sql); redirect_to(BASE_URL . '/Dashboard.html'); }
public function manageRsvp() { $content = ' <section id="content"> <div class="content-wrap"> <div class="container clearfix"> <div class="fancy-title title-border topmargin"> <h4>Manage RSVPs</h4> </div> <table class="table table-striped table-bordered table-hover" id="sample_1"> <thead> <tr> <th>ID</th> <th >Parent Name</th> <th >Telephone</th> <th >Email</th> <th >Number of Kids</th> <th >Kids Details</th> </tr> </thead> <tbody>'; $sub_sql = "SELECT COUNT(*) AS count FROM rsvp"; $result_pag_num = Database::performQuery($sub_sql); $row = $result_pag_num->fetch_assoc(); $num_rows = $row['count']; $pages = new Paginator($num_rows, 9, array(3, 5, 10, 12, 15, 20, 25, 30, 50, 100, 250, 'All')); //$content .= $pages->display_pages(); $sql = "SELECT * FROM rsvp ORDER BY id DESC LIMIT " . $pages->limit_start . "," . $pages->limit_end; $result = Database::performQuery($sql); while ($data = $result->fetch_assoc()) { $content .= '<tr class="odd gradeX"> <td>' . $data['id'] . '</td> <td >' . $data['parent'] . '</td> <td >' . $data['phone'] . '</td> <td class="center">' . $data['email'] . '</td> <td class="center">' . $data['numkids'] . '</td> <td >' . $data['kids'] . '</td> </tr>'; } $content .= '<tr><td colspan="4">' . $pages->display_pages() . '</td><td colspan="1">' . $pages->display_jump_menu() . '</td><td colspan="1">' . $pages->display_items_per_page() . '</td></tr>'; $content .= ' </tbody> </table> </div></div></section> '; return $content; }
private function sendResetEmail($to) { $msg = md5(rand(0, 1000)); //creating new password $sql = 'UPDATE users SET password = '******' WHERE email = ' . $to . ' '; $email = new Email(); $subject = 'Reset Credentials'; // Give the email a subject $message = ' Your account password is reset and you can now login with the following password, do change your password once you login. ------------------------ Password : '******' ------------------------ '; if ($email->sendEmail($to, $subject, $message)) { $database = new Database(); $result = $database->performQuery($sql); echo 'Reset Email successfully sent'; } else { echo 'An error occurred! Please try after sometime!'; } }
public function changePrivilege() { $database = new Database(); $sql = "UPDATE users SET privilegeId = '{$this->privilegeId}' WHERE userId = {$this->id}"; $query = $database->performQuery($sql); $database->disconnectDb(); return $query; }