Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

61 users online



Headers error afer error and dont know what to do

Headers error afer error and dont know what to do

Currently viewing this thread: 1 (0 members and 1 guests)


Page 2 out of 2
schoi

schoi

funny and cheeky
Status: Offline!

Ah yes I see your point now. Exman did the suggestion theFallen give u work? I already have had that problem in the past but I was able to restructure my code so it worked differently.

thefallen

thefallen

PHP Lurver.
Status: Offline!
PHP:

<?php

ob_start
();

session_start();
header ("Expires: Thu, 17 May 2001 10:17:17 GMT");
header ("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

if (!isset(
$_SESSION['SESSION'])) require ( "session_init.php");
    
if(isset(
$_SESSION['LOGGEDIN'])){
    if(
$_SESSION['LOGGEDIN'] != TRUE){
    @
header("Location: login.php");
        exit;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8" />
        <meta name="generator" content="Adobe GoLive" />
        <title>Admin Login</title>
        <link href="admin.css" rel="stylesheet" type="text/css" media="all" />
    </head>

<body bgcolor="#ffffff">
    <?
    
    
require_once 'functions.php';
    if (!isset(
$_SESSION['SESSION'])) require ( "session_init.php");
//    echo "<B>".$_SESSION['LOGGEDIN']."</b>";
    
if($_SESSION['LOGGEDIN'] == TRUE){
        @
header("Location: index.php");
        exit;
    }    
    if(
$_POST[user] && $_POST[pass]){
        
$user=$_POST[user];
        
$pass=$_POST[pass];
        
        
$sql "SELECT * FROM users WHERE USR_name = '$user' AND USR_passwd = PASSWORD('$pass') ";
        
$wynik query($sql);
        
        if(
mysql_num_rows($wynik)==1){
                
$_SESSION['LOGGEDIN'] = TRUE;
                
$_SESSION['USERNAME'] = $user;
                @
header("Location: index.php");
                exit;
        }
        else 
fail("Podano niew&#322;a&#347;ciwe dane!");
    }
    else 
fail("Prosz&#281; poda&#263; nazw&#281; u&#380;ytkownika i has&#322;o.");
    
    
?>
    <form method="POST" action="login.php" style="margin-top:50px">
                <table width="324" border="0" cellspacing="3" cellpadding="0" align="center">
                    <tr>
                        <td width="152">
    Nazwa u&#380;ytkownika:</td>
                        <td><input type="text" size="20" name="user" /></td>
                    </tr>
                    <tr>
                        <td width="152">
    Has&#322;o:</td>
                        <td><input type="password" name="pass" size="20" /></td>
                    </tr>
                </table>
                 <br>
                <br>
    <center><input type="submit" value="zaloguj"/></center>
    
    </body>

</html>
<?php ob_end_flush(); ?>

Last edited by thefallen, January 28th, 2006 09:04 PM (Edited 1 times)

exman

exman

Neverside Newbie
Status: Offline!

Hi there the suggestion is good i forgot to visit this topic because i've got an answer on a different forum. adn if you ptu os_start(); at the start of the script and ob_end_flush(); at the very end of the page it works fine.

numnutz

numnutz

whoopee now a retired old Fart
Status: Offline!

I don't know if this would be any help, but last week I was trying to install a script for someone and had the same error - cannot start session as headers aready sent. I knew that nothing had been sent as I already had tested the script on another server with correct results. I examined what was being sent to the broswer and found that the server was sending out two cookies before anything that my script was generating. I contacted the hosting service that told me this was common on shared servers and it was a scripting error - I did not find a way aroung this problem apart from using another hosting service.

nn Smile

Page 2 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.009 seconds.