Jump to content

Interating script into site design help


nealec

Recommended Posts

Im trying to get a login/register script to work in my existing page design but im getting an error, i have no idea what im doing i know next to nothing about php, i just follow tutorials. Most of the error is hidden because the font is the same color as the background but is says:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/aretheyh/public_html/nealeweb.com/index.php:16) in /home/aretheyh/public_html/nealeweb.com/index.php on line 25

 

Heres the page link where the error occurs:

 

http://www.nealeweb.com/index.php

 

Please help, im useless!

Link to comment
Share on other sites

Sorry here you go

 

<html>

 

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>New Page 6</title>

</head>

 

<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">

 

<div align="center">

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tr>

<td>

<img border="0" src="nealewebpreviews/Design3/headimg.jpg" width="566" height="138"></td>

<td>

<img border="0" src="nealewebpreviews/Design3/clockdemo.jpg" width="264" height="138" align="right"></td>

</tr>

</table>

</div>

<div align="center">

<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#000000">

<tr>

<td width="40"> </td>

<td> <?php

session_start();

require_once 'database.php';

if (isset($_SESSION['user'])){

?>

<form name="logout" method="post" action="logout.php">

<input type="submit" name="logout" id="logout" value="Logout">

</form>

<br /><form name="news" method="post" action="news.php">

  <input type="submit" name="news" id="news" value="News">

</form>

<?php

}

 

elseif(isset($_SESSION['admin'])){

echo"Welcome ".$_SESSION['admin'];

echo"<br><br>You are logged in as an Admin";

?>

<form name="logout" method="post" action="logout.php">

<input type="submit" name="logout" id="logout" value="Logout">

</form>

<br /><form name="news" method="post" action="news.php">

  <input type="submit" name="news" id="news" value="News">

</form>

<?php

 

}else{

?>

<form name="login_form" method="post" action="login.php">

  <label>

  <input name="user" type="text" id="user"><font color="#FFFFFF"> Username</font></label><p>

<label>

  <br />

  <input name="pass" type="password" id="pass" size="20"><font color="#FFFFFF"> Password</font><br />

   </label></p>

<p>

<input type="submit" name="login" id="login" value="Login">

  </label>

  

  <input type="submit" name="register0" id="register" value="Register">

</p>

</p>

</form>

<form name="Register" method="post" action="reg.php">

   </form>

</form>

<?php

}

?></td>

<td width="551">

<img border="0" src="nealewebpreviews/Design3/midbarimgr.jpg" width="551" height="223" align="right"></td>

</tr>

</table>

</div>

<div align="center">

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tr>

<td background="nealewebpreviews/Design3/mbarbg.jpg" width="1283">

<img border="0" src="nealewebpreviews/Design3/mbar.jpg" width="900" height="45"></td>

<td background="nealewebpreviews/Design3/mbarbg.jpg">

<img border="0" src="nealewebpreviews/Design3/Collapse.jpg" width="52" height="45"></td>

</tr>

</table>

</div>

 

</body>

 

</html>

Link to comment
Share on other sites

Didn't test or proof-read; however, compare your original to this...

(MAYBE even print both on paper and compare side-by-side to see differences)

<?php
session_start();
require_once ('database.php'); /* Not realyy needed as you are not doing anything with the database in this script */
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 6</title>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td><img border="0" src="nealewebpreviews/Design3/headimg.jpg" width="566" height="138"></td>
		<td><img border="0" src="nealewebpreviews/Design3/clockdemo.jpg" width="264" height="138" align="right"></td>
	</tr>
