function login() { $strsql = "insert into [log] ([user], [ip], [urlFrom]) values('" . $_POST["user"] . "', '" . $_SERVER["REMOTE_ADDR"] . "', '" . $_SERVER["SERVER_NAME"] . "');"; $results = $GLOBALS['db']->exec($strsql); $strsql = "select idAgent, level from [agents] where user='******'\\') . "' and password='******';"; $results = $GLOBALS['db']->query($strsql); if ($results) { $results = $results->fetch(); $_SESSION['language'] = $_POST['language']; $_SESSION['idAgent'] = $results['idAgent']; $_SESSION['level'] = (string) $results['level']; if ($_SESSION['idAgent'] > '0') { header('Location: ../ap/index.php'); exit; } } else { //print_r($GLOBALS['db']->errorInfo()); session_destroy(); session_unset(); header('Location: ../../cgi_bin/denied.php'); exit; } }
function strMid($str1, $str2, $str3) { $strMid = strRight($str1, $str2); return strLeft($strMid, $str3); }