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

elisabeth theresia dbee_kawai at yahoo.com
Wed Aug 18 15:48:58 EDT 2010


Hello Mr. Sumariva, i already did wht u said, but there's new error: error:  
Call to undefined function:  on_get_contens() in 
I:\ms4w\apps\appweb\htdocs\index_cobacham.phtml on line 2

here i put the cobachanphtml.phtml: 
<?php
$html=on_get_contens();
ob_end_clean();

include("./chameleon.php");
    $szTemplate="./template_werror.html";
    $szMapFile="../map/kelur_cobacham.map";
    class SampleApp extends Chameleon //SampleApp merupakan turunan dari 
Chameleon
    {
        function SampleApp() //Nama fungsi
        {
            parent::Chameleon(); //Menjalankan konstruktor class Chameleon
            $this->moMapSession=new MapSession_RW; //Mbwt instance obj map 
session
            $this->moMapSession->setTempDir 
        (getSessionSavePath()); //Mendefinisikan dir temporer yg akn digunk olh 
                                                                    obj map 
session
        }
    }
    
    $oApp= new SampleApp(); //Membut instance obj SampleApp
    $oApp->registerSkin('skins/sample'); //mendefinisikan skin utk obj SampleApp
    $oApp->CWCInitialize($szTemplate, $szMapFile); //MEnginisialisasi obj Lat01 
dg                                                     file template dan file 
.map
    $oApp->CWCExecute(); //Menjalankan app dg memangil fs CWCExecute

?>

So, what should i do?
 Thanks a lot for the attention, sorry reply not direct.




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

Well, you can turn the things by other way.
Put at top of HTML file in the ob_start() function to tell PHP to buffer all 
output.
Change your your index_cobachan by adding
$html = ob_get_contens();
ob_end_clean();

Now all the content that would be sent to browser is available at $html string 
variable.
After the includes in your index_cobachan print the contents of $html var.
Now do your application logic.
THen append the rest of HTML file.


Another option is to turn your HTML file into a template and add a special mark 
to signal template engine to replace some content but this would be another 
aproach.


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

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
>>
>>
>
>
>_______________________________________________
>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/20100818/4e4f33a4/attachment-0001.html


More information about the mapserver-users mailing list