refresh my memory - Post ID 299003

User 376096 Photo


Registered User
32 posts

I have two files that have been in the root directory of my website.

One is gdform.php

<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>

the other is webformmailer.php

<?php

if ( !isset($_SERVER['SPI'])) {
die();
}

if (!isset($_SERVER['DOCUMENT_ROOT'])) {
echo("CRITICAL: we seem to be running outside of the norm.\n");
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
die("CRITICAL: Document root unavailable.\n");
}

$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET") {
$query_vars = $_GET;
}
elseif ($request_method == "POST") {
$query_vars = $_POST;
}

reset($query_vars);
function customsort($a,$b) {
// $a is array for form vars, $b is comma seperated case sensitive field order
// this is case sensitive -- good idea to hrc that.
$data = array();
if ( strstr($b,',') == FALSE ) {
$b = $b.",";
}
$ordering = split(',',$b);
foreach ($ordering as $orderitem) {
if ( ($orderitem != null) && ($orderitem != "") ) {
if (isset($a[$orderitem])) {
$data[$orderitem] = $a[$orderitem];
}
}
}
foreach ($a as $key=>$val) {
$data[$key] = $a[$key];
}
return $data;
}

function xmlentities($string) {
return str_replace ( array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $string);
}

$t = date("U");

$formhomedir = preg_replace('/.*\/home\/content/','',$_SERVER['DOCUMENT_ROOT']);
$formhomedir = explode('/',$formhomedir);
if (count($formhomedir) <= 4) {
$formhome="/home/content/".$formhomedir[1]."/".$formhomedir[2]."/data/";
}
else {
$formhome="/home/content/".$formhomedir[1]."/".$formhomedir[2]."/".$formhomedir[3]."/".$formhomedir[4]."/data/";
}

$file_order = ".default";
$file_format = ".text";
$file_interval = ".15m";
$field_order = "";

if (isset($query_vars['form_order'])) {
if ($query_vars['form_order'] != "alpha") {
$field_order=$query_vars['form_order'];
$file_order=".custom";
$query_vars = customsort($query_vars,$field_order);
}
else {
switch ($query_vars['form_order']) {
case "alpha":
uksort($query_vars,'strnatcasecmp');
$file_order=".alpha";
break;
default:
$file_order=".default";
break;
}
}
}

if (isset($query_vars['form_format'])) {
switch ($query_vars['form_format']) {
case "csv":
$file_format = ".csv";
break;
case "html":
$file_format = ".html";
break;
case "xml":
$file_format = ".xml";
break;
case "text":
case "default":
default:
$file_format = ".text";
break;
}
}

if (isset($query_vars['form_delivery'])) {
switch ($query_vars['form_delivery']) {
case "hourly":
$file_interval = ".60m";
break;
case "hourly_digest":
$file_interval = ".60mc";
break;
case "daily":
$file_interval = ".24h";
break;
case "daily_digest":
$file_interval = ".24hc";
break;
case "digest":
$file_interval = ".15mc";
break;
case "default":
default:
$file_interval = ".15m";
break;
}
}

$file = $formhome."form_".$t.$file_order.$file_format.$file_interval;
$fp = fopen($file,"w");

reset($query_vars);
switch ($file_format) {
case ".csv":
$csvkeys = "";
$csvvals= "";
$firsttime = "";
while (list ($key, $val) = each ($query_vars)) {
if ( ($key == "form_order") ||
($key == "form_format") ||
($key == "form_delivery") ||
($key == "redirect") ) {
}
else {
if ($csvkeys != "") {
$firsttime=",";
}
$tmpkey=escapeshellcmd($key);
$csvkeys = $csvkeys.$firsttime."'".$tmpkey."'";
$tmpval=escapeshellcmd($val);
$csvvals = $csvvals.$firsttime."'".$tmpval."'";
}
}
fputs($fp,"$csvkeys\n");
fputs($fp,"$csvvals\n");
break;
case ".html":
fputs($fp,"<table border=\"1\" cellspacing=\"1\" cellpadding=\"2\">\n");
break;
case ".xml":
fputs($fp,"<form>\n");
break;
}

