hello friends,

i am a newbie in php.. doing project for my college. doing it with a lot of help with this site n some others but stuck in the login page, it seems either there is some problem in databse connection or session registration.. when i put username n password it returns me to that login page again.. can anyone help me to identify the problem.. i am using Dreamweaver editor n xampp as server

<?php
 session_start();
 session_register("is_logged_in");
$myusername=$_POST['uid']; 
$mypassword=md5($_POST['pass']);
if (!isset($myusername) || !isset($mypassword)) { 
header( "Location: http://localhost/XXX/index.html" ); 
exit;
}
elseif (empty($myusername) || empty($mypassword)) { 
header( "Location: http://localhost/XXX/index.htmll" ); 
exit;
}
else{	
$host="localhost"; // Host name 
$username="Aritra"; // Mysql username 
$password="******";//Mysql password
$db_name="****"; // Database name 
$tbl_name="login_details"; // Table name
$db_connect=mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DataBase");
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE login_id='$myusername' and passwd='md5($mypassword)'";
$result=mysql_query($sql, $db_connect);
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count>0){
$_SESSION['is_logged_in'] = 1;
}
if(!isset($_SESSION['is_logged_in'])) {
	header("location:./download.html");
	exit;
} else {
    header("location:http://localhost/XXX/index.html");
	exit();
}
}
 ?>

srry guys, its my fault. i have forgotten to declare privilege to the user in database.. now its working..

sorry for wasting ur time.
mods r requested to delete this thread

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.