dharmil
New Member
- Messages
- 1,656
- Reaction score
- 0
- Points
- 0
PHP:
<?
include "config.php";
function login_form($username) {
echo '<table border="0" width="90%" cellpadding="0" cellspacing="2">
<form method="POST" name="login" action="?login">
<tr>
<td width="30%">Username:</td>
<td><input type="text" name="username" value="'.$username.'" size="18"></td>
</tr>
<tr>
<td width="30%">Password:</td>
<td><input type="password" name="password" size="18"></td>
</tr>
<tr>
<td width="30%"></td>
<td><input type="submit" value="Login" name="login">
</td>
</tr>
</form></table>';
}
if (isset($_POST[login])) {
if ($admins[$_POST[username]] == $_POST[password]) {
setcookie("newsuser", "$_POST[username]", $time+60*60*24*30 );
setcookie("newspass", "$_POST[password]", $time+60*60*24*30 );
echo 'Logged in<br><a href="admin.php?act=post">Post News</a>';
echo '<br><a href="news.php">Home</a>';
} else {
login_form("$_POST[username]");
}
} else {
login_form("");
}
?>
then i cant put the add code because i can edit it gets a arror