Darksat IT Security Forums
April 18, 2024, 09:05:49 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 2012 times)
Defcon 5
Master
*****
Posts: 2410



View Profile WWW
« 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


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy
Page created in 0.045 seconds with 16 queries.