Form Tools
Cannot send session cookie - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: Cannot send session cookie (/showthread.php?tid=113)



Cannot send session cookie - scaphis - Apr 9th, 2009

I have just started using the API in the tutorials, because my client will need a multi-page form where users can edit info any way they like and even have a secure login.

I have created a very simple php page with a form that has one text field and a submit button with the name submit.

Upon going to the page - I get error messages:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 382

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 382

Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 383

Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 384




Here is my PHP file (very small for testing):

<?php
require_once("formtools/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "submit",
"next_page" => "thank_you.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?>


<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

<label>Middle Name?</label>
<input name="PMidName" type="text" size="45" id="PMidName" />

<input type="submit" name="submit" value="Submit" />
<br />
</p>
</form>



I have been at this for hours, trying everything I can, but nothing seems to change the error or make it go away. Can someone please assist?


RE: Cannot send session cookie - Ben - Apr 9th, 2009

Hi Scaphis,

Sorry you're having trouble!

Is there anything else in your PHP file? The reason I ask is that I don't see the opening and closing <html> tags, nor <body> or <head>.

The two most likely causes of this problem are:
1. that the block of PHP you're included appears BENEATH the opening <html> tags. It should always appear at the very top of the page, before anything else.
2. There's some additional PHP code that appears at the top of the page.

Any help?

- Ben


RE: Cannot send session cookie - scaphis - Apr 10th, 2009

(Apr 9th, 2009, 6:43 PM)Ben Wrote: Hi Scaphis,

Sorry you're having trouble!

Is there anything else in your PHP file? The reason I ask is that I don't see the opening and closing <html> tags, nor <body> or <head>.

The two most likely causes of this problem are:
1. that the block of PHP you're included appears BENEATH the opening <html> tags. It should always appear at the very top of the page, before anything else.
2. There's some additional PHP code that appears at the top of the page.

Any help?

- Ben
Ben, Thank you for your timely response.

I had it the way you specified but it made no difference. I was getting that error message every time I uploaded a php file with the api. I think it had something to do with the server I was on (godaddy) and the way it stores sessions. Anyways I tried a different server and it works now.

Now if I could only figure out how to use submission accounts module.


RE: Cannot send session cookie - Ben - Apr 10th, 2009

Heya,

I'm not terribly surprised. Godaddy are great for domain registration, but their hosting is TERRIBLE! I've heard nothing but complaints from people about it.

Let me know if you have any questions about the Submission Accounts module.

- Ben


RE: Cannot send session cookie - scaphis - Apr 10th, 2009

(Apr 10th, 2009, 12:25 PM)Ben Wrote: Heya,

I'm not terribly surprised. Godaddy are great for domain registration, but their hosting is TERRIBLE! I've heard nothing but complaints from people about it.

Let me know if you have any questions about the Submission Accounts module.

- Ben

You are so right - funny thing is every client I have requests me to build a site on their go daddy hosting, and every time I have some kind of issue.

here is an article I found about security problems with godaddy sessions. I think it is the very reason why formtools api does not work on their hosting. Because their mysql database is on a seperate server, it stores sessions in tmp directory. Permissions need to be allowed for users and thus making it vulnerable. Correct me if I am wrong.

http://stackoverflow.com/questions/487889/how-easy-is-it-to-hijack-session-vars-on-godaddy-php


RE: Cannot send session cookie - Ben - Apr 10th, 2009

Ah... interesting.

In that case, I'd use database sessions instead. Form Tools comes with the option of storing all session data in the database rather than in files using the default PHP sessions. To do this, just log out then add this line to your config.php file:

PHP Code:
$g_session_type "database"

Once you log back in, all sessions are stored in a separate table in the database. This *should* solve the problem... knock on wood.

Just thought I'd mention it in case other folk encounter a similar problem!

- Ben


RE: Cannot send session cookie - wuzokawit - Dec 31st, 2020

I want to send some cookies here and for this purpose, I am looking for some articles that will help me. I am also taking dissertation writing help because I know this will be helping key for me to achieve my goal and to write a research paper.


RE: Cannot send session cookie - Darcy Newbery - Feb 12th, 2021

All the theme is argued for the funded teamwork for the fashion designers. The value for the use of the hair extensions for all reflective usages. The path is filed for the rank in the mid of the offered dynamics for the wigs.