Hi guys.
My last issue was resolved, but now I have an even bigger one.
My login script is meant to scan the database for the username a password entered, and if they match, set a cookie and display a welcome message.
But it doesn't.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
//Connects to database
require("../config.php");
$user = $_POST['user'];
$pass = $_POST['pass'];
$user = strtolower($user);
if (is_dir ('../install'))
{
header('Location: ../install/error.php');
}
else
{
if ($user == "" or $pass == "")
{
header('Location: login.php');
}
else
{
//Requires header
require("includes/header.php");
mysql_select_db($dbname,$connect);
$login_sql = "SELECT user_title, user_password FROM easybb_users WHERE user_title = '".$_POST['user']."' AND user_password = PASSWORD('".$_POST['pass']."')";
$login_res = mysql_query($login_sql,$connect);
//Get number of rows. Should be 1 if a match
if (mysql_num_rows($login_res) == 1)
{
//If a match, get values of username
while($info = mysql_fetch_array($login_res))
{
$user_title = stripslashes($info['user_title']);
}
//Set auth cookie
setcookie("logged", "*E5805F1AE06514B2C19FB2A223F3D0A27DB2F003", time()+86400);
echo "<div id='starter'>
<div class='border'>
<div class='block'>
<div class='bottom'>
<h3>Login</h3>
</div>
<ol>
You have successfully logged in as '".$_POST['user']."'.
</ol>
</div>
</div>
</div><br/>";
}
else
{
echo "<div id='starter'>
<div class='border'>
<div class='block'>
<div class='bottom'>
<h3>Login</h3>
</div>
<ol>
You could not be logged in.
</ol>
</div>
</div>
</div><br/>";
}
//Requires footer
require("includes/footer.php");
}
}
//Closes connection
mysql_close($connect);
?>
The errors I got:
Warning: mysql_select_db(): 6 is not a valid MySQL-Link resource in C:\apache2triad\htdocs\easybb\login\do_login.php on line 30
Warning: mysql_query(): 6 is not a valid MySQL-Link resource in C:\apache2triad\htdocs\easybb\login\do_login.php on line 32
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\apache2triad\htdocs\easybb\login\do_login.php on line 35
Warning: mysql_close(): 6 is not a valid MySQL-Link resource in C:\apache2triad\htdocs\easybb\login\do_login.php on line 86
Thanks,
- Poomie