Hello,
I am having some problems with my login form, so here is the functions.php file -
<?php
include "connect.php";
if(!isset($_SESSION))
{
session_start();
}
if (isset($_POST['login']))
{
$connect = mysql_connect("$host","$user","$pass") or die("$error");
mysql_select_db("$db") or die("$error");
$data = mysql_query("SELECT username FROM users WHERE username='$_POST[username]'");
$num = mysql_num_rows($data);
if($num > 0)
{
//Check Password
if (isset($_POST['password']))
{ $password = $_POST['password']; }
$pass = mysql_query("SELECT password FROM users WHERE username='$_POST[username]'");
$row = mysql_fetch_array($pass);
$db_pass = $row['password'];
if($password==$db_pass)
{
$_SESSION['auth']="yes";
$_SESSION['logname'] = $_POST['username'];
header("Location: user.php");
}else{
$message_1 = "Incorrect Password!";
$username = strip_tags(trim($_POST['username']));
include("index.php");
}
}elseif($num == 0)
{
$message_1 = "There is no such user!";
include("index.php");
}
}
?>
So here's the problem -
On my actual login form when i type in my username and password all the form does is sort of refreshes itself, well thats what it looks like, the form does nothing.
So if anyone can help me then i will greatly appreciate it.