Example #1
0
function get_site_name()
{
    global $db_config;
    $db = new Db($db_config);
    $settings = $db->row("SELECT * FROM `settings`");
    return $settings['site_name'];
}
Example #2
0
 public function dispatch()
 {
     $row = Db::row("SELECT empresas.id_empresas\n                  , empresas.nombre\n                  , empresas.direccion_1\n                  , empresas.direccion_2\n                  , empresas.ciudad\n                  , empresas.estado\n                  , empresas.cod_postal\n                  , empresas.web\n                  , empresas.tel_oficina\n                  , empresas.tel_fax\n                  , empresas.logo\n                  , paises.id_paises\n                  , paises.nombre AS pais\n             FROM empresas\n             LEFT JOIN paises ON paises.id_paises = empresas.id_paises\n             WHERE empresas.id_empresas = '{$this->idEmpresas}'");
     $direccion = String::format("{%s}{ %s}", $row['direccion_1'], $row['direccion_2']);
     $lugar = String::format("{%s}{, %s}{ (%s)}", $row['ciudad'], $row['estado'], $row['cod_postal']);
     $this->data = array('nombre' => $row['nombre'], 'direccion_1' => $row['direccion_1'], 'direccion_2' => $row['direccion_2'], 'direccion' => $direccion, 'lugar' => $lugar, 'id_paises' => $row['id_paises'], 'pais' => $row['pais'], 'ciudad' => $row['ciudad'], 'estado' => $row['estado'], 'cod_postal' => $row['cod_postal'], 'tel_oficina' => $row['tel_oficina'], 'tel_fax' => $row['tel_fax'], 'web' => $row['web'], 'logo' => $row['logo']);
     parent::dispatch();
 }
Example #3
0
 public function dispatch()
 {
     $row = Db::row("SELECT personas.id_personas\n                  , personas.nombre\n                  , personas.apellido\n                  , personas.correo\n                  , personas.usuario\n                  , personas.cargo\n                  , personas.tel_oficina\n                  , personas.tel_oficina_int\n                  , personas.tel_celular\n                  , personas.tel_fax\n                  , personas.tel_casa\n                  , personas.foto\n                  , empresas.id_empresas\n                  , empresas.nombre AS empresa\n             FROM personas\n             INNER JOIN empresas ON empresas.id_empresas = personas.id_empresas\n             WHERE personas.id_personas = '{$this->idPersonas}'");
     $nombreCompleto = String::format("{%s}{ %s}", $row['nombre'], $row['apellido']);
     $telOficinaCompleto = String::format("{%s}{ x%s}", $row['tel_oficina'], $row['tel_oficina_int']);
     $this->data = array('nombre_completo' => $nombreCompleto, 'nombre' => $row['nombre'], 'apellido' => $row['apellido'], 'cargo' => $row['cargo'], 'correo' => $row['correo'], 'usuario' => $row['usuario'], 'tel_oficina_completo' => $telOficinaCompleto, 'tel_oficina' => $row['tel_oficina'], 'tel_oficina_int' => $row['tel_oficina_int'], 'tel_celular' => $row['tel_celular'], 'tel_fax' => $row['tel_fax'], 'tel_casa' => $row['tel_casa'], 'foto' => $row['foto']);
     parent::dispatch();
 }
Example #4
0
 public static function start()
 {
     if (self::$started) {
         return;
     }
     self::read();
     self::$started = true;
     $result = Db::row("SELECT u.id_personas\n                  , CONCAT(u.nombre, ' ', u.apellido) AS nombre\n             FROM personas u\n             WHERE u.usuario = '" . self::$usuario . "'\n               AND u.contrasena = '" . self::$contrasena . "'\n             LIMIT 1");
     self::$id = $result['id_personas'];
     self::$nombre = $result['nombre'];
 }
