Originally Posted by
karl94
Can you post the PHP code in BBElec.php?
Here is the code
PHP Code:
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$con=mysql_connect('localhost','bbelectricalsite','') or die(mysql_error());
mysql_select_db('my_bbelectricalsite') or die("cannot select DB");
$query=mysql_query("SELECT * FROM users WHERE username='".$user."' AND password='".$pass."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($user == $dbusername && $pass == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$user;
/* Redirect browser */
header("Location: http://bbelectricalsite.altervista.org/materialize/tblexp.php");
}
} else {
echo "Invalid username or password!";
}
} else {
echo "All fields are required!";
}
}
?>