other php script on page, session_start();

5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 18, 2010   (RSS)

Re: [rez] other php script on page, session_start();

By Djulia - February 17, 2010

Hi rez,

You can test by removing this line ?

session_start();

If not, you can test this :

<?php
require_once "./lib/viewer_functions.php";
session_write_close ();

session_name ("form");
session_start ();
require_once('config.php');
?>


It is the solution which I use with a captcha and WebsiteMembership Plugin activated.

Djulia

Re: [Djulia] other php script on page, session_start();

By rez - February 17, 2010

There is captcha on the page. Niether solution worked for me, if I'm using it right. I tried the script above and below the CMSB code and also tried:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
require_once "/example/public_html/cmsAdmin/lib/viewer_functions.php";


list($social_media_linksRecords, $social_media_linksMetaData) = getRecords(array(
'tableName' => 'social_media_links',
));
session_write_close ();

session_name ("security_code");
session_start ();
require_once('config.php');

?>


But no luck.


here is the beginning of the script on the page:
<?
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
unset($_SESSION['security_code']);
} else {
$error_array[] .= "The security code you have entered is incorrect.";
}

Re: [rez] other php script on page, session_start();

By Djulia - February 18, 2010

You tested without using the captcha?

If not, you can indicate the error message?

Djulia

Re: [Djulia] other php script on page, session_start();

By Chris - February 18, 2010

Hi rez,

What error messages are you getting? Can you post the full PHP source code of both your contact form and config.php?

On a hunch, this line looks wrong to me:

$error_array[] .= "The security code you have entered is incorrect.";

"[] =" means add new array element, while ".=" means append this string to an existing variable. I don't think it makes sense to append a string to an array element that doesn't exist yet.
All the best,
Chris