Example #5
0
 public static function find($where = array())
 {
     $sql = "select * from pages";
     $args = array();
     if (count($where)) {
         $clause = array();
         foreach ($where as $key => $value) {
             $clause[] = '`' . $key . '` = ?';
             $args[] = $value;
         }
         $sql .= " where " . implode(' and ', $clause);
     }
     return static::extend(Db::row($sql, $args));
 }
Example #6
0
 public static function find($where = array())
 {
     $sql = "select * from users";
     $args = array();
     if (isset($where['hash'])) {
         $sql .= " where md5(concat(`id`, `email`, `password`)) = ? limit 1";
         $args[] = $where['hash'];
         // reset clause
         $where = array();
     }
     if (count($where)) {
         $clause = array();
         foreach ($where as $key => $value) {
             $clause[] = '`' . $key . '` = ?';
             $args[] = $value;
         }
         $sql .= " where " . implode(' and ', $clause);
     }
     return Db::row($sql, $args);
 }
Example #7
0
 public static function start()
 {
     // run gc
     static::gc();
     // get session id
     $name = Config::get('session.name', 'anchorcms');
     static::$id = Cookie::get($name);
     if (static::$id === false) {
         Log::info('Session cookie not found: ' . $name);
         static::$id = Str::random(32);
     }
     // load session data
     $sql = "select data from sessions where id = ? and ip = ? and ua = ? limit 1";
     $args = array(static::$id, Input::ip_address(), Input::user_agent());
     if ($session = Db::row($sql, $args)) {
         static::$data = unserialize($session->data);
     } else {
         // Session not found regenerate ID
         static::$id = Str::random(32);
         Db::insert('sessions', array('id' => static::$id, 'date' => date(DATE_ISO8601), 'ip' => Input::ip_address(), 'ua' => Input::user_agent(), 'data' => serialize(static::$data)));
     }
 }
