Forum Moderators: coopster
include("includes/security.php");
<?php
if (! isset($_SESSION['id'])){
header("location: login.php");
exit;
}
?>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="bigboldy"; // Mysql password
$db_name="test"; // Database name
$tbl_name="users"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
session_start();
$userid = $_POST['userid'];
$password = $_POST['password'];
$submitted = $_POST['submitted'];
if ($userid && $password){
/////////////////////////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM users WHERE username='$userid' and password='$password'");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);
/////////////////////////////////////////////////////////////////////////
}
if ($rowAccount){
$_SESSION['id'] = $rowAccount['username'];
header("location:welcome.php");
exit;
}elseif($submitted){
echo "You dont exist in the system so your not getting in";
}
?>
<?php
error_reporting(E_ALL|E_STRICT);
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="bigboldy"; // Mysql password
$db_name="test"; // Database name
$tbl_name="users"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
require("includes/security.php");
session_start();
$id = $_SESSION['id'];
/////////////////////////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM users WHERE username='$id'");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);
/////////////////////////////////////////////////////////////////////////
?>