Login working, but not cookie.

This commit is contained in:
Elyrith 2013-08-09 23:38:42 -04:00
parent ed0efd68a9
commit 21a833a3eb
4 changed files with 2 additions and 49 deletions

View File

@ -1,4 +1,4 @@
<form action="login.php" method="post">
<form action="<?php echo $_SERVER[REQUEST_URI]; ?>" method="post">
<input type="hidden" name="do" value="authenticate">
<table border=0>

View File

@ -1,32 +0,0 @@
<html>
<head>
<title>Login</title>
</head>
<?php
if ( $_POST['do'] == "authenticate") {
# require "../includes/config.php";
require "../includes/dbconnect.php";
$sql = "SELECT id FROM users WHERE username='$_POST[username]' and password=PASSWORD('$_POST[password]')";
$result = mysql_query($sql) or die (mysql_error());
echo mysql_num_rows($result);
if (mysql_num_rows($result) == 1) {
echo "<p>You are a valid user!<br />";
echo "Your username is $_POST[username]<br />";
echo "Your password is $_POST[password]</p>";
include("login_form.inc");
} else {
unset($_POST['do']);
echo "<p>You are not authorized. Please try again.</p>";
include("login_form.inc");
}
break;
} else {
include("login_form.inc");
}
?>
</body>
</html>

View File

@ -1,16 +0,0 @@
<form action="login.php" method="post">
<input type="hidden" name="do" value="authenticate">
<table border=0>
<tr>
<td><strong>Username</strong></td>
<td><input type="text" name="username" size="20" maxlength="20"></td>
</tr>
<tr>
<td><strong>Password</strong></td>
<td><input type="text" name="password" size="20" maxlength="20"></td>
</tr>
<tr>
<td colspan=2 align="center"><input type="submit" value="Login"></td>
</tr>
</table>

View File

@ -1,6 +1,7 @@
<?php
require "../includes/htmlcode.php";
start_html("Create new post");
include "../includes/login.inc";
?>
<h1>Create new post</h1>