/** * * @param type $email string * @return type */ public function albumExist($email) { try { $conn = parent::connectDb(); $qString = "SELECT `user_id` FROM `user-info` WHERE `user_email` = :user_email"; $q = $conn->prepare($qString); $q->execute(array("user_email" => $email)); return $q->fetchColumn(); } catch (Exception $e) { echo $e->getMessage(); return false; } }
/** * * @param type $userEmail * @param type $userPassword * @return boolean */ public function userRegister($userEmail, $userPassword) { if (parent::insertData("user-info", array('user_email', 'user_password', 'is_active', 'user_type'), array($userEmail, MD5($userPassword), '0', '0'))) { $str = 'abcdefghijklmnopqrstuvwxyz1234567890'; $shuffled = str_shuffle($str); $message = "Please got to http://localhost/photo-album/activate.php and use '" . $shuffled . "' to activate your account \r\n"; if (mail($userEmail, 'Please Activate Your Account', $message)) { parent::updateData("user-info", array('activate_code'), array($shuffled), 'user_email', $userEmail); $_SESSION['log-msg'] = "You have successfuly Registered, Please check your email to activate."; } return true; } else { $_SESSION['log-msg'] = "Please Try again later"; return false; } }
<?php session_start(); include_once "photoalbumDatabase.php"; $photoalbumDatabase = new photoalbumDatabase(); if (isset($_GET['id'])) { if ($photoalbumDatabase->removeById("image-info", "image_id", $_GET['id'])) { $_SESSION['msg'] = "Image Successfully Removed."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Photo Album Management</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div style="width:860px; margin: 0 auto;"> <h1>Welcome, <?php echo $_SESSION['user_email']; ?> , Photo Album Management</h1> <a href="upload-image.php">Add New Image</a> <table align="left" width="500"> <tr> <th><input type="button" name="remove-all" value="Remove All" onclick="removeAll();" /> <input type="button" name="remove-selected" onclick="removeSelected()" value="Remove Selected" /> </th> <th width="30%" align="left">Image Name</th> <th width="40%" align="left">Image Source</th> <th width="30%" align="left">Edit</th> </tr>
<?php require_once 'photoalbumDatabase.php'; $dbAction = new photoalbumDatabase(); if (isset($_GET['id'])) { $dbAction->removeRow($_GET['token'] . "_" . $_GET['id'], $_GET['token'] . "_info"); }
/** * */ public function __construct() { parent::__construct(); $this->connection = parent::connectDb(); }
<?php session_start(); require_once 'photoalbumDatabase.php'; $dbAction = new photoalbumDatabase(); $photoAlbum = $dbAction->showAllLeftJoin("user-info", array('user_id', 'user_email', 'is_active'), "image-info", array('', '', '')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Photo Album Management</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div style="width:860px; margin: 0 auto;"> <h1>Photo Album Admin</h1> <div style="width:420px; float: right;"> <table> <tr> <th>User Id</th> <th>User Email</th> <th>Is Active</th> <th>Edit</th> </tr> <?php foreach ($photoAlbum as $value) { ?> <tr> <td>User Id</td> <td>User Email</td> <td>Is Active</td>