reset($query_vars);
while (list ($key, $val) = each ($query_vars)) {
if ($key == "redirect") {
$landing_page = $val;
}
if ( ($key == "form_order") ||
($key == "form_format") ||
($key == "form_delivery") ||
($key == "redirect") ) {

}
else {
switch ($file_format) {
case ".html":
fputs($fp,"\t<tr>\n");
fputs($fp,"\t\t<td><b>$key</b></td>\n");
fputs($fp,"\t\t<td>$val</td>\n");
fputs($fp,"\t</tr>\n");

break;
case ".csv":
// content is already output
break;
case ".xml":
fputs($fp,"\t<field>\n");
fputs($fp,"\t\t<fieldname>".xmlentities($key)."</fieldname>\n");
fputs($fp,"\t\t<fieldvalue>".xmlentities($val)."</fieldvalue>\n");
fputs($fp,"\t</field>\n");
break;
case ".text":
default:
fputs($fp,$key.": ".$val."\n");
break;
}
}
}

switch ($file_format) {
case ".html":
fputs($fp,"</table>\n");
break;
case ".xml":
fputs($fp,"</form>\n");
break;
}


fclose($fp);

if ($landing_page != "") {
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
}
else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>
I am using GoDaddy, who has now switched from their own workspace email to using Outlook Office 365. My forms now are working sporadically. sometimes it takes an hour to get the results from the form in my email other times it never arrives at all. Nothing in Junk folder.

http://www.empirestatedarts.com/Registr … ation.html
If you try that form you should get an email to the Captains email address only

Are those files necessary? I don't know if these files are remnants of something else that was once on the site or if they are necessary to run the coffeecup form.

Thanks

Jeff

User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Hi Jeffery,
Those aren't Webform builder files. Keep a copy of them and delete or change their name on the host and test.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 376096 Photo


Registered User
32 posts

OK, so that solves one issue... now onto the next.

GoDaddy has changed their email service from Workspace email (theirs) to Microsoft 365 Outlook. After spending some time on the phone with them, they are telling me that the email is not making it to the relay server and they have no idea why.

Their only suggestion was to completely rebuild the form and upload it and see if some glitch in the code may be corrected.

The issue is I wasnt getting the conformations from the form. The first attempted fix changed the email routing setting in cpanel. these were the options...

Configure Email Routing
Automatically Detect Configuration (recommended)
Local Mail Exchanger (what it was set at)
Backup Mail Exchanger
Remote Mail Exchanger (what they changed it to)

after the change, it was taking approximately an hour for form submissions to make it to my inbox. I tested it that night... took an hour. tested it the next morning... took an hour again. I figured an hour is fine, I will announce registration to be open.

I get an email from Paypal saying a payment was received, but there was no form results. so now we are back to not getting emails again with the contents of the form submission.

I was running apache 5.6 and i tried 7.3. no joy using either.
User 187934 Photo


Senior Advisor
20,181 posts
Online Now

Have you tried this?
https://www.coffeecup.com/help/articles … m-builder/
I see another user used these settings Dec 2021.
JB Williams wrote:
Well, I know I tried this combo, but I did as you said and used the original cfg
<?php
$user_config['mailer']['service'] = 'localhost';
$user_config['mailer']['smtp']['auth'] = true;
$user_config['mailer']['smtp']['user'] = 'email@cregeens.com';
$user_config['mailer']['smtp']['password'] = 'mypassword';
$user_config['mailer']['smtp']['host'] = 'mail.cregeens.com';
$user_config['mailer']['smtp']['port'] = '25';
$user_config['mailer']['smtp']['secure'] = '';
?>
And it worked!! Kinda. My gotest simple form works now, but all of my other forms go to a variable email, where php combines selection of location (Argenta or Jonesboro) with that email (eg Jonesboro@cregeens.com). I have some other things not working which all comes down to variables not passing between php and I think it has something to do with .htaccess file
thanks
JB

Here's some info on GoDaddy
https://www.godaddy.com/help/send-form- … server-953
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 376096 Photo


Registered User
32 posts

Thank you for that Eric. once I finish rebuilding the form to eliminate that as a possible problem, I will definitely bring this up to them as another possible fix

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.