Hello,

I have tried changing all my login scripts from the old session_registered and $username=$_SESSION['Username'] but for some reason the new method of code doesn't work either and now thing will work, please help as i am lost

Check LOGIN Page
PHP Code:
<? 
session_start
();
session_destroy();
?>
<?php

// username and password sent from signup form 
$Username=$_POST['PostUsername']; 
$Password=$_POST['PostPassword'];

$sql="SELECT * FROM $tbl_name WHERE username='$Username' and password='$Password'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);

if(
$count==1){

// Register $Username, $Password and redirect to file "logged_h.php"
$_SESSION['Username'] = $Username;
$_SESSION['Password'] = $Password;
header("location:logged_in.php");
}
else {
session_destroy();
header("location:login_failure.php");
}
?>
Here is my Logged in code to check to see if the user is registered.
PHP Code:
<?php
session_start
();

if(isset(
$_SESSION['Username'])){

$sql="SELECT * FROM $tbl_name WHERE username='$Username' and password='$Password' LIMIT 1";
$result=mysql_query($sql) or die("SQL Error: $sql<br>" mysql_error()); 
$rows=mysql_fetch_array($result);
$usernamematch=$rows['username'];
if(
$usernamematch==$Username){
$logincheck="pass";
}
else{
$checkuser="failed";
session_start();
session_destroy();
}
}
else{
$checkuser="failed";
session_start();
session_destroy();
}
?>