<?php if (!isset($_GET['choose'])) { include '../library/loader.php'; } $id = $_GET['id']; $order = $_GET['order']; $tbl_name = $_GET['tbl']; $tbl = new table($tbl_name); $field = array('ordering'); $values = array(format($order, 0)); $res = $tbl->updateObject($field, $values, 'id=' . $id);
$field = array('name', 'pass'); if (isset($_POST["name"]) && $_POST["name"] != '') { $name = $_POST["name"]; if (!Validator($name)) { echo "<script language='javascript'>alert('Địa chỉ email không phù hợp!');</script>"; } else { if (isset($_POST["pass"]) && $_POST["pass"] != "") { $pass = $_POST["pass"]; $crypt = encrypt_decrypt('encrypt', $pass); //var_dump($crypt); /*$decrypt = encrypt_decrypt('decrypt', $crypt); var_dump($decrypt);*/ if ($row) { if ($crypt != $row->pass && $name != $row->name) { $values = array(format($_POST["name"], 0), format($crypt, 0)); $res = $tbl->updateObject($field, $values, 'id=1'); //var_dump($res); if ($res) { echo "Update thành công!!!!"; $res = $tbl->loadOne('id=1'); $row = mysql_fetch_object($res); } } } else { $values = array(format($_POST["name"], 0), format($crypt, 0)); $res = $tbl->updateObject($field, $values, 'id=1'); //var_dump($res); if ($res) { echo "Update thành công!!!!"; $res = $tbl->loadOne('id=1'); $row = mysql_fetch_object($res);
<?php if (isset($_GET["username"])) { $username = $_GET["username"]; } $tbl = new table('admin'); if (isset($_POST["done"])) { // get field $field = array('name', 'password'); // get value $values = array(format($_POST["name"], 0), format(md5($_POST["password"]), 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'per <> 0 and username='******'username=' . format($username, 0)); if ($res) { $row = mysql_fetch_array($res); ?> <div id="center-column"> <div class="top-bar"> <h1>Admin</h1> <div class="breadcrumbs"><a href="#">Content</a> / <a href="#">Sửa</a></div> </div><br /> <div class="table"> <img src="img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
$username = format($_SESSION["log"], 0); // check old password $password = format(md5($_POST["password"]), 0); $res = $tbl->login($username, $password); if ($res == 0) { echo "Wrong Password!!!"; } else { if ($_POST["newpassword"] != $_POST["againpassword"]) { echo "Again new password wrong!!!"; } else { // get field $field = array('name', 'password'); // get value $values = array(format($_POST["name"], 0), format(md5($_POST["newpassword"]), 0)); // updateObject($field=array(),$value=array(),$where) $res = $tbl->updateObject($field, $values, 'username='******'location: ' . loadPage('')); } } } } $res = $tbl->loadOne('username="******"log"] . '"'); if ($res) { $row = mysql_fetch_array($res); ?> <div id="center-column"> <div class="top-bar"> <h1>Change Password</h1> <div class="breadcrumbs"><a href="#">Content</a> / <a href="#">Sửa</a></div> </div><br />