0

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;
				}
		}
?>

Edited by MavrickIT: n/a

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by twiss
0

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.

0

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.

0

:)
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>';
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.