我的职能是毫无缺省价值,例如:
function output_message($message="") {
if (!empty($message)) {
return "<p class="message">{$message}</p>";
} else {
return "";
}
}
然后,我赞同我的记录中的信息。 如果出现错误,它就会发出信息,但如果不存在错误,它就只能做什么。 当我上页时,我的职责没有界定。 下面是我的html页。
<?php
require_once("../../includes/functions.php");
require_once("../../includes/session.php");
require_once("../../includes/database.php");
require_once("../../includes/user.php");
if($session->is_logged_in()) {
redirect_to("index.php");
}
// Remember to give your form s submit tag a name="submit" attribute!
if (isset($_POST[ submit ])) { // Form has been submitted.
$username = trim($_POST[ username ]);
$password = trim($_POST[ password ]);
// Check database to see if username/password exist.
$found_user = User::authenticate($username, $password);
if ($found_user) {
$session->login($found_user);
redirect_to("index.php");
} else {
// username/password combo was not found in the database
$message = "Username/password combination incorrect.";
}
} else { // Form has not been submitted.
$username = "";
$password = "";
}
<html>
<head>
<title>Photo Gallery</title>
<link href="../stylesheets/main.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1>Photo Gallery</h1>
</div>
<div id="main">
<h2>Staff Login</h2>
<?php echo output_message($message); ?>
<form action="login.php" method="post">
<table>
<tr>
<td>Username:</td>
<td>
<input type="text" name="username" maxlength="30" value="<?php echo htmlentities($username); ?>" />
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<input type="password" name="password" maxlength="30" value="<?php echo htmlentities($password); ?>" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit" value="Login" />
</td>
</tr>
</table>
</form>
</div>
<div id="footer">Copyright <?php echo date("Y", time()); ?>, Kevin Skoglund</div>
</body>
</html>
<?php if(isset($database)) { $database->close_connection(); } ?>
我不敢肯定,为什么我正在发现这一错误,因为我的职责是确定该职能中拖欠的年金价值。 产出——工资($message=”
人们可以看我的法典,告诉我,为什么没有界定我的职能。 感谢。