[Pro] reCAPTCHA/php

Hi there

I have created a form with the help of PHP feedback form action. I have inserted the reCAPTCHA image by HTML Markup. However, when the page is published it generates the “process” page, which also needs to be edited in order to run the reCAPTCHA. I can easily edit the file with an editor. However, whenever the site is updated, that page gets overwritten and I loose the reCAPTCHA funtion. My question is this: is there no way I can edit the “function/process” PHP page generated by the action within Freeway? (I get headaches trying to remember all these things between the updates…)

Any help or suggestions would be greatly appreciated.

Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

There’s a couple of ways you can tackle this. If your process page is pure PHP, with no visible layout to display, then you can simply remove it from Freeway, edit it in a text editor, and use an Action like Upload Stuff to manage putting a copy of it in your site folder alongside your Freeway-generated pages. If you have minor tweaks that you perform to a Freeway-designed visible page, then you can use the Source Code Snooper Action to make those tweaks (through the code) in Freeway. The disadvantage to this approach is that once you “freeze” those changes in SCS, you can’t edit the page layout (visible layout) without clearing the SCS code, publishing, and re-editing the code in the SCS interface. There’s a third way that merges the two – make an include file with the external code changes in it, and use a Markup Item or Page / HTML Markup to insert it into the Freeway code where it’s needed.

Walter

On Oct 22, 2012, at 1:15 PM, Zignar wrote:

Hi there

I have created a form with the help of PHP feedback form action. I have inserted the reCAPTCHA image by HTML Markup. However, when the page is published it generates the “process” page, which also needs to be edited in order to run the reCAPTCHA. I can easily edit the file with an editor. However, whenever the site is updated, that page gets overwritten and I loose the reCAPTCHA funtion. My question is this: is there no way I can edit the “function/process” PHP page generated by the action within Freeway? (I get headaches trying to remember all these things between the updates…)

Any help or suggestions would be greatly appreciated.

Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Great, that is very helpful.
I use option one; the process page is generated automatically and I never see it in Freeway. After publishing, I edit and upload that file manually. However, next time I update the site, Freeway will generate a new process page, with a different name. Forcing me to start over again. Can I prevent Freeway from generating a new process page every time? Or, as you suggested, how to remove that process file “generation” from Freeway altogether? Never tried that before…

THANX!
Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Is the process file generated by the Action? I haven’t used any of those Actions before, so I am not familiar with how they work. What degree of changes are you making to the file in question?

Walter

On Oct 22, 2012, at 2:17 PM, Zignar wrote:

Great, that is very helpful.
I use option one; the process page is generated automatically and I never see it in Freeway. After publishing, I edit and upload that file manually. However, next time I update the site, Freeway will generate a new process page, with a different name. Forcing me to start over again. Can I prevent Freeway from generating a new process page every time? Or, as you suggested, how to remove that process file “generation” from Freeway altogether? Never tried that before…

THANX!
Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes, the process page is generated by the action all together (PHP feedback form 2.3.3). The changes are small, I add the following code at the top:

?php
require_once(‘recaptchalib.php’);
$privatekey = “private_key_here”;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
unset($_POST[“recaptcha_challenge_field”]);
unset($_POST[“recaptcha_response_field”]);
unset($_POST[“submit”]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die (“The reCAPTCHA wasn’t entered correctly. Go back and try it again.” .
"(reCAPTCHA said: " . $resp->error . “)”);
} else {

Sure would be nice to be to edit it and keep it in Freeway, or at least keep the Freeway action from overwriting it, and renaming it…

thanks again

Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Once the PHP Feedback Form Action has generated that code, you can then safely remove the Action from your page and duplicate the rest of what the Action does in Freeway directly.

  1. Move the generated “your-form-go.php” file out of the Site Folder. Edit it as needed to insert the ReCaptcha code.
  2. Remove the PHPFF Action from your form page, and in the Page / Form Setup dialog, set the Action attribute to “your-form-go.php” (use the actual filename, this is just for example) and the Method to POST.
  3. Apply the Upload Stuff Action to the form page, and in the “With HTML Files” section, use the first picker to choose the altered “your-form-go.php” file from wherever you saved it on your Mac.

Upload from within Freeway and you’re done.

The duplicate – renamed – files are there because the Action recognized that the version of the file in your site folder was not the same as the one that it generated the last time, and it would not overwrite an existing file that didn’t “belong” to it. (That’s what happens when you alter files in your Site Folder.) To clean all this up, simply delete the entire contents of your Site Folder and let Freeway generate a clean new copy of everything.

Walter

On Oct 22, 2012, at 2:26 PM, Zignar wrote:

Yes, the process page is generated by the action all together (PHP feedback form 2.3.3). The changes are small, I add the following code at the top:

?php
require_once(‘recaptchalib.php’);
$privatekey = “private_key_here”;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER[“REMOTE_ADDR”],
$_POST[“recaptcha_challenge_field”],
$_POST[“recaptcha_response_field”]);
unset($_POST[“recaptcha_challenge_field”]);
unset($_POST[“recaptcha_response_field”]);
unset($_POST[“submit”]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die (“The reCAPTCHA wasn’t entered correctly. Go back and try it again.” .
"(reCAPTCHA said: " . $resp->error . “)”);
} else {

Sure would be nice to be to edit it and keep it in Freeway, or at least keep the Freeway action from overwriting it, and renaming it…

thanks again

Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you so much! I am amazed over your knowledge.
You have my respect. I am so glad that it could be worked out with F.W .

Thank you again!!
Sverker


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options