Migrating Fast Secure Contact Form

Problem: Fast Secure Contact Form (FSCF) not working after migrating to new server.
A while back I was looking for a quick ‘n dirty contact form when I came across FSCF by Mike Challis. One can download FSCF as PHP script or WordPress plugin (I’ve used both), and I found the software easy to install, configure and use. However, when it came time to change servers, I ran into a little bit of trouble. After uploading the contact files to my new server, the form wouldn’t display. Now, I didn’t expect it to work right away, as I figured I would need to change the contact form path in the file that calls the script (email.html in my case):

$contact_form = 1;
$contact_form_path = '/OLD-PATH/contact-files/';
require $contact_form_path . 'contact-form-run.php';

However, even after changing to:

$contact_form = 1;
$contact_form_path = '/NEW-PATH/contact-files/';
require $contact_form_path . 'contact-form-run.php';

…things still wouldn’t work. A quick Google search led to advice such as restoring form defaults, but this didn’t work for some reason. After scratching my head for a minute, I decided to log in to the FSCF interface where, up near the top, there is a link that says “show PHP code,” which gives you the code you are to copy and paste in your own files. I clicked that link and I noticed that despite changing the contact form path in email.html, FSCF was still returning this:

$contact_form_path = '/OLD-PATH/contact-files/';

This led me to suspect that there was an internal setting created when I first initialized the software. I tried re-running the install script but that didn’t provide the desired results. Unfortunately, I didn’t notice any intuitive means of locating and/or changing this setting via the FSCF interface, so I went hunting around and quickly found a settings directory in the main contact-files directory. This settings directory contained the file fsc-site.php. I opened that file and found code like this:

//**AUTO-GENERATED DATA, DO NOT HAND EDIT!**
//Settings for 'Fast Secure Contact Form' PHP Script
$array = array (
  'site_name' => 'Chris Long Creative Services',
  'site_url' => 'http://MY-URL/contact-files',
  'site_path' => '/OLD-PATH/contact-files/',
  'admin_name' => '...',
  'admin_email' => '...',
  'admin_usr' => '...',
  'admin_pwd' => '...',
  'site_charset' => 'UTF-8',
  'language' => 'en_US',
  'timezone' => 'America/Adak',
  'pwd_reset_key' => '',
);

Now, I know it says in all-caps DO NOT HAND EDIT, but I needed this thing to work and didn’t want to spend an hour Googling around for solutions that may or may not work, so, I simply replaced

'site_path' => '/OLD-PATH/contact-files/',

…with,

'site_path' => '/NEW-PATH/contact-files/',

…after which I tested it, and lo and behold, it worked just fine. The solution seems a bit hacky, but I didn’t see any other way to do this without re-installing the software. If anybody knows of reconfiguring options I overlooked, please let me know in the comments. If not, perhaps future versions of FSCF will make this process easier and/or more intuitive. Either way, it’s a handy piece of software, many thanks to Mike Challis for his work!


Posted in PHP and tagged on by .

Leave a Reply

Your email address will not be published. Required fields are marked *