Page 1 of 1

Warning: session_start()

Posted: Mon Aug 14, 2006 4:21 pm
by mafiouso
Hello,
Trying to setup the script to suit my webpage.

Works well std, but once i start adding html i get probems not the best with php.

error is:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at


-

if ($settings['autosubmit']) {
session_start();

if (empty($_SESSION['checked'])) {
$_SESSION['checked']='N';
$_SESSION['secnum']=rand(10000,99999);
$_SESSION['checksum']=$_SESSION['secnum'].$settings['filter_sum'].date('dmy');
}
if ($_SESSION['checked'] == 'N')
{
print_secimg();
}
elseif ($_SESSION['checked'] == $settings['filter_sum'])
{
$_SESSION['checked'] = 'N';
$secnumber=pj_isNumber($_POST['secnumber']);
if(empty($secnumber))
{
print_secimg(1);
}
if (!check_secnum($secnumber,$_SESSION['checksum']))
{
print_secimg(2);
}
}
else
{
problem('Internal script error. Wrong session parameters!');
}
}





if i turn off in settings.php

/* Prevent automated submissions (recommended YES)? 1 = YES, 0 = NO */
$settings['autosubmit']=0;


it will work fine.

it works fine with teh error. but can it be fixed.

i am pasting the php into a table.


would like to have what is on the demo inthscript downlaod page

thanks

Posted: Fri Aug 18, 2006 2:14 am
by mafiouso
???

Posted: Sat Aug 19, 2006 8:52 am
by Klemen
Don't add ANY html code in the PHP files unless you know PHP well. Use header.txt/footer.txt to add HTML

Posted: Sat Aug 19, 2006 10:41 am
by mafiouso
thanks,

but i would really like to know how to imbed the php into a table of html


thanks

Posted: Sat Aug 19, 2006 2:23 pm
by Klemen
Then learn PHP :wink:

The problem is there mustn't be ANY html code before session headers are sent or any PHP script that uses them won't work. And unless you understand how PHP and LinkMan PHP code works you will have problems inserting HTML code in the script directly.

Please understand I'm not here to teach anyone PHP. Use the proivded header/footer files and you shouldn't get any errors.

Posted: Sat Aug 19, 2006 5:12 pm
by mafiouso
how about an example of php in html table?

to see how it is?

Posted: Sat Aug 19, 2006 5:23 pm
by Klemen

Code: Select all

<table>
<tr>
<td>
<?php 

// PHP CODE HERE

?>
</td>
</tr>
</table>
would be a simple example.

But it doesn't really matter, read my previous post about any HTML being before SESSION HEADERS, meaning no HTML output must be located inside the PHP file before PHP sends out all HTTP headers. And like said again and again, unless you know PHP and understand how that works you better stick with the header/footer