Hi, My codes are as follows,
login.php <? session_start(); if (!$HTTP_POST_VARS['logname'] && !$HTTP_POST_VARS['logpass']) { // User needs to supply login name and password. ?> // This is my default header that I want to include on every page. <html> <head> <title>Support Center</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="css/test.css" type="text/css"> </head> <body leftmargin="0" topmargin="0" rightmargin="0"> <table width="100%" border="0" bgcolor="#005796" cellpadding="0" cellspacing="0"> <tr> <td align="left" bgcolor="#005796"><img src="images/logo.gif" alt="logo"></td> <td align="right" class="ttext"><b>Support<br>Center</b></td> <td> </td> </tr> <tr bgcolor="orange"> <td align="left"> upload download</td> <td colspan="2" align="right">Logout </td> </tr> </table> // End of my default header that I want to include on every page. <h1 align="center">Support Center</h1> <form name="fm" method="post" action="login.php"> <table border="0" cellspacing="5" cellpadding="5" align="center" bgcolor="#fffacc"> <tr> <td align="right"><b>User Name</b></td> <td><input type="text" size="25" maxlength="20" name="logname" value="" /></td> </tr> <tr> <td align="right"><b>Password</b></td> <td><input type="password" size=25 maxlength="20" name="logpass" value="" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Log in Now" name="submit" /> <input type="reset" value="Cancel" name="reset" /></td> </tr> </table> </form> </body> </html> <? } else { // connect to mysql $authdb=mysql_connect('localhost', 'webauth', 'webauth') or die("Cannot connect to database."); // select the appropriate database mysql_select_db('auth', $authdb) or die("Cannot select db."); // query the database to see if there is a record which matches $query="select * from auth where usrname='$HTTP_POST_VARS[logname]' and usrpass=md5('$HTTP_POST_VARS[logpass]')"; $result=mysql_query($query) or die("Cannot run query."); $row=mysql_fetch_row($result); if (mysql_num_rows($result) > 0) { $_SESSION['userid']=$row[0]; $_SESSION['userlevel']=$row[1]; $_SESSION['usersec']=mt_rand(1000000, 9999999); $updatesql="update auth set seckey='$_SESSION[usersec]' where usrid='$_SESSION[userid]'"; if (!mysql_query($updatesql)) die ("Cannot update database."); header("Location: down.php"); die (); } else { echo "<h1>Go Away!</h1>"; echo "You are not authorized to view this resource."; die(); } } ?> down.php <? session_start(); if ($_SESSION['userid'] && $_SESSION['userlevel'] && $_SESSION['usersec']) { // connect to mysql $authdb=mysql_connect('localhost', 'webauth', 'webauth') or die("Cannot connect to database."); // select the appropriate database mysql_select_db('auth', $authdb) or die("Cannot select db."); // query the database to see if there is a record which matches $query="select * from auth where usrid='$_SESSION[userid]' and usrlevel='$_SESSION[userlevel]' and seckey='$_SESSION[usersec]'"; $result=mysql_query($query, $authdb) or die("Cannot run query."); $row=mysql_fetch_row($result); if (mysql_num_rows($result) > 0) { ?> // I want to include the default header in here again. But it does not work. <? } } ?> Thanks, Norman "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... On Saturday 20 April 2002 05:07, Norman Zhang wrote: > Hi, > > I use header(location: ...) for redirection to another page. But I also > want to include <title>, <meta> and <link> tags in the other page. Is there > a way to this? Because php complains that the header already been sent. Show us your code. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Spiritual leadership should remain spiritual leadership and the temporal power should not become too important in any church. - Eleanor Roosevelt */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php