[mapserver-users] how to disappear Warning: session_start() in the page?

elisabeth theresia dbee_kawai at yahoo.com
Fri Aug 13 22:47:05 EDT 2010


Thanks Mr.Sumariva for the advice but, session_start() in the page already embed 
in Chameleon framework at its folder in \htdocs\common\session

the coding at line 509 (that shown error in the page):

//start the session
    session_start();
    register_shutdown_function( "session_write_close" );

  
    // set IP if a new session
    if ( $bNewSession ) $_SESSION["gszRemoteAdd"] = $_SERVER["REMOTE_ADDR"];

/* ============================================================================
 * Check IP to see if it is the same
 * ========================================================================= */

    // check if the IP has been set and validate
    if ( isset( $_SESSION["gszRemoteAdd"] ) &&
                                   strlen(trim($_SESSION["gszRemoteAdd"])) > 0 )
    {
        // check if IP matches current client
        if ( trim( $_SESSION["gszRemoteAdd"] ) !=
                                               trim( $_SERVER["REMOTE_ADDR"] ) )
        {
            // possible security breach void session
            /* if the session address is the loopback interface then it is
             * likely that the application was configured to use an external
             * address but someone is trying to test locally using localhost
             */
            if ($_SESSION['gszRemoteAdd'] != '127.0.0.1')
            {
                $bSessionOK = false;
            }
        }
    }
    else
    {
        // possible security breach void session
        $bSessionOK = false;
    }
    
    // return success or failure and set global so we
    // know session has been inited.
    if ($bSessionOK)
    {
        $GLOBALS['session_started'] = true;
    }
    
        
    return $bSessionOK;

// end intializeSession() function
}

function getSessionSavePath()
{
    $szReturn  = ini_get("session.save_path")."/sess_".session_id()."/";
    $szReturn = str_replace( "\\", "/", $szReturn );
    return $szReturn;
}


Really need advice again Mr. 
Thanks


________________________________
From: Cristiano Sumariva <sumariva at gmail.com>
To: elisabeth theresia <dbee_kawai at yahoo.com>
Sent: Sat, August 14, 2010 8:57:29 AM
Subject: Re: [mapserver-users] how to disappear Warning: session_start() in the 
page?

You should break your file in 2 files.
Put the session_start function at first and add it to the top of your .phtml 
file.

The second file will contain all remaining code.

When using session in pages they have to be sent before any other thing.
This is a requirement in HTTP protocol.


2010/8/13 elisabeth theresia <dbee_kawai at yahoo.com>

Hi all, i got message (for preview- i attached the page in 
attachment-sessionerror2.jpg) :  

>
>Warning:  session_start() [function.session-start]:  Cannot send session cache 
>limiter - headers already sent (output  started at 
>I:\ms4w\apps\appweb\htdocs\index_spatialphtml.phtml:6) in 
>I:\ms4w\apps\appweb\htdocs\common\session\session.php509 on line 
>
>
>i have mapfile and template that already could show in the initialize page named 
>index_cobacham.phtml
>
>Then my html + php = index_spatialphtml.phtml
>i put <?php include ("index_cobacham.phtml")?> above the syntax html.
>
>So, what should i do?
>
>Thanks :)
>
>
>here the index_spatialphtml.phtml
>
>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
><head>
><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
><title>index</title>
><style type="text/css">
><!--
>body {
>    font: 100% Verdana, Arial, Helvetica,  sans-serif;
>     background: #666666;
>    margin: 0; /* it's good practice to zero the margin and padding of the body 
>element to account for differing browser defaults */
>    padding: 0;
>    text-align: center; /* this centers the container in IE 5* browsers. The 
>text is then set to the left aligned default in the #container selector */
>    color: #000000;
>    background-image: url(./images/Background.gif);
>}
>.oneColElsCtr #container {
>    width: 46em;
>    background: #FFFFFF;
>    margin: 0 auto; /* the auto margins (in conjunction with a width) center the 
>page */
>    border: 1px solid #000000;
>    text-align: left; /* this overrides the text-align: center on the body 
>element. */
>}
>.oneColElsCtr #mainContent {
>    padding: 0 20px; /* remember that padding is the  space inside the div box 
>and margin is the space outside the div box */
>}
>.style1 {color: #FFFFFF}
>a:link {
>    color: #96711D;
>    text-decoration: none;
>}
>a:visited {
>    color: #A99559;
>    text-decoration: none;
>}
>a:hover {
>    color: #990000;
>    text-decoration: underline;
>}
>a:active {
>    color: #000000;
>    text-decoration: none;
>}
>.style2 {color: #000000}
>-->
></style></head>
>
><body class="oneColElsCtr">
>
><div id="container">
>  <div id="mainContent">
>    <table width="713" border="1">
>      <tr background="./images/Background.gif">
>        <th width="709" scope="col" align="center"><p class="style1">PETA  
>SPASIAL PENYEBARAN PENYAKIT DBD</p>
>        <p class="style1"> KOTA SURAKARTA</p></th>
>      </tr>
>    </table>
>    <table width="717" border="1" cellpadding="0" cellspacing="0">
>      <tr>
>        <th width="138" scope="col"><div align="center"><a 
>href="index.html">Beranda</a></div></th>
>        <th width="171" scope="col"><div align="center"><a href="peta.html">Peta 
>Surakarta</a></div></th>
>        <th width="127" scope="col"><div align="center"><a 
>href="berita.html">Berita</a></div></th>
>        <th width="147"  scope="col"><div align="center"><a 
>href="tentang.html">Buku Tamu</a></div></th>
>        <th width="122" scope="col"><div align="center"><a href="tentang.html" 
>target="_blank" class="style2">Tentang</a></div></th>
>      </tr>
>    </table>
>
><?php 
>   include ("./index_cobacham.phtml"); ?>
>
>
></body>
></html>
>
>
>
>
>
>_______________________________________________
>mapserver-users mailing list
>mapserver-users at lists.osgeo.org
>http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100813/b53d6e37/attachment-0001.html


More information about the mapserver-users mailing list