</table>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#000000">
	<tr>
		<td width="40"> </td>
		<td> 
			<?php
			if (isset($_SESSION['user'])){
				?>
				<a href="logout.php?logout=1">Log out</a>
				<br />
				<a href="news.hp?news=1">News</a>
				<?php
			}elseif(isset($_SESSION['admin'])){
				echo"Welcome " . $_SESSION['admin']  . "<br><br>You are logged in as an Admin";
				?>
				<a href="logout.php?logout=1">Log out</a>
				<br />
				<a href="news.hp?news=1">News</a>
				<?php
			}else{
				?>
				<form name="login_form" method="post" action="login.php">
					<label><input name="user" type="text" id="user"><font color="#FFFFFF"> Username</font></label>
					<p>
					<label><br />	<input name="pass" type="password" id="pass" size="20"><font color="#FFFFFF"> Password</font><br />	 </label>
					</p>
					<p>
					<label><input type="submit" name="login" id="login" value="Login"></label>
					  
					<input type="submit" name="register0" id="register" value="Register">
					</p>
					</p>
				</form>
				<form name="Register" method="post" action="reg.php">
					 
				</form>
				<?php
			}
			?>
		</td>
		<td width="551"><img border="0" src="nealewebpreviews/Design3/midbarimgr.jpg" width="551" height="223" align="right"></td>
	</tr>
</table>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td background="nealewebpreviews/Design3/mbarbg.jpg" width="1283">
			<img border="0" src="nealewebpreviews/Design3/mbar.jpg" width="900" height="45">
		</td>
		<td background="nealewebpreviews/Design3/mbarbg.jpg">
			<img border="0" src="nealewebpreviews/Design3/Collapse.jpg" width="52" height="45">
		</td>
	</tr>
</table>
</div>
</body>
</html>

Link to comment
Share on other sites

Didn't test or proof-read; however, compare your original to this...

(MAYBE even print both on paper and compare side-by-side to see differences)

<?php
session_start();
require_once ('database.php'); /* Not realyy needed as you are not doing anything with the database in this script */
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 6</title>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td><img border="0" src="nealewebpreviews/Design3/headimg.jpg" width="566" height="138"></td>
		<td><img border="0" src="nealewebpreviews/Design3/clockdemo.jpg" width="264" height="138" align="right"></td>
	</tr>
</table>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#000000">
	<tr>
		<td width="40"> </td>
		<td> 
			<?php
			if (isset($_SESSION['user'])){
				?>
				<a href="logout.php?logout=1">Log out</a>
				<br />
				<a href="news.hp?news=1">News</a>
				<?php
			}elseif(isset($_SESSION['admin'])){
				echo"Welcome " . $_SESSION['admin']  . "<br><br>You are logged in as an Admin";
				?>
				<a href="logout.php?logout=1">Log out</a>
				<br />
				<a href="news.hp?news=1">News</a>
				<?php
			}else{
				?>
				<form name="login_form" method="post" action="login.php">
					<label><input name="user" type="text" id="user"><font color="#FFFFFF"> Username</font></label>
					<p>
					<label><br />	<input name="pass" type="password" id="pass" size="20"><font color="#FFFFFF"> Password</font><br />	 </label>
					</p>
					<p>
					<label><input type="submit" name="login" id="login" value="Login"></label>
					  
					<input type="submit" name="register0" id="register" value="Register">
					</p>
					</p>
				</form>
				<form name="Register" method="post" action="reg.php">
					 
				</form>
				<?php
			}
			?>
		</td>
		<td width="551"><img border="0" src="nealewebpreviews/Design3/midbarimgr.jpg" width="551" height="223" align="right"></td>
	</tr>
</table>
</div>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td background="nealewebpreviews/Design3/mbarbg.jpg" width="1283">
			<img border="0" src="nealewebpreviews/Design3/mbar.jpg" width="900" height="45">
		</td>
		<td background="nealewebpreviews/Design3/mbarbg.jpg">
			<img border="0" src="nealewebpreviews/Design3/Collapse.jpg" width="52" height="45">
		</td>
	</tr>
</table>
</div>
</body>
</html>

 

Ok thanks thats got rid of the error msg but for some reason the login and register buttons are no longer taking me to the right pages

 

Try it: http://www.nealeweb.com/index.php

Link to comment
Share on other sites

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.