<html> <p><h4>Login</h4></p> <form method="post" action="login.php"> Username : <p> <input type="text" name="username"/> </p> Password : <p> <input type="password" name="password"/> </p> <input type="submit" name="submit" value="Login"/> </form> <?php if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; require_once '../class/Factory.php'; $account = Factory::getClass('userAccount'); $user = $account->login($username, $password); } ?> </html>
public function __construct() { $this->objUser = Factory::getClass("Db"); }
<?php session_start(); ?> <html> <p> <a href="admin.php">Home</a> </p> <?php require_once '../class/Factory.php'; $obj = Factory::getClass("userAccount"); $id = isset($_GET['id']) ? $_GET['id'] : ''; if ($id != '') { $getData = $obj->getEditUser(array('id' => $id)); } $mode = isset($_GET['q']) ? 'edit' : 'new'; ?> <form method="post" action="../proccess/processUser.php"> Nim : <p> <input type="text" name="nim" value="<?php echo isset($getData->nim) ? $getData->nim : ''; ?> "/> </p> Nama : <p> <input type="text" name="nama" value="<?php echo isset($getData->nama) ? $getData->nama : ''; ?>
$page = isset($_GET['nav']) ? $_GET['nav'] : 1; $limit = 3; $offset = (empty($page) or $page == 1) ? 0 : ($page - 1) * $limit; $getData = $user->query("SELECT * FROM mhs LIMIT {$offset},{$limit}")->result(); $totalRows = $user->get('mhs')->num_rows(); foreach ($getData as $data) { echo ' <tr> <td>' . $data->nim . '</td> <td>' . $data->nama . '</td> <td>' . $data->alamat . '</td> <td><a href="../proccess/delete.php?id=' . urlencode($data->id) . '">Delete</a> | <a href="add_user_view.php?q=edit&id=' . urlencode($data->id) . '">Edit</a></td> </tr> '; } ?> </tbody> </table> </p> <p> <?php $config = array('limit' => $limit, 'url' => $_SERVER['PHP_SELF'] . '?', 'total_data' => $totalRows, 'uri_segment' => $page); $paging = Factory::getClass("Pagination"); echo $paging->create_page($config); ?> </p> </html>