SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    India
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Header information breaks and spills out code in the browser

    Hi all,
    I have got a weird bug which I am not sure how I can solve. This is the code that I have got.


    PHP Code:
    header("Connection: close");
    header("Content-type: text/html");
    session_start();
    $string='a:38:{s:11:"gdgd_region";s:5:"Indisdsda";s:19:"esdsdsmsdm_sddevicesPerPage";i:10;s:13:"sdsdesdsmm_userTsdype";s:11:"sdop";s:17:"sd_serialNumber";s:0:"";s:14:"SDAddress";s:0:"";s:13:"sDasdds_userName";s:0:"";s:15:"SDSD_showChange";s:3:"all";s:19:"ssdummary_alarmWindow";s:2:"d1";s:20:"summarysd_statusWindow";s:2:"d7";s:23:"sd_devdet_logsPerPage";i:10;s:19:"devdet_time_eq_hour";s:2:"12";s:18:"devdet_time_eq_min";s:2:"50";s:19:"devdet_time_eq_ampm";s:2:"AM";s:18:"devdet_time_eq_mon";s:1:"5";s:18:"devdet_time_eq_day";s:2:"13";s:19:"devdet_time_eq_year";s:4:"2005";s:19:"devdet_time_lo_hour";s:2:"12";s:18:"devdet_time_lo_min";s:2:"50";s:19:"devdet_time_lo_ampm";s:2:"AM";s:18:"devdet_time_lo_mon";s:1:"5";s:18:"devdet_time_lo_day";s:2:"13";s:19:"devdet_time_lo_year";s:4:"2005";s:19:"devdet_time_hi_hour";s:2:"12";s:18:"devdet_time_hi_min";s:2:"50";s:19:"devdet_time_hi_ampm";s:2:"AM";s:18:"devdet_time_hi_mon";s:1:"5";s:18:"devdet_time_hi_day";s:2:"13";s:19:"devdet_time_hi_year";s:4:"2005";s:15:"devdet_severity";s:0:"";s:19:"devdet_severity_low";s:0:"";s:20:"devdet_severity_high";s:0:"";s:20:"devdet_severity_mode";s:5:"range";s:15:"devdet_event_id";s:0:"";s:19:"devdet_event_id_low";s:0:"";s:20:"devdet_event_id_high";s:0:"";s:20:"devdet_event_id_mode";s:5:"range";s:18:"devdet_log_message";s:0:"";s:23:"devdet_log_message_mode";s:8:"contains";}';
    setcookie("ds",$string,time() + 60 60 24 30,"/");
    echo 
    "hi"

    This code just sets a cookie and does other processing. I have not included all the other code. I tested this on a win200 pro , IIS configuration which has isapi_cgi.dll as the executable instead of php.exe.

    If I use, php.exe this works fine. But with isapi_cgi.dll , The header and cookie information get spilled to the browser as the cookie data gets bigger. I am not sure whether this is because of the data length or the data in itself. Can anyone throw some light on this?

    Thanks,
    Celia

  2. #2
    SitePoint Enthusiast mkeefe's Avatar
    Join Date
    Sep 2004
    Location
    Boston
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It could be that you are sending header info, then starting a session.

  3. #3
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep ... you mustn't send out headers before session start if you must retain the code flow this way use output buffering
    add ob_start() before this code and ob_end_flush() after this code

  4. #4
    SitePoint Enthusiast mkeefe's Avatar
    Join Date
    Sep 2004
    Location
    Boston
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you "bigduke" for providing a better explanation.

    -matt


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •