Darksat IT Security Forums
March 27, 2017, 12:16:09 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Darksat IT Security Forum
From Firewall Support, AntiVirus Questions, Spyware problems, Linux and Windows Security, Black Hat SEO right down to Website Design and Multimedia
 
  Home Help Search Gallery Links Staff List Login Register  

Cannot modify header information - headers already sent by


Pages: [1]
  Print  
Author Topic: Cannot modify header information - headers already sent by  (Read 1733 times)
Defcon 5
Master
*****
Posts: 2410



View Profile WWW
« on: January 25, 2009, 08:33:40 am »

Why do I get this error?
Quote
Cannot modify header information - headers already sent by
I have like 4 header()'s but they are in if statements so why am I getting this error?
Report Spam   Logged

Social Buttons

Darksat
Administrator
Master
*******
Posts: 3303



View Profile WWW
« Reply #1 on: January 25, 2009, 07:41:59 pm »

Might help i I could see your code.
Report Spam   Logged
Defcon 5
Master
*****
Posts: 2410



View Profile WWW
« Reply #2 on: January 27, 2009, 03:16:23 pm »

Is their no real common reason for that to show up then?

Wish I could remember where I was with that problem.

So I will start at the start.

logcheck.php (used in every admin page)
Code:
require_once('vars.php');
require_once('includes/function.php');

if(!empty($_SESSION['smile-email'])){

$query = "SELECT * FROM users WHERE email='".$_SESSION['smile-email']."'";
$fetch = DB::fetch($query);
if($_SESSION['smile-password'] == $fetch[password]){
echo "You're Logged in as ";
echo $fetch['firstname'];
echo " ";
echo $fetch['surname'];
}else{
header('Location: login.php');}
}else{
echo 'Login check failed';
echo '<meta http-equiv="refresh" content="0;url=login.php" />';
exit();
}

login.php
Code:
include('../vars.php');
require_once('includes/function.php');

echo "<html><head><title>";
echo $title;
echo "</title><link type=\"text/css\" rel=\"stylesheet\" media=\"all\" href=\"admin.css\" />";
echo "</head><body>";
echo "<table><tr><td>";

$form = '<div id="login-box">';
$form .= '<form action="'.$domain.'admin/login.php" method="post">';
$form .= '<table id="login-table"><tr><td class="col1">';
$form .= 'Email:</td><td class="col2"><input type="text" name="email" id="login-username"/></td></tr>';
$form .= '<tr><td class="col1">Password:</td><td class="col2"><input type="password" name="password" id="login-password"/></td></tr>';
$form .= '<tr><td></td><td align="right"><input type="submit" value="Login" /></td></tr>';
$form .= '</table>';
$form .= '</form></div>';

if(!empty($_POST['email'])){

$query = "SELECT * FROM users WHERE email='$_POST[email]'";
$fetch = DB::fetch($query);

if($_POST['password'] == $fetch['password']){
$query = "UPDATE users SET SessionID='sessionid()'";
$_SESSION['email'] = $_POST['email'];
$_SESSION['password'] = $_POST['password'];
echo 'setting cookies';
echo $_SESSION['email'];
echo $_SESSION['password'];
//echo '<meta http-equiv="refresh" content="0;url=index.php" />';
}else{
echo "Your login details are incorrect";
echo $form;
die();
}
}else{
echo $form;
}

My email is a and password is b... to make it simple right.
But when ever i enter it I get "Your login details are incorrect", I can't see anything wrong with my code?

So I guess I've fucked up my database functions somewhere?

I've got so many files its just getting ridiculous my messy coding doesn't really help fixing problems either.
« Last Edit: January 27, 2009, 03:19:17 pm by Defcon 5 » Report Spam   Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
eXTReMe Tracker
Security Forum
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Buy traffic for your forum/website
traffic-masters
Powered by SMF | SMF © 2016, Simple Machines
Page created in 0.062 seconds with 10 queries.