Jump to content


header error


2 replies to this topic

#1 venomsnake

    Jedi In Training

  • Members
  • PipPip
  • 481 posts
  • Gender:Male

Posted 04 October 2005 - 06:07 PM

im making a member system, and when i try to login in, i get a error:

Quote

Warning: Cannot modify header information - headers already sent by (output started at /home/cory/domains/gamingreloaded.com/public_html/zp/member system/config.php:1) in /home/cory/domains/gamingreloaded.com/public_html/zp/member system/login.php on line 27

then when i go to member.php page, i can get it, then when i log out, and try to get to the member page, it takes me back to the login page (which is right) but i cant get it to go to the member page after i click on login

heres the login page code:
<?php
session_start();
include 'config.php';

if(isset($_POST['login']))
{

	$username = trim(addslashes($_POST['username']));
	$password = md5(trim($_POST['password']));
	
	$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
	
	$row = mysql_fetch_array($query);
	
	// now we check if they are activated
	
	if(mysql_num_rows($query) > 0)
	{
  
  if($row['Activated'] > 0)
  {
  
 	 $_SESSION['s_logged_n'] = 'true';
 	 $_SESSION['s_username'] = $username;
 	 $_SESSION['s_name'] = $row['Name'];
 	 
 	 header('Location: member.php');
 	 
  } else {
  
 	 echo '
 	 <html>
 	 <head>
 	 <title>Login</title>
 	 <link href="style.css" rel="stylesheet" type="text/css">
 	 
 	 </head>
 	 
 	 <body>
 	 <div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>
 	 <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>
 	 </body>
 	 </html>
 	 ';
 	 
  }
 	 
	} else {
	
  echo '
  <html>
  <head>
  <title>Login</title>
  <link href="style.css" rel="stylesheet" type="text/css">
  </head>
  
  <body>
  <div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>
    <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>

  </div>
  </body>
  </html>
  ';
  
	}

} else {

?>
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="wrapper">

<div id="head">the login page</div><br>
<div id="main"> 
  <p>You must login to view this page. Enter your username and password below and hit submit:</p>
  <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
  <p>Username:<br>
  <input name="username" type="text" class="textBox" id="username">
  
  <p>Password:<br>
    <input name="password" type="password" class="textBox" id="password">
</p>
  <p>
    <input name="login" type="submit" class="textBox" id="member" value="Submit">
  </p>
  </form>
  <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
  <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>
</div>

</div>

</body>
</html>
<? } mysql_close($l); ?>

I need some help please! :P

edit: line 27 is this:
header('Location: member.php');

Edited by venomsnake, 04 October 2005 - 06:08 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 04 October 2005 - 07:07 PM

Quote

output started at /home/cory/domains/gamingreloaded.com/public_html/zp/member system/config.php:1
The error is with config.php, not the file you posted. You output something at the start of yoru config file.

http://www.pixel2lif...showtopic=11768
Don't forget to search before you ask.

#3 venomsnake

    Jedi In Training

  • Members
  • PipPip
  • 481 posts
  • Gender:Male

Posted 04 October 2005 - 07:51 PM

ok i fixed it, thanks

and sry i didnt do a search





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users