deleted user 111213 Grandmaster Cheater
Reputation: 0
Joined: 09 Nov 2007 Posts: 714
|
Posted: Sun Nov 16, 2008 6:55 am Post subject: need php help yet again |
|
|
here is the code for login.php
| Code: | <?php
session_start();
include'./global.php';
?>
<html>
<head>
<title>My Blog</title>
<link rel="stylesheet" href="style2.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<center><h1>My Blog</h1></center>
<?php
if($_SESSION['uid']){
$sql99 = "SELECT * FROM users WHERE id = '". $_SESSION['uid'] . "'";
$res99 = mysql_query($sql99) or die(mysql_error());
while($row99 = mysql_fetch_assoc($res99)){
echo "<p>Welcome, <a href=\"./profile.php?id=" . $row99['id'] . "<b>" . $row99['name'] . "</b></a> | <a href=\"/logout.php\">Logout</a></p>\n";
}
}else {
echo "<p>Welcome, <b>Guest</> | <a href=\"./reg.php\">Register</a> | <a href=\"./login.php\">Login</a></p>";
}
?>
<div id="nav">
<a href=\".a-index.php">Home</a><br>
<h3>Categories</h3>
<a href="">HTML</a><br>
<a href="">CSS</a><br>
<a href="">PHP</a><br>
</div>
<div id="content">
<?php
$errors = array();
$step = $_GET['step'];
if($_SESSION['uid']){
echo "You're already logged in";
}else {
if(!$step){
echo "<form action='login.php?step=2' method='post'><table border='0'>\n";
echo "<tr><td>Username: </td><td><input tpye='text' name='username'></td></tr>\n";
echo "<tr><td>Password: </td><td><input type='password' name='password'></td></tr>\n";
echo "<tr><td colspan='2' align='right'><input type='submit' name='submit' value='login'></td></tr>\n";
echo "</table></form>\n";
}
$username = $_POST['username'];
$password = $_POST['password'];
$username = mysql_real_escape_string($username);
$username = stripslashes($username);
$password = mysql_real_escape_string($password);
$password = stripslashes($password);
if($step == "2"){
if(!$username){
$errors[] = "Please enter a <b>username</b>";
}else {
if(!$password) {
$errors[] = "Please enter a <b>Password</b>";
}else{
$sql = "SELECT * FROM users WHERE username = '$username'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) > 0){
$sql2 = "SELECT * FROM users WHERE username = '$username' && password = '$password'";
$res2 = mysql_query($sql2) or die(mysql_error());
if(mysql_num_rows($res2) > 0){
else{
$errors[] = "The <b> Username and <b> Password </b> do not match\n";
}
}else {
$errors[] = "The <b>username</b> does not exist.\n";
}
}
}
if(count($errors) > 0){
echo "The following Errors have occured:\n";
foreach($errors AS $error){
echo $error . "<br>\n";
}else {
$sql3 = "SELECT * FROM users WHERE username = '$username'";
$res3 = mysql_query($sql3) or die(mysql_error());
while($row = mysql_fetch_assoc($res3)){
$_SESSION['uid'] = $row['id'];
echo "You have successfully logged in.\n";
}
}
}
}
?>
</div>
</div>
</div>
</body>
</html> |
i have checked the curly brackets but nothing seems to make it appear up. i am talking about the actual form not showing up. it would let me login before but now i cant login because there is no form.
|
|