Ejemplo n.º 1
0
 function SetLogout(&$smarty, $redir = 'index')
 {
     $mysql = new MYSQL($smarty);
     $sql = $mysql->SqlDelete($smarty->cfg["prefix"] . 'log_online', "identity='" . $smarty->perfil["ID_MEMBER"] . "'");
     $result = mysql_query($sql);
     $cookie_url = explode($smarty->cfg["separate"], $this->url_parts($smarty->get_config_vars('http'), $smarty->cfg["separate"]));
     setcookie($smarty->cfg["cookie"], '', time() - 3600, $cookie_url[1], $cookie_url[0]);
     $smarty->perfil = $smarty->LoadPerfilGuest();
     $redir = $smarty->get_config_vars('http') . $smarty->cfg['index'] . '?page=' . $redir;
     header("location:{$redir}");
 }
$tabela = 'produtos';
$mysql = new MYSQL($cfg);
if ($_POST['add']) {
    // adicionar registro.
    array_pop($_POST);
    $sql = $mysql->SqlInsert($tabela, $_POST);
    $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
    if ($request) {
        print "<h4>Registro Realizado com sucesso!!!</h4>";
    }
}
if ($_POST['del']) {
    // adicionar registro.
    $idde = trim($_POST['id']);
    $sql = $mysql->SqlDelete($tabela, "id = '{$idde}'");
    $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
    if ($request) {
        print "<h4>Registro Deletado com sucesso!!!</h4>";
    }
}
$result = $mysql->SqlSelect("SELECT id, nome, descricao, preco FROM {$tabela}");
if ($result) {
    ?>

<div class="col-md-6">
	<table class="table table-striped">
		<thead>
			<tr>
				<th>#</th>
				<th>Nome</th>
Ejemplo n.º 3
0
 public function logMe($ID_MEMBER, $min = '15')
 {
     $mysql = new MYSQL($this);
     $tabela = $this->cfg['db_prefix'] . 'log_online';
     $logme['identity'] = $ID_MEMBER;
     $perfil['member_lastlogin'] = $logme['logTime'] = 'NOW()';
     $perfil['member_lestonline'] = $logme['logoutTime'] = "NOW() + INTERVAL " . $min . " MINUTE";
     $logme['url'] = $this->actualpage['page_name'] ? $this->actualpage['page_name'] : "index";
     $logme['ip'] = $_SERVER['REMOTE_ADDR'];
     $request = $mysql->SqlSelect("Select identity From {$tabela} where ip = \"{$logme[ip]}\" and identity = \"{$ID_MEMBER}\"", __FILE__, __LINE__);
     mysql_affected_rows();
     if (mysql_affected_rows() > 0) {
         $sql = $mysql->SqlUpdate($tabela, $logme, "identity = {$ID_MEMBER}");
     } else {
         $sql = $mysql->SqlInsert($tabela, $logme);
     }
     $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
     $tabela = $this->cfg['db_prefix'] . 'log_online';
     $sql = $mysql->SqlUpdate($tabela, $logme, "identity =" . $ID_MEMBER);
     $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
     $sql = $mysql->SqlDelete($tabela, "logoutTime < NOW()");
     $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
     if ($ID_MEMBER > 0) {
         $tabela = $this->cfg['db_prefix'] . 'members';
         $sql = $mysql->SqlUpdate($tabela, $perfil, "ID_MEMBER =" . $ID_MEMBER);
         $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
     }
 }