Example #8
0
                     if($insert > 0){
                         
                     }
                 }
             }
         }*/
 $tag = $_POST['tag'];
 require_once 'config/Db.php';
 $db = new Db();
 $response = array("tag" => $tag, "error" => FALSE);
 if ($tag == 'login') {
     $user = filter_input(INPUT_POST, 'user');
     $pass = filter_input(INPUT_POST, 'pass');
     $cek_user = "******";
     $dt = array('user' => $user, 'pass' => md5($pass));
     $res = $db->row($cek_user, $dt);
     if ($res > 0) {
         $id_user = $res['idtblUser'];
         $level = $res['level'];
         $query_up = "UPDATE tblUser SET status = :status WHERE idtblUser = :iduser";
         $dt = array('status' => '1', 'iduser' => $id_user);
         $query_up = $db->query($query_up, $dt);
         if ($level == '1') {
             $data = "SELECT * FROM tblPasien WHERE idTblUser = :iduser";
             $dt = array('iduser' => $id_user);
             $data = $db->row($data, $dt);
             if ($data > 0) {
                 $par_cek = 1;
             } else {
                 $par_cek = 0;
             }
Example #9
0
			Fetching Row:
		</h4>
		<pre>
			<code class="lang-php">
&lt;?php
	$DB-&gt;row("SELECT * FROM fruit WHERE name=? and color=?",array('apple','red'));
?&gt;
			</code>
		</pre>
		<p>
			Result:
		</p>
		<pre>
			<code class="lang-php">
<?php 
var_export($DB->row("SELECT * FROM fruit WHERE name=? and color=?", array('apple', 'red')));
?>
			</code>
		</pre>
		<h4>
			Fetching single:
		</h4>
		<pre>
			<code class="lang-php">
&lt;?php
	$DB-&gt;single("SELECT color FROM fruit WHERE name=? ",array('watermelon'));
?&gt;
			</code>
		</pre>
		<p>
			Result:
Example #10
0
			LIMIT ' . $Config['TopicsPerPage']))));
}
// Get the infomation of current user
$CurUserInfo = null;
//当前用户信息,Array,以后判断是否登陆使用if($CurUserID)
$CurUserRole = 0;
$CurUserID = intval(GetCookie('UserID'));
$CurUserExpirationTime = intval(GetCookie('UserExpirationTime'));
$CurUserCode = GetCookie('UserCode');
if ($CurUserExpirationTime > $TimeStamp && $CurUserExpirationTime < $TimeStamp + 2678400 && $CurUserID && $CurUserCode) {
    $TempUserInfo = array();
    if ($MCache) {
        $TempUserInfo = $MCache->get(MemCachePrefix . 'UserInfo_' . $CurUserID);
    }
    if (!$TempUserInfo) {
        $TempUserInfo = $DB->row("SELECT * FROM " . $Prefix . "users WHERE ID = :UserID", array("UserID" => $CurUserID));
        if ($MCache && $TempUserInfo) {
            $MCache->set(MemCachePrefix . 'UserInfo_' . $CurUserID, $TempUserInfo, 86400);
        }
    }
    //Using hash_equals() in the future
    if ($TempUserInfo && HashEquals(md5($TempUserInfo['Password'] . $TempUserInfo['Salt'] . $CurUserExpirationTime . $SALT), $CurUserCode)) {
        $CurUserName = $TempUserInfo['UserName'];
        $CurUserRole = $TempUserInfo['UserRoleID'];
        $CurUserInfo = $TempUserInfo;
    } else {
        SetCookies(array('UserID' => '', 'UserExpirationTime' => '', 'UserCode' => ''), 1);
        $CurUserID = 0;
    }
    unset($TempUserInfo);
} elseif ($CurUserExpirationTime || $CurUserID || $CurUserCode) {
Example #11
0
define('DS', DIRECTORY_SEPARATOR);
define('BASE_DIR', dirname(__FILE__) . DS);
define('SITE_ROOT', '');
require_once BASE_DIR . 'Libs' . DS . 'autoload.php';
require_once BASE_DIR . 'configs' . DS . 'incs.php';
require_once BASE_DIR . 'helpers' . DS . 'incs.php';
//-------------------------------------------------------
Util::$template_path = BASE_DIR . 'templates' . DS;
//-------------------------------------------------------
$notFound = false;
$db = new Db($db_config);
$sql_menus = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 0";
$sql_home = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 1";
$slug = get_slug();
$home = $db->row($sql_home);
if ($slug == "") {
    if (!is_null($home)) {
        $slug = $home['slug'];
    } else {
        $notFound = true;
    }
}
$sql_page = sprintf("SELECT * FROM `pages` WHERE `slug` = '%s'", $db->escString($slug));
$page = $db->row($sql_page);
if (is_null($page)) {
    $notFound = true;
}
//-------------------------------------------------------
if ($notFound) {
    Response::SetHeader($_SERVER['SERVER_PROTOCOL'], '404 Page Not Found');
Example #12
0
 public static function add()
 {
     $post = Input::post(array('title', 'slug', 'description', 'html', 'css', 'js', 'status', 'field', 'comments'));
     $errors = array();
     if (empty($post['title'])) {
         $errors[] = 'Please enter a title';
     }
     if (empty($post['description'])) {
         $errors[] = 'Please enter a description';
     }
     if (empty($post['html'])) {
         $errors[] = 'Please enter your html';
     }
     if (empty($post['slug'])) {
         $post['slug'] = preg_replace('/\\W+/', '-', trim(strtolower($post['title'])));
     }
     // check for duplicate slug
     $sql = "select id from posts where slug = ?";
     if (Db::row($sql, array($post['slug']))) {
         $errors[] = 'A post with the same slug already exists, please change your post slug.';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $custom = array();
     if (is_array($post['field'])) {
         foreach ($post['field'] as $keylabel => $value) {
             list($key, $label) = explode(':', $keylabel);
             $custom[$key] = array('label' => $label, 'value' => $value);
         }
     }
     // remove from update
     unset($post['field']);
     $post['custom_fields'] = json_encode($custom);
     // set creation date
     $post['created'] = time();
     // set author
     $user = Users::authed();
     $post['author'] = $user->id;
     Db::insert('posts', $post);
     Notifications::set('success', 'Your new post has been added');
     return true;
 }
Example #13
0
 function read()
 {
     if ($this->lt->item = Db::row($this->lt->model['table'], $this->control->id)) {
         return true;
     }
     if ($_ENV['CrudbadIdCallback']) {
         call_user_func($_ENV['CrudbadIdCallback']);
     }
 }
Example #14
0
//-------------------------------------------------------
Util::$template_path = ADMIN_DIR . 'templates' . DS;
//-------------------------------------------------------
$id = Request::Get('id');
if (is_null($id)) {
    Response::Redirect('index.php');
}
$emsg = "";
$errors = array();
$db = new Db($db_config);
$sql_page = "SELECT * FROM `pages` WHERE `id` = %d";
$sql_page = sprintf($sql_page, (int) $db->escString($id));
$filepath = BASE_DIR . 'assets' . DS . 'images' . DS;
if (Request::Post('delete_page_key') == "1") {
    $sql = "DELETE FROM `pages` WHERE `id` = %d";
    $page = $db->row($sql_page);
    $imagename = $page['image'];
    if (file_exists($filepath . $imagename)) {
        unlink($filepath . $imagename);
    }
    $sql = sprintf($sql, (int) $db->escString($id));
    if ($db->execute($sql)) {
        Response::Redirect("index.php?done=delete");
    } else {
        $emsg = "Could not delete page. Something went wrong. Please try again.";
    }
}
if (Request::Post('upload_key') == "1") {
    if (isset($_FILES['image']) && $_FILES['image']['name'] != "") {
        $image = $_FILES['image'];
        $extension = strtolower(substr($image['name'], -4));
Example #15
0
 public static function find($where = array())
 {
     $sql = "\n\t\t\tselect\n\n\t\t\t\tposts.id,\n\t\t\t\tposts.title,\n\t\t\t\tposts.slug,\n\t\t\t\tposts.description,\n\t\t\t\tposts.html,\n\t\t\t\tposts.css,\n\t\t\t\tposts.js,\n\t\t\t\tposts.created,\n\t\t\t\tposts.custom_fields,\n\t\t\t\tcoalesce(users.real_name, posts.author) as author,\n\t\t\t\tcoalesce(users.bio, '') as bio,\n\t\t\t\tposts.status,\n\t\t\t\tposts.comments\n\n\t\t\tfrom posts \n\t\t\tleft join users on (users.id = posts.author) \n\t\t";
     $args = array();
     if (count($where)) {
         $clause = array();
         foreach ($where as $key => $value) {
             $clause[] = 'posts.' . $key . ' = ?';
             $args[] = $value;
         }
         $sql .= " where " . implode(' and ', $clause);
     }
     return static::extend(Db::row($sql, $args));
 }
Example #16
0
require_once BASE_DIR . 'helpers' . DS . 'incs.php';
require_once ADMIN_DIR . 'incs' . DS . 'incs.php';
//-------------------------------------------------------
Util::$template_path = ADMIN_DIR . 'templates' . DS;
//-------------------------------------------------------
$db = new Db($db_config);
$sql = "SELECT * FROM `settings`";
$done = Request::Get('done');
$emsg = "";
$smsg = "";
switch (strtolower($done)) {
    case 'edit':
        $smsg = "Settings edited successfully";
        break;
}
if (Request::Post('edit_settings_key') == "1") {
    $site_name = trim(Request::Post('site_name'));
    if ($site_name == "") {
        $emsg = "Site name cannot be empty";
    }
    if ($emsg == "") {
        if ($db->execute(sprintf("UPDATE `settings` SET `site_name` = '%s'", $site_name))) {
            Response::Redirect('index.php?done=edit');
        } else {
            $emsg = "Could not edit settings. Something went wrong. Please try again.";
        }
    }
}
//-------------------------------------------------------
echo Util::Render('master.phtml', array('page_title' => 'Settings', 'content' => Util::Render('settings/index.phtml', array('settings' => $db->row($sql), 'smsg' => $smsg, 'emsg' => $emsg))));
Example #17
0
 public static function add()
 {
     // verify Csrf token
     if (Csrf::verify(Input::post('token')) === false) {
         Notifications::set('error', 'Invalid token');
         return false;
     }
     $post = Input::post(array('slug', 'name', 'title', 'content', 'redirect', 'status'));
     $errors = array();
     if (empty($post['name'])) {
         $errors[] = Lang::line('pages.missing_name', 'Please enter a name');
     }
     if (empty($post['title'])) {
         $errors[] = Lang::line('pages.missing_title', 'Please enter a title');
     }
     // check for duplicate slug
     $sql = "select id from pages where slug = ?";
     if (Db::row($sql, array($post['slug']))) {
         $errors[] = Lang::line('pages.duplicate_slug', 'A pages with the same slug already exists, please change your page slug.');
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     if (empty($post['slug'])) {
         $post['slug'] = $post['name'];
     }
     $post['slug'] = Str::slug($post['slug']);
     Db::insert('pages', $post);
     Notifications::set('success', Lang::line('pages.page_success_created', 'Your new page has been added'));
     return true;
 }
Example #18
0
 public static function add()
 {
     // verify Csrf token
     if (Csrf::verify(Input::post('token')) === false) {
         Notifications::set('error', 'Invalid token');
         return false;
     }
     $post = Input::post(array('title', 'slug', 'created', 'description', 'html', 'css', 'js', 'status', 'field', 'comments'));
     $errors = array();
     $post['created'] = strtotime($post['created']);
     if ($post['created'] === false) {
         $errors[] = Lang::line('posts.invalid_date', 'Please enter a valid date');
     }
     if (empty($post['title'])) {
         $errors[] = Lang::line('posts.missing_title', 'Please enter a title');
     }
     if (empty($post['description'])) {
         $errors[] = Lang::line('posts.missing_description', 'Please enter a description');
     }
     if (empty($post['html'])) {
         $errors[] = Lang::line('posts.missing_html', 'Please enter your html');
     }
     // use title as fallback
     if (empty($post['slug'])) {
         $post['slug'] = $post['title'];
     }
     // format slug
     $post['slug'] = Str::slug($post['slug']);
     // check for duplicate slug
     $sql = "select id from posts where slug = ?";
     if (Db::row($sql, array($post['slug']))) {
         $errors[] = Lang::line('posts.duplicate_slug', 'A post with the same slug already exists, please change your post slug.');
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $custom = array();
     if (is_array($post['field'])) {
         foreach ($post['field'] as $keylabel => $value) {
             list($key, $label) = explode(':', $keylabel);
             $custom[$key] = array('label' => $label, 'value' => $value);
         }
     }
     // remove from update
     unset($post['field']);
     $post['custom_fields'] = json_encode($custom);
     // set author
     $user = Users::authed();
     $post['author'] = $user->id;
     Db::insert('posts', $post);
     Notifications::set('success', Lang::line('posts.post_success_created', 'Your new post has been added'));
     return true;
 }
Example #19
0
File: signin.php Project: as013/ika
<?php

if (isset($_POST['tag'])) {
    $tag = $_POST['tag'];
    require_once 'Db.php';
    $db = new Db();
    $response = array("tag" => $tag, "error" => FALSE);
    if ($tag == 'login') {
        $user = $_POST['user'];
        $pass = $_POST['pass'];
        $cek_user = "******";
        $dt = array('user' => $user, 'pass' => md5($pass));
        $res = $db->row($cek_user, $dt);
        if ($res > 0) {
            $id_user = $res['idtblUser'];
            $level = $res['level'];
            $query_up = "UPDATE tbluser SET status = :status WHERE idtblUser = :iduser";
            $dt = array('status' => '1', 'iduser' => $id_user);
            $query_up = $db->query($query_up, $dt);
            if ($level == '1') {
                $data = "SELECT * FROM tblpasien WHERE idTblUser = :iduser";
                $dt = array('iduser' => $id_user);
                $data = $db->row($data, $dt);
                if ($data > 0) {
                    $par_cek = 1;
                } else {
                    $par_cek = 0;
                }
            } elseif ($level == '2') {
                $data = "SELECT * FROM tbldokter WHERE idTblUser = :iduser";
                $dt = array('iduser' => $id_user);
Example #20
0
 public function dispatch()
 {
     $row = Db::row("SELECT empresas.id_empresas\n                  , empresas.nombre AS empresa\n                  , empresas.direccion_1\n                  , empresas.direccion_2\n                  , empresas.ciudad\n                  , empresas.estado\n                  , empresas.cod_postal\n                  , empresas.web\n                  , empresas.tel_oficina\n                  , empresas.tel_fax\n                  , empresas.logo\n             FROM empresas\n             WHERE empresas.id_empresas = '{$this->idEmpresas}'");
     $this->data = array('nombre' => $row['empresa'], 'logo' => $row['logo']);
     parent::dispatch();
 }
Example #21
0
// 3 ways to bind parameters :
// 1. Read friendly method
$db->bind("firstname", "John");
$db->bind("age", "19");
// 2. Bind more parameters
$db->bindMore(array("firstname" => "John", "age" => "19"));
// 3. Or just give the parameters to the method
$db->query("SELECT * FROM Persons WHERE firstname = :firstname AND age = :age", array("firstname" => "John", "age" => "19"));
//  Fetching data
$person = $db->query("SELECT * FROM Persons");
// If you want another fetchmode just give it as parameter
$persons_num = $db->query("SELECT * FROM Persons", null, PDO::FETCH_NUM);
// Fetching single value
$firstname = $db->single("SELECT firstname FROM Persons WHERE Id = :id ", array('id' => '3'));
// Single Row
$id_age = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f" => "Zoe"));
// Single Row with numeric index
$id_age_num = $db->row("SELECT Id, Age FROM Persons WHERE firstname = :f", array("f" => "Zoe"), PDO::FETCH_NUM);
// Column, numeric index
$ages = $db->column("SELECT age FROM Persons");
// The following statemens will return the affected rows
// Update statement
$update = $db->query("UPDATE Persons SET firstname = :f WHERE Id = :id", array("f" => "Johny", "id" => "1"));
// Insert statement
//	$insert	 	=  $db->query("INSERT INTO Persons(Firstname,Age) 	VALUES(:f,:age)",array("f"=>"Vivek","age"=>"20"));
// Delete statement
//	$delete	 	=  $db->query("DELETE FROM Persons WHERE Id = :id",array("id"=>"6"));
function d($v, $t = "")
{
    echo '<pre>';
    echo '<h1>' . $t . '</h1>';
Example #22
0
//-------------------------------------------------------
$emsg = "";
if (Request::Post('login_key') == "1") {
    $username = Request::Post('username');
    $password = Request::Post('password');
    if ($username == "" || $password == "") {
        $emsg = "Please enter both username and password.";
    } else {
        $db = new Db($db_config);
        $sql = <<<SQL
SELECT * FROM `users`
WHERE `username` = '%s' AND `password` = '%s' AND `active` = 1
SQL;
        $sql = sprintf($sql, $db->escString($username), $db->escString(md5($password . SALT)));
        if ($db->numRows($sql) > 0) {
            $user = $db->row($sql);
            $db->execute(sprintf("UPDATE `users` SET `logged_at` = '%s' WHERE `id` = %d", date('Y-m-d h:i:s'), (int) $db->escString($user['id'])));
            Session::Set('username', $user['username']);
            Session::Set('id', $user['id']);
            Response::Redirect(ADMIN_ROOT . 'index.php');
        } else {
            $emsg = "Login Failed";
        }
    }
}
if (Request::Get('logout') == 'true') {
    Session::Destroy('username');
    Session::Destroy('id');
    Response::Redirect(ADMIN_ROOT . 'login.php');
}
//-------------------------------------------------------
 public function retrieve_login_token($token)
 {
     Db::bind("token", $token);
     $response = Db::row("SELECT * FROM login_tokens WHERE token=:token");
     if ($response != false) {
         if (time() > $response['valid_until']) {
             return false;
         }
         if ($response['disabled'] == "false") {
             return false;
         }
         return $response['username'];
     } else {
         return false;
     }
 }
Example #24
0
    if ($password == "") {
        $errors['password'][] = "Password field cannot be empty";
    }
    if ($cpassword == "") {
        $errors['cpassword'][] = "Confirm Password field cannot be empty";
    }
    if (strlen($password) < 6 || strlen($password) > 30) {
        $errors['password'][] = "Password must be (6-30) characters long.";
    }
    if ($password != $cpassword) {
        $errors['password'][] = "Password didnot matched";
        $errors['cpassword'][] = "Password didnot matched";
    }
    if (empty($errors)) {
        $sql = <<<SQL
UPDATE `users`
SET `password` = '%s',
`modified_at` = '%s'
WHERE `id` = %d
SQL;
        $sql = sprintf($sql, $db->escString(md5($password . SALT)), date('Y-m-d h:i:s'), (int) $db->escString($id));
        if ($db->execute($sql)) {
            Response::Redirect("index.php?done=edit_password");
        } else {
            $emsg = "Could not edit user password. Something went wrong. Please try again.";
        }
    }
}
//-------------------------------------------------------
echo Util::Render('master.phtml', array('page_title' => 'Edit User', 'content' => Util::Render('users/edit.phtml', array('errors' => $errors, 'emsg' => $emsg, 'user' => $db->row($sql_user), 'user_count' => $db->numRows($sql_user), 'requested_id' => $id, 'logger_id' => Session::Get('id')))));
Example #25
0
 function get()
 {
     if ($_ENV['sessionUseDb']) {
         $data = Db::row($_ENV['sessionDbTable'], array('id' => $_COOKIE['sessionId']), 'data');
     } else {
         $data = file_get_contents($this->file);
     }
     $this->hash = md5($data);
     $data = $data ? unserialize($data) : null;
     return $data;
 }
Example #26
0
<?php

define('DS', DIRECTORY_SEPARATOR);
define('ADMIN_DIR', dirname(__FILE__) . DS . '..' . DS);
define('BASE_DIR', dirname(__FILE__) . DS . '..' . DS . '..' . DS);
define('ADMIN_ROOT', '../');
define('SITE_ROOT', '../../');
require_once BASE_DIR . 'Libs' . DS . 'autoload.php';
require_once BASE_DIR . 'configs' . DS . 'incs.php';
require_once BASE_DIR . 'helpers' . DS . 'incs.php';
require_once ADMIN_DIR . 'incs' . DS . 'incs.php';
//-------------------------------------------------------
Util::$template_path = ADMIN_DIR . 'templates' . DS;
//-------------------------------------------------------
$id = Request::Get('id');
if (is_null($id)) {
    Response::Redirect('index.php');
}
$db = new Db($db_config);
$sql_user = "******";
$sql_user = sprintf($sql_user, (int) $db->escString($id));
//-------------------------------------------------------
echo Util::Render('master.phtml', array('page_title' => 'View User', 'content' => Util::Render('users/view.phtml', array('user' => $db->row($sql_user), 'user_count' => $db->numRows($sql_user), 'requested_id' => $id))));