andere oplossing voor commando header()

Status
Niet open voor verdere reacties.

waldpiek

Gebruiker
Lid geworden
13 apr 2007
Berichten
8
hallo

ik ben bezig met een script in mijn site aan zetten. nou maakt dit script heel veel gebruik van commando header(). nou weet ik dat header voor alles verzend moet worden.

PHP:
<?



	//clear session variables
	session_unset();

	//check to see if cookies are already set, remember me
	if ((!$lr_user) || (!$lr_pass))
	{

		$username = $_POST[username];
		$password = $_POST[password];

	}else{

		$username = $lr_user;
		$password = $lr_pass;

	}

	//if username or password is blank, send to errorlogin.html
	if ((!$username) || (!$password)) 
	{

		header("Location:$base_dir");
		exit;
	
	}

?>
dit is een stukje code dat geinclude is in mijn website bij het script is het een losse pagina. nu krijg ik die header nooit werkende doordat deze niet include mag worden. weet iemand een andere oplossing.

dit is de index.php
PHP:
<?php>

	// --------------------------------------------Loading all Libraries. 
	//include ("libs/config.php");
	include ("libs/localconfig.php");
	
	// --------------------------------------------Start body #1

	print	"<HTML>";
	print		"<HEAD>";
	print			"<TITLE>Holwerda.nu</TITLE>";
	print			"<LINK HREF=\"style.css\" TYPE=\"text/css\" REL=\"stylesheet\">";
	print		"</HEAD>";
	print		"<BODY  background=\"images/bg.jpg\" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 rightmargin=\"0\" bottommargin=\"0\">";
	print			"<center>";
	print			"<TABLE BGCOLOR=\"lightblue\" WIDTH=768 HEIGHT=\"100%\" BORDER=0  CELLPADDING=0 CELLSPACING=0>"; 

	
	// --------------------------------------------End Body #1
	

	
	// --------------------------------------------START Header
	
	include ("includes/header1.php");
	include ("includes/header2.php");
	include ("includes/header3.php");
	
	// --------------------------------------------End Header
	// --------------------------------------------Start Main #1
	
	
	print				"<TABLE WIDTH=768 BGCOLOR=\"FAFAFA\" HEIGHT=\"\" BORDER=0  CELLPADDING=0 CELLSPACING=0>"; 
	print					"<TR>";
	print						"<TD width=\"1\" bgcolor=\"#6F7172\" rowspan=\"6\">";
	print						"</TD>";
	
		
	if (isset($_GET['pPag']))
	{	
		
		$pPag=$_GET['pPag'];

		include("modules/" . $pPag . ".php");

	}
	else
	{
		include ("modules/main/main.php");
	}	
	
	print						"<TD width=\"1\" bgcolor=\"#6F7172\" rowspan=\"6\">";
	print						"</TD>";
	print					"</TR>";
	print				"</TABLE>";

	
	// --------------------------------------------END Main #1
	// --------------------------------------------START Footer #1
	
	include("includes/footer.php");
	
	// --------------------------------------------END Footer #1
	// --------------------------------------------START Body #2

	print			"</table>";
	print			"</center>";
	print		"</BODY>";
	print	"</HTML>";

	// --------------------------------------------End Body #2
	
?>

en in de header staat een header 2 staat login form.

PHP:
<?php


    print													"<div style=\"padding-top:5px;padding-left:10px \">";
    	
    print														"<FORM METHOD=\"POST\" ACTION=\"index.php?pPag=login/redirect\">";
	print	    													"<BR><font face=\"Verdana\" size=\"2\" color=\"#E6373C\"><STRONG>Username:</STRONG>&nbsp;";
    print															"<input type=\"text\" NAME=\"password\" style=\"width:125px; height:15px; font-family:Tahoma; font-size:9px; color:#999999  \">";
	print															"<BR><font face=\"Verdana\" size=\"2\" color=\"#E6373C\"><STRONG>Password :</STRONG>&nbsp;";
    print															"<input type=\"password\" NAME=\"password\" style=\"width:125px; height:15px; font-family:Tahoma; font-size:9px; color:#999999  \">";
 	print															"<img src=\"images/spacer.gif\" height=\"3px\">";
	print															"<BR><BR><input type=\"image\" src=\"images/go.jpg\"  align=\"\" style=\"margin-right:28px \">";	
	print														"</form>";
	
	print													"</div>";	
	
?>
 
Header probleem

Ik heb je script niet echt goed bekeken, maar probeer het eens met javascript!

Hieronder een voorbeeldscript, misschien heb je er wat aan!

Code:
<html>

<head>
<title>test</title>
 <script language="javascript">
<!--
function ga(locatie)
{
   window.location.href = locatie;
}
//-->
</script>
</head>

<body>
<button onclick="ga('http://www.google.nl/')">Google</button>
</body>

</html>

Hopelijk is dit wat je bedoelt!

Groet,
Gerald
 
Je kan bijvoorbeeld ook ob_start() helemaal boven aan zetten, is niet netjes, maar kan wel.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan