Ask Experts Questions for FREE Help !
Ask
    Scotty13's Avatar
    Scotty13 Posts: 120, Reputation: 1
    Junior Member
     
    #1

    Jan 26, 2012, 03:46 PM
    Insert Image in a PHP Script. Here is my error...
    I don't usually don't have a problem. This is my script below, following my error message. I've tried everything. What I'm I missing?

    <img src="images/flightattendant.jpg" alt="Jeanne - Your flight attendant" width="378" height="851" align="right" />

    <?php
    Session_start();
    // Force script errors and warnings to show on page in case php.ini file is set to not display them
    Error_reporting(E_ALL);
    Ini_set('display_errors', '1');

    // Unset all of the session variables
    $_SESSION = array();
    // If it's desired to kill the session, also delete the session cookie
    If (isset($_COOKIE['idCookie'])) {
    setcookie("idCookie", '', time()-42000, '/');
    setcookie("locaCookie", '', time()-42000, '/');
    }
    // Destroy the session variables
    Session_destroy();

    // Check to see if their session is in fact destroyed
    If(!session_is_registered('firstname')){
    print "Bon Voyage... Every goodbye makes the next hello closer</font>.";

    exit();

    Header("location: index.php"); // << makes the script send them to any page we set
    } else {

    Print "<h2>Sorry - You're not able to depart at this time.</h2>";

    Exit();

    }

    ?>

    ERROR:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/root/logout.php:2) in /home/********/public_html/root/logout.php on line 3

    Bon Voyage... Every goodbye makes the next hello closer.
    bobobeer's Avatar
    bobobeer Posts: 13, Reputation: 1
    New Member
     
    #2

    May 30, 2012, 05:29 PM
    Move the image tag below the script. You cannot have any output/text or anything else before a session_start() call. This has to do with response headers and cookies. For details on why that is please review the PHP documentation on sessions PHP: Sessions - Manual

    For future reference the same goes for a call to the header() function for the same reason as above.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

IE script error in the script on this page res://ieframe.dll/preview.dlg [ 1 Answers ]

IE script error in the script on this page res://ieframe.dll/preview.dlg

Image Rotator Script [ 4 Answers ]

What javascript is used to rotate images from a directory on a webpage? This script constantly changes images without refreshing the page. Does anyone have a script similar to this desciption?


View more questions Search