mysql - why doesn't my php redirect work? -
I am writing a login script, my db.fpp does not echo / print, so why not header ("location : Index.php "); Redirect to successful login? Login information is correct. I know that I have to encrypt the input, but there is no problem right now.
& lt ;? Requires Php ('db.php'); $ Username = $ _POST ['un']; $ Password = $ _POST ['pw']; $ Qry = "Choose user from UID where name = '$ username' and pass = '' .md5 ($ password). $ Result = mysql_query ($ qry); if (mysql_num_rows ($ result) == 1) {session_regenerate_id (); $ User = mysql_fetch_assoc ($ result); $ _SESSION ['S_UID'] = $ user ['uid']; session_write_close (); header ("location: index.php"); exit ();} Else {Echo " gt; & Lt; Form action = 'index.php' name = 'login' & gt; Login failed! Please try again with the correct username and password. & Lt; Br> & Lt; Input type = 'submit' name = 'failed' value = 'return to login' & gt; & Lt; / Form & gt; & Lt; / Center & gt; "; Go out ();}? & Gt;
function headers only work If any script has not been sent before, it is called function. Check that any code given above has raised some echo.
If not, check that the above files contain ""> " Tag. "This location or newline will not be sent to the browser before your header.
Comments
Post a Comment