//должна быть только одна такая запись if ($this->Query1->readRecordCount()==1) { //задаем параметры сессии session_start(); $_SESSION['username']=$this->Query1->name; $_SESSION['userpass']=$this->Query1->pass; //перенаправляем пользователя на нужную страницу header('Location:unit2.php'); exit(); } else { $this->Label3->Caption="Вход в систему - не выполнен"; } |
function Unit2BeforeShow($sender, $params) { //устанавливаем соединение $this->Database1->Open(); //устанавливаем кодировку запросов $sql="SET NAMES cp1251"; $this->Query1->SQL=$sql; $this->Query1->LimitStart='-1'; $this->Query1->LimitCount='-1'; $this->Query1->Open(); $this->Query1->Close(); //выполняем запрос, проверяя, есть ли имя и пароль из сессии в базе $sql="select id, name, pass from `test`.`users` where name='" . $_SESSION['username'] . "'" . " and pass='" . $_SESSION['userpass'] . "'"; $this->Query1->SQL=$sql; $this->Query1->LimitStart='0'; $this->Query1->LimitCount='10'; $this->Query1->Open(); //должна быть только одна такая запись if ($this->Query1->readRecordCount()==1) { //закрываем проверочное соединение $this->Query1->Close(); $this->Database1->Close(); //показываем таблицу товаров if ($this->tbgoods1->Active=true) {$this->tbgoods1->Close();} if ($this->dbtest1->Connected=true) {$this->dbtest1->Close();} $this->dbtest1->Open(); $this->tbgoods1->Open(); } else { //закрываем проверочное соединение $this->Query1->Close(); $this->Database1->Close(); //закрываем сессию и перенаправляем пользователя на страницу ввода пароля session_destroy(); header('Location:unit1.php'); exit(); } } |
function Button1Click($sender, $params) { //закрываем сессию и перенаправляем пользователя на страницу ввода пароля session_destroy(); header('Location:unit1.php'); exit(); } |