İşte benim giriş PHP kodudur.
<?php // rnlogin.php
include_once 'rnheader.php';
echo "<h3>Member Log in</h3>";
$error = $user = $pass = "";
if (isset($_POST['user']))
{
$user = sanitizeString($_POST['user']);
$pass = sanitizeString($_POST['pass']);
if ($user == "" || $pass == "")
{
$error = "Not all fields were entered<br />";
}
else
{
$query = "SELECT user,pass FROM rnmembers
WHERE user='$user' AND pass='$pass'";
if (mysql_num_rows(queryMysql($query)) == 0)
{
$error = "Username/Password invalid<br />";
}
else
{
$_SESSION['user'] = $user;
$_SESSION['pass'] = $pass;
die("You are now logged in. Please
<a href='rnmembers.php?view=$user'>click here</a>.");
}
}
}
echo <<<_END
<form method='post' action='rnlogin.php'>$error
Username <input type='text' maxlength='16' name='user'
value='$user' /><br />
Password <input type='password' maxlength='16' name='pass'
value='$pass' /><br />
<input type='submit' value='Login' />
</form>
_END;
?>
As you can see the error message is printed with echo. Is there a way that I can put this error message in a control and display it only if there is error?
Ben JavaScript ile PHP birleştirmek zorunda gibi geliyor?
The following code is used by Gmail to display error message. It works even if JavaScript is turned off. In other words, they use some techniques independent of JS.
Herhangi bir fikir, ben burada benzer bir şey nasıl yapabilirim?
<code>
<td align="left">
<div id="errormsg_0_Passwd" class="errormsg">
The username or password you entered is incorrect.
[<a target="_blank" name="helpLink" href="http://www.google.com/support/accounts/bin/answer.py?answer=27444&hl=en&ctx=ch_ServiceLoginAuth&p=mail">?</a>]
</div>
</td>
</code>
Teşekkür ederim