vinson89 Posted May 20, 2014 Share Posted May 20, 2014 I cannot redirect to other page even I enter correct information and recaptcha in activation form. Anyone who can check what going wrong in my activation script? Here is my php activation check script: <?php require_once('recaptchalib.php'); $privatekey = "6LfTwvMSAAAAABt03yGb0_12rgLNrCDuoibU4gbh"; $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 { $username = $_POST['username']; $activation_code = $_POST['activation_code']; $db_host = "server"; $db_name = "table"; $db_use = "use"; $db_pass = "pass"; $link = mysqli_connect($db_host, $db_use, $db_pass); mysqli_select_db($link, $db_name); $command = "UPDATE email_activation SET check_activation='$activation_code' WHERE username='$username' and activation='$activation_code'"; $result = mysqli_query($command); if ($result) { $query = "SELECT * FROM email_activation where username LIKE '%$username%' LIMIT 0 , 1 "; $result = mysqli_query($query) OR die(mysqli_error()); while($row = mysqli_fetch_array($result)) { $username = $row['username']; $password = $row['password']; $email = $row['email']; $postcode = $row['postcode']; $query = "INSERT INTO member (username, password, email, postcode) VALUES ('$username','$password','$email','$postcode')"; $result = mysqli_query($link, $query) OR die(mysqli_error()); if ($result) { $_SESSION['user_logged'] = '1'; header("location:index.html"); echo "Congratulations. Your membership has been activated redirecting..."; }else{ header("location:index.html"); echo ("Congratulations. Your membership has been activated but it's can't saved in database."); } } }else{ header("location:activation-form.php"); echo ("You've entered an invalid username / activation code – please retry"); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/288635-cannot-redirect-to-other-after-enter-correct-recaptcha/ Share on other sites More sharing options...
ginerjm Posted May 20, 2014 Share Posted May 20, 2014 What evidence do you have for us that things are not happening? ps - I have seen some posts somewhere that suggest that your header is malformed. Try: header("Location: with a space after the colon and then the address you want. Quote Link to comment https://forums.phpfreaks.com/topic/288635-cannot-redirect-to-other-after-enter-correct-recaptcha/#findComment-1480209 Share on other sites More sharing options...
vinson89 Posted May 20, 2014 Author Share Posted May 20, 2014 please check through this url: http://stuweb.cms.gre.ac.uk/~tz005/test2/activation-form.php and use the following information to try: username:tz005 activation code: 87839 Quote Link to comment https://forums.phpfreaks.com/topic/288635-cannot-redirect-to-other-after-enter-correct-recaptcha/#findComment-1480210 Share on other sites More sharing options...
ginerjm Posted May 20, 2014 Share Posted May 20, 2014 no thx Quote Link to comment https://forums.phpfreaks.com/topic/288635-cannot-redirect-to-other-after-enter-correct-recaptcha/#findComment-1480211 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.