function LoginAccess() { if ($this->attLogin > 0 && $this->timeLogin > 0) { $rstmp = $this->TableObj->Query(AddFieldWrappers("ip") . "='" . $_SERVER["REMOTE_ADDR"] . "' and " . AddFieldWrappers("action") . "='access'", AddFieldWrappers("id") . " asc"); $i = 0; while ($data = db_fetch_array($rstmp)) { if (secondsPassedFrom($data["datetime"]) / 60 <= $this->timeLogin) { if ($i == 0) { $firstAccess = $data["datetime"]; } $i += 1; } } if ($i >= $this->attLogin) { return ceil($this->timeLogin - secondsPassedFrom($firstAccess) / 60); } else { return false; } } else { return false; } }
function LoginAccess() { if ($this->attLogin > 0 && $this->timeLogin > 0) { $where = $this->connection->addFieldWrappers("ip") . "=" . $this->connection->prepareString($_SERVER["REMOTE_ADDR"]) . " AND " . $this->connection->addFieldWrappers("action") . "=" . $this->connection->prepareString("access"); $orderBy = $this->connection->addFieldWrappers("id") . " asc"; $sql = "SELECT * FROM " . $this->connection->addTableWrappers($this->logTableName) . " WHERE " . $where . " ORDER BY " . $orderBy; $qResult = $this->connection->query($sql); $i = 0; while ($data = $qResult->fetchAssoc()) { if (secondsPassedFrom($data["datetime"]) / 60 <= $this->timeLogin) { if ($i == 0) { $firstAccess = $data["datetime"]; } $i += 1; } } if ($i >= $this->attLogin) { return ceil($this->timeLogin - secondsPassedFrom($firstAccess) / 60); } } return false; }
function GetLockInfo($strtable, $keys, $links, $pageid) { $page = GetTableURL($strtable) . "_edit.php"; $skeys = ""; foreach ($keys as $ind => $val) { if (strlen($skeys)) { $skeys .= "&"; } $skeys .= rawurlencode($val); } $rstmp = $this->TableObj->Query(AddFieldWrappers("table") . "=" . db_prepare_string($strtable) . " and " . AddFieldWrappers("keys") . "=" . db_prepare_string($skeys) . " and " . AddFieldWrappers("sessionid") . "<>'" . session_id() . "' and " . AddFieldWrappers("action") . "=1", AddFieldWrappers("id") . " asc"); if ($data = db_fetch_array($rstmp)) { $sdate = now(); $arrDateTime = db2time($data["startdatetime"]); $str = mysprintf($this->LockAdmin, array($data["userid"], round(secondsPassedFrom($data["startdatetime"]) / 60, 2))); if ($links) { $str .= '<a class="unlock" href="#" onclick="Runner.pages.PageManager.getAt(\'' . htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'no\');return false;">' . "Unlock record" . '</a>'; $str .= '<a class="edit" href="#" onclick="Runner.pages.PageManager.getAt(\'' . htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'yes\');return false;">' . "Edit record" . '</a>'; } return $str; } else { return ""; } }
function GetLockInfo($strtable, $keys, $links, $pageid) { $page = GetTableLink(GetTableURL($strtable), "edit"); $skeys = ""; foreach ($keys as $ind => $val) { if (strlen($skeys)) { $skeys .= "&"; } $skeys .= rawurlencode($val); } $where = $this->connection->addFieldWrappers("table") . "=" . $this->connection->prepareString($strtable) . " AND " . $this->connection->addFieldWrappers("keys") . "=" . $this->connection->prepareString($skeys) . " AND " . $this->connection->addFieldWrappers("sessionid") . "<>'" . session_id() . "' AND " . $this->connection->addFieldWrappers("action") . "=1"; $qResult = $this->query($where, $this->connection->addFieldWrappers("id") . " asc"); if ($data = $qResult->fetchAssoc()) { $sdate = now(); $arrDateTime = db2time($data["startdatetime"]); $str = mysprintf($this->LockAdmin, array($data["userid"], round(secondsPassedFrom($data["startdatetime"]) / 60, 2))); if ($links) { $str .= '<a class="unlock" href="#" onclick="Runner.pages.PageManager.getAt(\'' . runner_htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . runner_htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'no\');return false;">' . "Desbloquear registro" . '</a>'; $str .= '<a class="edit" href="#" onclick="Runner.pages.PageManager.getAt(\'' . runner_htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . runner_htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'yes\');return false;">' . "Editar registro" . '</a>'; } return $str; } return ""; }