当前位置: 首页>>代码示例>>PHP>>正文


PHP MYSQL::SqlUpdate方法代码示例

本文整理汇总了PHP中MYSQL::SqlUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP MYSQL::SqlUpdate方法的具体用法?PHP MYSQL::SqlUpdate怎么用?PHP MYSQL::SqlUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MYSQL的用法示例。


在下文中一共展示了MYSQL::SqlUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SetLogin

 function SetLogin(&$smarty, $form = false, $pageredir = "index")
 {
     $ck = new Check('POST');
     $mysql = new MYSQL($smarty);
     if ($ck->form['cookieleng'] == $smarty->get_config_vars('Login00')) {
         $cookielength = 0;
         $cookieneverexp = 'on';
     } else {
         $cookielength = $ck->form['cookieleng'];
     }
     $user = $ck->form['login_user'];
     $pass = $ck->form['login_password'];
     $request = $mysql->SqlSelect("SELECT * FROM {$smarty->cfg[prefix]}members WHERE member_name='{$user}'", __FILE__, __LINE__);
     $perfil = mysql_fetch_array($request, MYSQL_ASSOC);
     $md5_passwrd = $this->md5_hmac($pass, strtolower($user));
     switch ($cookielength) {
         case "1":
             $cookielength = strtotime("+30 minutes");
             break;
         case "2":
             $cookielength = strtotime("+1 hour");
             break;
         case "3":
             $cookielength = strtotime("+1 day");
             break;
         case "4":
             $cookielength = strtotime("+1 month");
             break;
         case "5":
             $cookielength = strtotime("+1 year");
             break;
         default:
             $cookielength = strtotime("+1 year");
     }
     $password = $this->md5_hmac($md5_passwrd, 'ys');
     $cookie_url = explode($smarty->cfg["separate"], $this->url_parts($smarty->get_config_vars('http'), $smarty->cfg["separate"]));
     $cookie = serialize(array($perfil['ID_MEMBER'], $password));
     $ctime = $cookielength;
     //print $smarty->cfg['cookie'].' , ' .$cookie.' , '. $ctime.' , '. $cookie_url[1].' , '. $cookie_url[0];
     setcookie($smarty->cfg['cookie'], $cookie, $ctime, $cookie_url[1], $cookie_url[0]);
     $lastLog = time();
     $memIP = $_SERVER[REMOTE_ADDR];
     $valores = array('member_lastlogin' => $lastLog, 'member_ip' => $memIP);
     $sql = $mysql->SqlUpdate($smarty->cfg["prefix"] . 'members', $valores, "member_name='{$user}'");
     $result = $mysql->SqlSelect($sql);
     $identify = INET_ATON();
     $sql = $mysql->SqlDelete($smarty->cfg["prefix"] . 'log_online', "identity='{$identify}'");
     $result = $mysql->SqlSelect($sql);
     $redir = $smarty->get_config_vars('http') . $smarty->cfg['index'] . '?page=' . $pageredir;
     header("location:{$redir}");
 }
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:51,代码来源:lib.Login.php

示例2: MYSQL

<?php

$tabela = 'produtos';
$mysql = new MYSQL($cfg);
$idde = trim($_POST['id']);
if (trim($_POST['edit'])) {
    array_pop($_POST);
    $sql = $mysql->SqlUpdate($tabela, $_POST, "id = '{$idde}'");
    $request = $mysql->SqlSelect($sql);
    $request = $mysql->SqlSelect($sql, __FILE__, __LINE__);
    if (request) {
        print "<h4>Registro Atualizado com sucesso!!!</h4>";
    }
}
$result = $mysql->SqlSelect("SELECT * FROM {$tabela} WHERE id = '" . $idde . "'");
$item = mysql_fetch_array($result, MYSQL_ASSOC);
?>

<form action="index.php?p=produtos&a=edit" method="post">
<label for="nome">Nome:<br />
    <input name="nome" type="text" value="<?php 
echo $item['nome'];
?>
" />
</label><br />
<label for="descricao">Descrição:<br />
<textarea name="descricao"><?php 
echo $item['descricao'];
?>
</textarea>
</label><br />
开发者ID:renatoinnocenti,项目名称:Serviceit-php,代码行数:31,代码来源:produtos_edit.php

示例3: logMe

 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__);
     }
 }
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:28,代码来源:lib.StartSite.php


注:本文中的MYSQL::SqlUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。