Oh I also have two sessions a SESSION and NEW SESSION not sure what is the difference between the two.Maybe what I am doing wrong is here not sure
SESSION.PHP
[php]
session_start();
session_register("session");
[/php]
NEWSESSION.PHP
[php]
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
$session['id']=session_id();
$session['username']=$username;
//echo $session['userid'];
[/php]
This is my form it always goes to Wrong login no matter what.Did not have the tags before now I put them in.
<!doctype html public "-//w3c//dtd html 3.2//en">
[html]
<head>
<title>login form</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<table><tr><td>
<img src="asset.png">
</td></tr></table>
<form action='loginck.php' method=post>
<table border='0' cellspacing='0' cellpadding='0' align=center>
<tr id='cat'>
<tr> <td bgcolor='#f1f1f1' ><font face='verdana, arial, helvetica' size='2' align='center'> Login ID
</font></td> <td bgcolor='#f1f1f1' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='username' ></font></td></tr>
<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'> Password
</font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' >
<input type ='text' class='bginput' name='password' ></font></td></tr>
<tr>
<td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
<input name="submit" type='submit' value='Submit'>
<input type='reset' value='Reset'>
</font></td>
</tr>
<tr> <td bgcolor='#ffffff' ><font face='verdana, arial, helvetica' size='2' align='center'> <a href='signup.php'>New Member Sign UP</a></font></td> <td bgcolor='#ffffff' align='center'><font face='verdana, arial, helvetica' size='2' ><a href=forgot-password.php>
Forgot Password</a> ?</font></td></tr>
<tr> <td bgcolor='#f1f1f1' colspan='2' align='center'><font face='verdana, arial, helvetica' size='2' align='center'>
</font></td> </tr>
</table></center></form>
</body>
[/html]
////the validation is done here
[php]
include "session.php";
include "z_db.php";
//////////////////////////////
[/php]
<!doctype html public "-//w3c//dtd html 3.2//en">
[html]
<head>
<title>(Type a title for your page here)</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<table><tr><td>
<img src="asset.png">
</td></tr></table>
<?
$username=mysql_real_escape_string($username);
$password=mysql_real_escape_string($password);
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username='$username' AND password = '$password'"))){
if(($rec['username']==$username)&&($rec['password']==$password)){
include "newsession.php";
echo "<p class=data> <center>Successfully,Logged in<br><br><a href='logout.php'> Log OUT </a><br><br><a href=welcome.php>Click here if your browser is not redirecting automatically or you don't want to wait.</a><br></center>";
print "<script>";
print " self.location='welcome.php';"; // Comment this line if you don't want to redirect
print "</script>";
}
}
else {
session_unset();
echo "<font face='Verdana' size='2' color=red>Wrong Login. Use your correct Userid and Password and Try <br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}
[/php]
</body>
[/html]