php - Why "wrong username/password" alert comes up even on the first load of page? -


I have a login form and when I go to the page, I automatically give a warning message that I am still using username and Password information is not kept.
Here is the page which verifies the login form input, please see why this is?

  & lt; ? Session_start (); Include "Config.php"; If (isset ($ _ session ["login_user"]) and continue ($ _ session ['pass_user'])) {$ login_user = $ _SESSION ["login_or"]; $ Pass_user = $ _SESSION ["pass_user"]; $ Sql ​​= mysql_query ("Selection from * where entry = '$ login_user'"); $ Cont = mysql_num_rows ($ sql); While ($ linha = mysql_fetch_array ($ sql)) {$ pass_db = $ linha ['pass']; } If ($ cont == 0) {without set ($ _ session ["login_aser"]); Not set ($ _ session ["pass_user"]); Echo "meta-HTTP-EQUIV = REFRESH CONTENT = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" user name not match . \ "); & Lt; / script & gt;"; } If ($ pass_db! = $ Pass_user) {// set to check pass ($ _ session ["login_or"]); Not set ($ _ session ["pass_user"]); Echo "meta-HTTP-EQUIV = reference content = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" password not match. "); & Lt; / script & gt;"; }} And {echo "& lt; META HTTP-EQUIV = REFRESH CONTENT = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" user And no password matches. \ "); & Lt; / script & gt;"; }? & Gt;    

I think you have not done any other wrong:

  & lt;? Session_start (); Include "Config.php"; If (isset ($ _ session ["login_user"]) and continue ($ _ session ['pass_user'])) {$ login_user = $ _SESSION ["login_or"]; $ Pass_user = $ _SESSION ["pass_user"]; $ Sql ​​= mysql_query ("Selection from * where entry = '$ login_user'"); $ Cont = mysql_num_rows ($ sql); While ($ linha = mysql_fetch_array ($ sql)) {$ pass_db = $ linha ['pass']; } If ($ cont == 0) {without set ($ _ session ["login_aser"]); Not set ($ _ session ["pass_user"]); Echo "meta-HTTP-EQUIV = REFRESH CONTENT = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" user name not match . \ "); & Lt; / script & gt;"; } If ($ pass_db! = $ Pass_user) {// set to check pass ($ _ session ["login_or"]); Not set ($ _ session ["pass_user"]); Echo "meta-HTTP-EQUIV = reference content = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" password not match. "); & Lt; / script & gt;"; } And {echo "Meta HTTP-EQUIV = REFRESH CONTENT = '0; URL = login.php' & gt; & lt; script type = \" text / javascript \ "& gt; alert (\" user and Do not match password. \ "); & Lt; / script & gt;"; }}? & Gt;   

However, as described by @ David, you should not specify that only password is wrong.

Comments