ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Evgeniy Kobzev <evgenik@diamonds.ru>
To: combr@vesna.ru,
	ALT Linux Sisyphus discussion list <sisyphus@altlinux.ru>
Subject: Re: [sisyphus] php + ftreetds + mssql
Date: Tue, 01 Feb 2005 08:30:15 +0300
Message-ID: <41FF13E7.1090705@diamonds.ru> (raw)
In-Reply-To: <200501311729.22593.combr@vesna.ru>

Mike Lykov пишет:
> В сообщении от Понедельник 31 Январь 2005 17:15 Alexey Gladkov написал:
> 
> $db_name="Lite";      //база данных                                          
> $connection=mssql_connect("server","user","pass") or die("невозможно 
> подключится к серверу");
> $db=mssql_select_db("$db_name",$connection) or die ("невозможно выбрать 
> базу");
> $sql="select code_ceh, name_f, password from first_tab where 
> name_f='$login' and password='$userpassword'";   
> $result=mssql_query($sql,$connection)or die ("невозможно выполнить 
> запрос"); 
> while ($row=mssql_fetch_array ($result))                                     
>   {   $login1 = $row['name_f'];                                            
>       $password1 = $row['password'];                               
>       $code_ceh=$row['code_ceh'];                                          
>   }                                                                    
> if($login1!=$login){echo "Неверный логин или пароль!";
      echo "|".$login."|\n";
      echo "|".$login1."|\n";
>    exit;}                                  
> 
> вот такой кусок (писал не я).
> 
> на любые данные все время говорит "неверный логин" ;) (т.е. к серверу 
> подсоединяется, базу выбирает, запрос делает, а вот что оттуда возвращается - 
> непонятно).

Скорее всего дело в правых пробелах.
Допустим поле в таблице определено как CHAR(10), и в нем записано слово 
mylogin, то в переменной $login1 будет "mylogin" плюс три пробела.
С типом VARCHAR скорее всего будет по другому, но проверить нет 
возможности, это чистая теория.
Сравнивать по идее нужно как то вот так:

while ($row = mssql_fetch_array ($result)) {
	$login1 = rtrim($row['name_f'];
	$password1 = $row['password'];
	$code_ceh=$row['code_ceh'];
}
// Хотя ещё не понятно, как там вверху $login обрабатывали
if ($login1 != $login) {
	echo "Неверный логин или пароль!";
	exit;
}


  parent reply	other threads:[~2005-02-01  5:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31  9:02 Mike Lykov
2005-01-31  9:34 ` Alexey Gladkov
2005-01-31 12:46   ` Mike Lykov
2005-01-31 13:15     ` Alexey Gladkov
2005-01-31 13:29       ` Mike Lykov
2005-01-31 13:51         ` [sisyphus] " Michael Shigorin
2005-01-31 13:53           ` Mike Lykov
2005-01-31 14:31             ` Dmitry Lebkov
2005-02-01  4:36               ` Mike Lykov
2005-02-01  5:30         ` Evgeniy Kobzev [this message]
2005-02-01  6:39           ` [sisyphus] [summary] " Mike Lykov
2005-01-31  9:41 ` [sisyphus] " Максим Ткаченко
2005-01-31 10:41   ` [sisyphus] " Michael Shigorin
2005-01-31 11:00     ` Mike Lykov
2005-01-31 11:27       ` Alexey Gladkov
2005-01-31 12:35 ` [sisyphus] [FAQ] php packaging (was: php + ftreetds + mssql) Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41FF13E7.1090705@diamonds.ru \
    --to=evgenik@diamonds.ru \
    --cc=combr@vesna.ru \
    --cc=sisyphus@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git