Jump to content
Killersites Forums

I am having trouble with the redirect page


Don Ross 76
 Share

Recommended Posts

Hello,

 

I placed I captcha on the website that I'm building. I just copy paste the codes from google and it is working on my local machine.

 

I placed this captcha on the html submit form. So after a user complete the form and able to solve the captcha the user is directed to a success page.

 

After the success page the user would be just staring the success message. I like the success page after showing up sometime be redirected to another webpage of my website like the home page. I can't figure this out. I tried to search google and I can't find it, I tried to search this forum but this forum is huge. I'm sorry I have so many questions and just keep posting here and bringing problems to be solved. I just like something what killersites.com is doing after you log in to this forum a success message will show up and in a few minutes will be redirected to another page.

 

Here is the code I got from google and I placed it on my site:

 

<?php

$redirect = "success.php";

require_once('recaptchalib.php');

$privatekey = "my_private_key_from_google";

$resp = recaptcha_check_answer ($privatekey,

$_SERVER["REMOTE_ADDR"],

$_POST["recaptcha_challenge_field"],

$_POST["recaptcha_response_field"]);

 

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 {

// Your code here to handle a successful verification

header("Location: " . $redirect);

}

?>

 

This code just work fine and it goes to the success.php. The success.php shows a success message then it just stay here unless the user click the back button of his/her browser he/she will be staying here. If the back button is click the html submit form with captcha will show up again and it is just where the user came from. It would be much better if the user is redirected to the home page and a message saying "you will be redirected to the home page."

 

Kind Regards,

 

Don Ross 76

Link to comment
Share on other sites

You can add a link back onto the success page back to home.

 

Example:

Thank you! Your message has been sent. Click here for the home page.

 

 

Of course you can get creative with the sussess page. Some will list a sitemap like menu while others will list other info about their products or such.

Link to comment
Share on other sites

$url = //Your URL HERE

$time_out = // Time in number ex 3

header("refresh: $time_out; url=$url");

 

ADD THIS TO YOUR SUCCESS PAGE. You might want to put a link to click anyway. Example: Thank you! Your message has been sent. You will be redirected to the home page. If you do not wish to wait <a href="link here">Click here</a> to go to the home page.

Link to comment
Share on other sites

$url = //Your URL HERE

$time_out = // Time in number ex 3

header("refresh: $time_out; url=$url");

 

ADD THIS TO YOUR SUCCESS PAGE. You might want to put a link to click anyway. Example: Thank you! Your message has been sent. You will be redirected to the home page. If you do not wish to wait <a href="link here">Click here</a> to go to the home page.

 

Thank you very much Benjaminmorgan

 

Kind Regards,

 

Don Ross 76

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...