other php script on page, session_start();
5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 18, 2010 (RSS)
By rez - February 17, 2010 - edited: February 17, 2010
<?php
session_start();
require_once('config.php');
?>
The config file is very simple, containing the e-mail addresses. All the other code for the contact form is in the body of the page.
The CMSB page works separately as well. Its when I try to put the form onto a working CMSB page that I have errors.
Where exactly do I put the above code? With or without its onw php tags? Everything I tried gave variable errors and others for the contact form.
Re: [rez] other php script on page, session_start();
By Djulia - February 17, 2010
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
<?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
If not, you can indicate the error message?
Djulia
Re: [Djulia] other php script on page, session_start();
By Chris - February 18, 2010
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.
Chris