i inserted a login and registeration script in to my website. i had some errors in it but i fixed them. but now,my problem is,even after logging in ,the browser does not show the page i expect.but it shows the same login page. please solve my problem. here's the script of my login page and one of my members page script. <? $dbhost = "localhost"; $dbname = ""; $dbuser = ""; $dbpass = ""; mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = $_POST['username']; $password = md5($_POST['password']); $query = "select * from users where username='$username' and password='$password'"; $result = mysql_query($query); if(!$result){die(mysql_error();} mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) !== 1) { $error = "Bad Login"; include "login.html"; } else { $_SESSION['username'] = "$username"; include "tamilmp3.php"; include "downloads.php"; include "cinenews.php"; include "trailor.php"; include "tech.php"; } ?> PHP: script of my cinenews.php <?php session_start(); if ( empty( $username ) ) { print "Please login below!"; include 'login.html'; } else { ?> <html> <head> <title></title> <meta name="description" content="The ultimate tamil cinenews portal.grab all the latest hot gossips on tamil movies,actors,actress,interviews,film reviews,release dates and more.Also download unlimited number of latest tamil movie songs in mp3 format and top rated softwares for free" /> <meta name="keywords" content="kollywood gossips,news,hot,tamil cinema world news ajiths,vikarams,suryas,vijays,rajini,kamal,nayanthara,trisha,jothika,namitha,bhavana,kushboo,jeeva,maddy,kodambakkam special" /> </head> <frameset rows="131,*" cols="*" framespacing="0" frameborder="NO" border="0"> <frame src="top.php" name="topFrame" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" > <frameset rows="*" cols="138,*" framespacing="0" frameborder="NO" border="0"> <frame src="left.php" name="leftFrame" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0"> <frameset rows="23,*" cols="*" framespacing="0" frameborder="NO" border="0"> <frame src="n_top.php" name="topFrame1" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0" > <frameset rows="*,15" cols="*" framespacing="0" frameborder="NO" border="0"> <frame src="maincinenews.php" name="mainFrame" frameborder="no" marginwidth="0" marginheight="0"> <frame src="n_bot.php" name="bottomFrame" frameborder="no" scrolling="NO" noresize marginwidth="0" marginheight="0"> </frameset> </frameset> </frameset> </frameset> <noframes><body> </body></noframes> </html> <? } ?> PHP:
Try changing your code in cinenews.php to the following. session_start(); if ( empty( $_SESSION['username'] ) ) { PHP: By the way oyu have duplicate query in login script $result = mysql_query($query); if(!$result){die(mysql_error();} mysql_query($query) or die(mysql_error()); PHP: