Jump to content

Recommended Posts

Hello I am trying to integrate the login so you can login in on my main page. Everything works fine in firefox but when I try it in IE it wont let me login.  :shock: I hate IE and I dont use it but there's lots of other users who do. i get some heading errors too they appear in firefox too but it all works fine in firefox just the stupid errors..

 

This error appears in both firefox and in IE for some reason when I refresh the page in firefox the error goes away..

Warning: Cannot modify header information - headers already sent by (output started at /home/nanotech/public_html/index.php:13) in /home/nanotech/public_html/forum/includes/sessions.php on line 366

Warning: Cannot modify header information - headers already sent by (output started at /home/nanotech/public_html/index.php:13) in /home/nanotech/public_html/forum/includes/sessions.php on line 367

 

Here's the site:

http://nanotech.pcriot.com/

 

Here's my code:


<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/'; //Relative path to your PHPBB2 installation
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);

if( !$userdata['session_logged_in'] ) // Is the user NOT logged in?
   {
      ?>
				<h2 class="login"><em>user</em>login</h2>
				<form action="forum/login.php" method="post" name="login">
					<div id="login-username">
						<div><label for="username">username</label>: <input type="text" name="username"></div>
						<div><label for="password">password</label>: <input type="password" name="password"></div>
					</div>
					<div id="login-button">
						<input type="hidden" name="redirect" value="../index.php">
						<input type="image" src="images/btn_login.gif" value="login" name="login">
					</div>
					<div class="clear">
						<div class="reg">
							New User? <a href="http://nanotech.pcriot.com/forum/profile.php?mode=register">REGISTER for FREE</a>
						</div>
					</div>
				</form>
      <?php
   }
if( $userdata['session_logged_in'] ) // Is the user logged in?
   {
    $appendLogout = $u_login_logout = $phpbb_root_path.'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id']; // Add the session ID to the logout link
    echo "Welcome back, <a href=\"forum/profile.php?mode=viewprofile&u=".$userdata['user_id']."\" title=\"".$userdata['username']."\">".$userdata['username']."</a>!<br />"; // Show a welcome message
    echo "<a href=\"forum/privmsg.php?folder=inbox\" title=\"You have ".$userdata['user_unread_privmsg']." new messages\">(".$userdata['user_unread_privmsg'].") New Messages</a><br />"; // Any new PMs?
    echo "<a href=\"forum/profile.php?mode=editprofile\" title=\"My Profile\">My Profile</a><br />"; // Edit your profile link
    echo "<a href=\"".$appendLogout."\" title=\"Logout\">Logout</a><br />"; // Logout link
   } // end if, if you want you could add a login form in an else statement below
?>

 

like I said it works fine in firefox just IE that wont let me login. And is there anyway to make it so that it wont go to the forums when you logoff it just takes you back to the same page from where you logged off of?

 

 

-Toasterthegamer

Link to comment
https://forums.phpfreaks.com/topic/71446-solved-help-with-login/
Share on other sites

hmmm I already have the sessions starting at the top... I think it might be a problem with the cutenews it has sessions too..  :P Please help I really dont know what to do.. Here's the full code:

 

<?php
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/'; //Relative path to your PHPBB2 installation
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>Nano Technologies - News</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />	

</head>

<body>

<div id="outer">
<div id="wrapper">
	<div id="nav">
	  <div id="nav-left">
	    <div id="nav-right">
		<?php include('links.php');?>
	    </div>
	  </div>
		<div class="clear"></div>
	</div>
	<div id="head">
		<div id="head-left"></div>
		<div id="head-right"></div>
		<div id="head-1"></div>
		<h1><span class="logo"><span class="top">Nano</span><span class="gadgets">Technologies</span></span></h1>
		<div id="navb">
			<?php include('links2.php');?>
		</div>
	</div>
	<div id="head-2"></div>
	<div id="login">
		<div id="login-bot">
			<div id="login-box">
<?php

if( !$userdata['session_logged_in'] ) // Is the user NOT logged in?
   {
      ?>
				<h2 class="login"><em>user</em>login</h2>
				<form action="forum/login.php" method="post" name="login">
					<div id="login-username">
						<div><label for="username">username</label>: <input type="text" name="username"></div>
						<div><label for="password">password</label>: <input type="password" name="password"></div>
					</div>
					<div id="login-button">
						<input type="hidden" name="redirect" value="../index.php">
						<input type="image" src="images/btn_login.gif" value="login" name="login">
					</div>
					<div class="clear">
						<div class="reg">
							New User? <a href="http://nanotech.pcriot.com/forum/profile.php?mode=register">REGISTER for FREE</a>
						</div>
					</div>
				</form>
      <?php
   }
if( $userdata['session_logged_in'] ) // Is the user logged in?
   {
    $appendLogout = $u_login_logout = $phpbb_root_path.'login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id']; // Add the session ID to the logout link
    echo "Welcome back, <a href=\"forum/profile.php?mode=viewprofile&u=".$userdata['user_id']."\" title=\"".$userdata['username']."\">".$userdata['username']."</a>!<br />"; // Show a welcome message
    echo "<a href=\"forum/privmsg.php?folder=inbox\" title=\"You have ".$userdata['user_unread_privmsg']." new messages\">(".$userdata['user_unread_privmsg'].") New Messages</a><br />"; // Any new PMs?
    echo "<a href=\"forum/profile.php?mode=editprofile\" title=\"My Profile\">My Profile</a><br />"; // Edit your profile link
    echo "<a href=\"".$appendLogout."\" title=\"Logout\">Logout</a><br />"; // Logout link
   } // end if, if you want you could add a login form in an else statement below
?>
			</div>
			<div id="login-welcome">
				<div>
					<?php include('welcome.php');?>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<div id="body">
		<div id="body-bot">
				<h2><span><strong>News</strong> of this month</span></h2>
				<div id="items">
					<div class="item">
					  	<?PHP
						 $number = "2";
						 include("news/show_news.php");
						?>
					</div>
					<div class="clear"></div>
				</div>
				<div id="banner">
					<img src="images/pic_5.jpg" width="256" height="109" alt="Nokia 6015i" class="left" />
					<div id="banner-text">
						<h3><a href="http://www.nvidia.com">Nvidia GFX cards</a></h3>
						<ul>
						  <li>Want high end GFX choose nividia for the best 3D experance</li>
						  <li>Nano Tech supports nvidia 100%</li>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
				<div id="footer">
					<div id="footloose"><span class="logo"><span class="top">Nano</span><span class="gadgets">Technologies</span></span></div>
					<p> <br />
					© Copyright 2007. All rights reserved.</p>
				</div>					
		</div>
	</div>
</div>
</div>

</body>
</html>

 

Sorry that some of the stuff isnt indented like it's suppose to be... I had them in include files...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.