Here is the project link: http://d-h-enterprise.com/zshop/
user:admin
pass:123456

After login I am getting errors those below here


Warning: Cannot modify header information - headers already sent by (output started at /home/dhenter/public_html/zshop/menubar.php:4) in /home/dhenter/public_html/zshop/login_c.php on line 26

Warning: Cannot modify header information - headers already sent by (output started at /home/dhenter/public_html/zshop/menubar.php:4) in /home/dhenter/public_html/zshop/login_c.php on line 27

here is login_c.php

<?php @$name=$_POST['name'];
	@$pass=$_POST['pass'];
	
	if(!$name || !$pass ) 
		{
		  
		  
		  
		   print("<script>window.location='index.php?script=signin-form'</script>");
		   exit;
 		}      
	else
	{	
		
		$query = mysql_query("select * from user where name='$name' and pass='$pass'");
		$collect =mysql_fetch_array($query);
		
		
				if(mysql_num_rows($query) > 0)
				{
					$C_USERNAME = $collect['name'];
					//setcookie("$c_username", "$c_usertype", time()+3600); 
					$_SESSION['name']=$C_USERNAME;
					session_register("C_USERNAME");
					$_SESSION['userType']=$collect['UserType'];
					header("Location: ".$_SERVER['HTTP_REFERER']);
					header("Location:index.php?script=adminMenu");
				}
				
				else
				{
				   
					print("<script>window.location='index.php?script=signin-form&ucheck=1&user={$name}'</script>");
					session_destroy();
					exit;
				}
		}
?>

Recommended Answers

All 5 Replies

The problem is, that before this script even started executing, you already echoed (or printed) some text. As this script as far as I can see will always cause a redirect, you don't need menubar.php. Also I would change the javascript to headers.

The problem is, that before this script even started executing, you already echoed (or printed) some text. As this script as far as I can see will always cause a redirect, you don't need menubar.php. Also I would change the javascript to headers.

It would be great if you tell me how could i solve this issue. I am here to assit you just let me know how can help you to solve this issue.

:)
You need to remove the menubar.php include.

Another (perhaps easier) solution is to change your 2 headers to something like

echo '<script>window.location="index.php?script=adminMenu";</script>';

thanks for ur help. issue solved

Okay, great :)

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.