Jump to content

ben_1uk

Members
  • Posts

    79
  • Joined

  • Last visited

Everything posted by ben_1uk

  1. Hi everyone, I'm hoping somebody can help me out. I am attempting to make a small change to an existing .SWF file on my website. The file currently acts like a sort of image map, whereby if the user clicks on a certain part of the image, the relevant information will then display using flash animation. To edit the file, I have first decompiled it using Sothink SWF Decompiler and exported the .swf file to .fla to make the changes. I have then opened the .fla file using Flash Builder (4.7) Premium (trial version), made the change, and exported the file to a .swf again. However, after performing the above steps, the flash animation loops continuously with all clickable regions of the image seemingly disabled? Can anyone help? Thank you, Ben_1uk
  2. Hi scootstah, I've had another tinker about with the code and I've managed to get the mails to come through! It all appears to work now :-) Thank you very much for all your help.
  3. Having added var_dump($success); I received bool(true).
  4. I'm really sorry for all the 'bad code', but the lack of documentation from Google when upgrading from reCAPTCHA v1 to v2 is not helping! Plus, every example I look at on the Internet is different so I'm just getting more and more confused by it all!
  5. I've had another look at the code and have come up with the below. However, it still doesn't post to my email address. //collect user data from form and post $firstname = $_POST['firstname']; $surname = $_POST['surname']; $emailaddress = $_POST['emailaddress']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; //format look of email $body = "First Name: $firstname \n Surname: $surname \n E-mail: $emailaddress \n Telephone Number: $telephone \n Message: $enquiry"; // if CAPTCHA is entered incorrectly if(validCaptchaV2() === FALSE) { header('Location: captcha_unsuccessful.html'); exit; } else { // If CAPTCHA is valid send email $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_address'; $mailheaders .= "From: $emailaddress\r\n"; $headers .= "Content-type: text/html charset=iso-88590-lrn"; // send email $success = mail($webMaster, $emailSubject, $body, $headers); }
  6. The code is the same as when I had reCAPTCHA v1 working. I have checked the current 'live' mailer.php file and it does not include a mail() call yet still works? Here is the part of the code that should send the mail: $firstname = $_POST['firstname']; $surname = $_POST['surname']; $emailaddress = $_POST['emailaddress']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; $body = "First Name: $firstname \n Surname: $surname \n Telephone Number: $telephone \n Message: $enquiry"; // if CAPTCHA is entered incorrectly if(validCaptchaV2() === FALSE) { header('Location: captcha_unsuccessful.html'); exit; } else { // If CAPTCHA is valid $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_address'; } Where would I need to add the mail() function? The examples I have looked at on-line are structured differently to mine.
  7. I think my punctuation is a little off somewhere - too many ) : and } for me! I have tried moving the exit; } part of the code to include the rest of the script but I am now receiving the following error message: Parse error: syntax error, unexpected 'else' (T_ELSE) in /somewhereonmycomputer/webdirectory/mailercopycopycopy.php on line 38
  8. Yes, I have a private key. I'm just hiding it for use on the forum. No, the script carries on after the instruction to render the unsuccessful.html page. { // If CAPTCHA is valid $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_address_lives_here'; }
  9. Thanks scootstah, So, my code now looks something like this: <?php function validCaptchaV2() { $secret_key = 'my_private_key_lives_here'; $ch = curl_init(sprintf( 'https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', $secret_key, $_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR'] )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $resp = curl_exec($ch); curl_close($ch); if (($answer = json_decode($resp)) !== null) { return $answer->success; } return false; } $firstname = $_POST['firstname']; $surname = $_POST['surname']; $emailaddress = $_POST['emailaddress']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; $body = "First Name: $firstname \n Surname: $surname \n Telephone Number: $telephone \n Message: $enquiry"; // if CAPTCHA is entered incorrectly if(validCaptchaV2() === FALSE) { header('Location: captcha_unsuccessful.html'); exit; } else { // If CAPTCHA is valid $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_address_lives_here'; } ?> // Results rendered as HTML $theResults = <<<EOD <html> <head> <link rel="icon" href="favicon.gif" type="image/gif" /> <title>Woodside Enquiry Form</title> <meta http-equiv='Content-Type' content='text/html'> <style type='text/css'> <!-- body { margin: 0; padding: 0; font-size: 95%; font-family: georgia, times, "times new roman", serif; color: #000; background-color: #3399CC; } a:link { color: #036; } a:visited { color: #003366; } a:hover, a:active { color: #fff; background-color: #036; } div#pagewrap { width:980px; margin: 0 auto; background-color: #fff; } div#banner { background-image: url(banner2.jpg); height: 250px; width: 100%; background-position: 0, 0; background-repeat: no-repeat; border-bottom: 1px solid #000; } div#banner h1 { margin: 0; padding: .3em 0 .3em .5em; font-size: 2.2em; font-weight: normal; } div#container { background-image: url(nav_col_base.jpg); background-repeat: repeat-y; } div#container2 { background-image: url(more_col_base.jpg); background-repeat: repeat-y; background-position: right; } div#navigation { float: left; width: 150px; padding-top: 2em; } div#navigation ul { list-style-type: none; padding: 0; margin: 0; } div#navigation ul li { margin-top: 4px; } #navigation ul li a { display: block; width: 135px; padding: 3px 5px 3px 10px; text-decoration: none; color: #fff; background-image: url(nav_base.jpg); background-repeat: repeat-y; } #navigation ul li a:hover { color: #fff; background-color: #ccc; background-image: url(nav_base2.jpg); background-repeat: repeat-y; } div#more { float: right; width: 160px; margin: 0; padding: 2em 10px 0 0; color: #fff; } div#more h3 { margin-top: 0; color: #fff; padding: .2em; background-image: url(more_base.jpg); background-position: right; background-repeat: repeat-y; } div#content { margin-left: 190px; margin-right: 200px; } div#content h2 { font-size: 2em; color: #036; margin: 0; padding-top: 1em; font-weight: normal; } div#content { line-height: 150%; } #cleardiv { clear: both; height: 1em; } div#footer { clear: both; padding: .5em 1em; border-top: 1px solid #999; text-align: right; } div#footer ul { padding: 0; margin: 0; list-style-type: none; } div#footer li { display: inline; margin-right: 1em; } --> </style> </head> <body> <div id="pagewrap"> <div id="banner"> </div> <div id="container"> <div id="container2"> <div id="navigation"> <ul> <li><a href="index.html">Home</a></li> <li><a href="pools.html">Pools</a></li> <li><a href="rules.html">Fishery Rules</a></li> <li><a href="diary.html">Diary</a></li> <li><a href="results.html">Match Results</a></li> <li><a href="facilities.html">Facilities</a></li> <li><a href="cabins.html">Accommodation</a></li> <li><a href="news.html">News</a></li> <li><a href="contactus3.php">Contact Us</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="links.html">Links</a></li> <li><a href="testimonials.php">Testimonials</a></li> <li><a href="wacs.html">Woodside ACS</a></li> <li><a href="video.html">Video</a></li> <li><a href="press.html">Press</a></li> </ul> </div> <div id="more"> </div> <div id="content"> <h2>Thank you for your submission.</h2> <p>Your enquiry will be processed shortly.</p> <p>Please note that if you did not submit the relevant CAPTCHA information, or entered the information requested incorrectly, your E-mail request will not reach our server and will not be processed. We are not ignoring you!</p> <p>E-mails sent to the fishery are usually responded to the same day. If you have not received a response within 48 hours, please call 01299 270565 or 07968 111 415.</p> <p>Thank you.</p> <p><a href="index.html" />Return to the homepage</a>.</p> </body> </div> <div id="cleardiv"></div> </div> </div> <div id="footer"> <ul> <li><a href="charliespool.html">Charlies Pool</a></li> <li><a href="housepool.html">House Pool</a></li> <li><a href="islandpool.html">Island Pool</a></li> <li><a href="woodsidepool.html">Woodside Pool</a></li> <li>©Woodside Fishery 2012</li> </ul> </div> </html> EOD; echo "$theResults"; ?>
  10. I'm not seeing the Fatal error message anymore. However, the data being submitted via the HTML form is not sending via Email like it should..?
  11. I've checked my domain and I'm not running any PHP version I have set my PHP version to PHP 5.5 as per their recommendation and the only PHP script I had running before my above change is still working.
  12. Hi, As I don't have PHP installed my end I'm assuming I am reliant on my domain host's configuration on their server(s) for this to work?
  13. I'll look into this and see what the solution is. PHP is hard to get your head around!
  14. Thanks again fastsol. I really do appreciate the help. The documentation from Google is next to useless! V1 was not as hard to implement as this! I have made the above change to my code, but I am now receiving this error message: Fatal error: Call to undefined function: json_decode() in /...filepath/somewhereonmycomputer/stillsomethingwrong... on line 8 <?php function validCaptchaV2() { $secret_key = 'my_private_key_lives_here'; $resp = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret_key."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']); $answer = json_decode($resp); return $answer->success; } I've had this fatal error message once before with another example. Regards, Ben_1uk
  15. Thanks for the response fastsol, I have amended my existing code based on your suggestion, and I'm a little further forward with it now. However, the information from the form is not posting to my Email address(?) and I seem to be able to completely by-pass the reCAPTCHA validation by simply clicking the 'submit' button(?) on the form. I have clearly still got something wrong. Here is my amended code: <?php function validCaptchaV2() { $secret_key = 'my_private_key_goes_here'; $resp = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret_key."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']); $answer = json_decode($resp); if($answer->success === FALSE) { // // handle the CAPTCHA being entered incorrectly header('Location: captcha_unsuccessful.html'); return FALSE; } else{ return TRUE; } } $firstname = $_POST['firstname']; $surname = $_POST['surname']; $emailaddress = $_POST['emailaddress']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; $body = "First Name: $firstname \n Surname: $surname \n Telephone Number: $telephone \nMessage: $enquiry"; // if CAPTCHA is entered correctly if($answer->success) { $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_goes_here'; $body = <<<EOD <br><hr><br> <b>First Name</b>: $firstname <br><br> <b>Surname:</b> $surname <br><br> <b>E-mail Address:</b> $emailaddress <br><br> <b>Telephone No:</b> $telephone <br><br> <b>Message:</b> $enquiry <br> EOD; $mailheaders .= "From: $emailaddress\r\n"; $headers .= "Content-type: text/html charset=iso-88590-lrn"; $success = mail($webMaster, $emailSubject, $body, $headers); } // Results rendered as HTML $theResults = <<<EOD <html> <head> <link rel="icon" href="favicon.gif" type="image/gif" /> <title>Woodside Enquiry Form</title> <meta http-equiv='Content-Type' content='text/html'> <style type='text/css'> <!-- body { margin: 0; padding: 0; font-size: 95%; font-family: georgia, times, "times new roman", serif; color: #000; background-color: #3399CC; } a:link { color: #036; } a:visited { color: #003366; } a:hover, a:active { color: #fff; background-color: #036; } div#pagewrap { width:980px; margin: 0 auto; background-color: #fff; } div#banner { background-image: url(banner2.jpg); height: 250px; width: 100%; background-position: 0, 0; background-repeat: no-repeat; border-bottom: 1px solid #000; } div#banner h1 { margin: 0; padding: .3em 0 .3em .5em; font-size: 2.2em; font-weight: normal; } div#container { background-image: url(nav_col_base.jpg); background-repeat: repeat-y; } div#container2 { background-image: url(more_col_base.jpg); background-repeat: repeat-y; background-position: right; } div#navigation { float: left; width: 150px; padding-top: 2em; } div#navigation ul { list-style-type: none; padding: 0; margin: 0; } div#navigation ul li { margin-top: 4px; } #navigation ul li a { display: block; width: 135px; padding: 3px 5px 3px 10px; text-decoration: none; color: #fff; background-image: url(nav_base.jpg); background-repeat: repeat-y; } #navigation ul li a:hover { color: #fff; background-color: #ccc; background-image: url(nav_base2.jpg); background-repeat: repeat-y; } div#more { float: right; width: 160px; margin: 0; padding: 2em 10px 0 0; color: #fff; } div#more h3 { margin-top: 0; color: #fff; padding: .2em; background-image: url(more_base.jpg); background-position: right; background-repeat: repeat-y; } div#content { margin-left: 190px; margin-right: 200px; } div#content h2 { font-size: 2em; color: #036; margin: 0; padding-top: 1em; font-weight: normal; } div#content { line-height: 150%; } #cleardiv { clear: both; height: 1em; } div#footer { clear: both; padding: .5em 1em; border-top: 1px solid #999; text-align: right; } div#footer ul { padding: 0; margin: 0; list-style-type: none; } div#footer li { display: inline; margin-right: 1em; } --> </style> </head> <body> <div id="pagewrap"> <div id="banner"> </div> <div id="container"> <div id="container2"> <div id="navigation"> <ul> <li><a href="index.html">Home</a></li> <li><a href="pools.html">Pools</a></li> <li><a href="rules.html">Fishery Rules</a></li> <li><a href="diary.html">Diary</a></li> <li><a href="results.html">Match Results</a></li> <li><a href="facilities.html">Facilities</a></li> <li><a href="cabins.html">Accommodation</a></li> <li><a href="news.html">News</a></li> <li><a href="contactus3.php">Contact Us</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="links.html">Links</a></li> <li><a href="testimonials.php">Testimonials</a></li> <li><a href="wacs.html">Woodside ACS</a></li> <li><a href="video.html">Video</a></li> <li><a href="press.html">Press</a></li> </ul> </div> <div id="more"> </div> <div id="content"> <h2>Thank you for your submission.</h2> <p>Your enquiry will be processed shortly.</p> <p>Please note that if you did not submit the relevant CAPTCHA information, or entered the information requested incorrectly, your E-mail request will not reach our server and will not be processed. We are not ignoring you!</p> <p>E-mails sent to the fishery are usually responded to the same day. If you have not received a response within 48 hours, please call 01299 270565 or 07968 111 415.</p> <p>Thank you.</p> <p><a href="index.html" />Return to the homepage</a>.</p> </body> </div> <div id="cleardiv"></div> </div> </div> <div id="footer"> <ul> <li><a href="charliespool.html">Charlies Pool</a></li> <li><a href="housepool.html">House Pool</a></li> <li><a href="islandpool.html">Island Pool</a></li> <li><a href="woodsidepool.html">Woodside Pool</a></li> <li>©Woodside Fishery 2012</li> </ul> </div> </html> EOD; echo "$theResults"; ?>
  16. Hi everyone, I'm hoping someone can help me out! I am currently trying to upgrade to the latest version of Google reCAPTCHA. My site is currently using the old version. I am validating the user input on a HTML 'contact us' form using PHP (mailer.php). Depending on the data input by the user, they will see either a 'success' or 'failure' HTML page. I have managed to integrate Google reCAPTCHA v2 client side (ie, on the HTML 'Contact Us' page using the form), but I'm struggling to integrate the new version when it comes to server side validation. I have included a copy of the current mailer.php file, which I somehow need to modify to upgrade to reCAPTCHA v2. Any help would be really appreciated! Thanks, Ben_1uk <?php // check reCAPTCHA information require_once('recaptchalib.php'); $privatekey = "my_private_key_lives_here"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // if CAPTCHA is entered correctly if ($resp->is_valid) { $emailSubject = 'Customer Enquiry'; $webMaster = 'my_email_address_lives_here'; // Data entered by user $firstname = $_POST['firstname']; $surname = $_POST['surname']; $emailaddress = $_POST['emailaddress']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; $body = <<<EOD <br><hr><br> <b>First Name</b>: $firstname <br><br> <b>Surname:</b> $surname <br><br> <b>E-mail Address:</b> $emailaddress <br><br> <b>Telephone No:</b> $telephone <br><br> <b>Message:</b> $enquiry <br> EOD; $mailheaders .= "From: $emailaddress\r\n"; $headers .= "Content-type: text/html charset=iso-88590-lrn"; $success = mail($webMaster, $emailSubject, $body, $headers); } else { // handle the CAPTCHA being entered incorrectly header('Location: captcha_unsuccessful.html'); } // Results rendered as HTML $theResults = <<<EOD <html> <head> <link rel="icon" href="favicon.gif" type="image/gif" /> <title>Woodside Enquiry Form</title> <meta http-equiv='Content-Type' content='text/html'> <style type='text/css'> <!-- body { margin: 0; padding: 0; font-size: 95%; font-family: georgia, times, "times new roman", serif; color: #000; background-color: #3399CC; } a:link { color: #036; } a:visited { color: #003366; } a:hover, a:active { color: #fff; background-color: #036; } div#pagewrap { width:980px; margin: 0 auto; background-color: #fff; } div#banner { background-image: url(banner2.jpg); height: 250px; width: 100%; background-position: 0, 0; background-repeat: no-repeat; border-bottom: 1px solid #000; } div#banner h1 { margin: 0; padding: .3em 0 .3em .5em; font-size: 2.2em; font-weight: normal; } div#container { background-image: url(nav_col_base.jpg); background-repeat: repeat-y; } div#container2 { background-image: url(more_col_base.jpg); background-repeat: repeat-y; background-position: right; } div#navigation { float: left; width: 150px; padding-top: 2em; } div#navigation ul { list-style-type: none; padding: 0; margin: 0; } div#navigation ul li { margin-top: 4px; } #navigation ul li a { display: block; width: 135px; padding: 3px 5px 3px 10px; text-decoration: none; color: #fff; background-image: url(nav_base.jpg); background-repeat: repeat-y; } #navigation ul li a:hover { color: #fff; background-color: #ccc; background-image: url(nav_base2.jpg); background-repeat: repeat-y; } div#more { float: right; width: 160px; margin: 0; padding: 2em 10px 0 0; color: #fff; } div#more h3 { margin-top: 0; color: #fff; padding: .2em; background-image: url(more_base.jpg); background-position: right; background-repeat: repeat-y; } div#content { margin-left: 190px; margin-right: 200px; } div#content h2 { font-size: 2em; color: #036; margin: 0; padding-top: 1em; font-weight: normal; } div#content { line-height: 150%; } #cleardiv { clear: both; height: 1em; } div#footer { clear: both; padding: .5em 1em; border-top: 1px solid #999; text-align: right; } div#footer ul { padding: 0; margin: 0; list-style-type: none; } div#footer li { display: inline; margin-right: 1em; } --> </style> </head> <body> <div id="pagewrap"> <div id="banner"> </div> <div id="container"> <div id="container2"> <div id="navigation"> <ul> <li><a href="index.html">Home</a></li> <li><a href="pools.html">Pools</a></li> <li><a href="rules.html">Fishery Rules</a></li> <li><a href="diary.html">Diary</a></li> <li><a href="results.html">Match Results</a></li> <li><a href="facilities.html">Facilities</a></li> <li><a href="cabins.html">Accommodation</a></li> <li><a href="news.html">News</a></li> <li><a href="contactus3.php">Contact Us</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="links.html">Links</a></li> <li><a href="testimonials.php">Testimonials</a></li> <li><a href="wacs.html">Woodside ACS</a></li> <li><a href="video.html">Video</a></li> <li><a href="press.html">Press</a></li> </ul> </div> <div id="more"> </div> <div id="content"> <h2>Thank you for your submission.</h2> <p>Your enquiry will be processed shortly.</p> <p>Please note that if you did not submit the relevant CAPTCHA information, or entered the information requested incorrectly, your E-mail request will not reach our server and will not be processed. We are not ignoring you!</p> <p>E-mails sent to the fishery are usually responded to the same day. If you have not received a response within 48 hours, please call 01299 270565 or 07968 111 415.</p> <p>Thank you.</p> <p><a href="index.html" />Return to the homepage</a>.</p> </body> </div> <div id="cleardiv"></div> </div> </div> <div id="footer"> <ul> <li><a href="charliespool.html">Charlies Pool</a></li> <li><a href="housepool.html">House Pool</a></li> <li><a href="islandpool.html">Island Pool</a></li> <li><a href="woodsidepool.html">Woodside Pool</a></li> <li>©Woodside Fishery 2012</li> </ul> </div> </html> EOD; echo "$theResults"; ?>
  17. I believe I have found the .php file the query is coming from. However, I'm not sure if I have included the right code as there are a number of similar looking queries contained within the same script (I didn't code this myself). <?php if(isset($_GET['id']) && is_numeric($_GET['id'])) { $query = "SELECT category from com_catalogue WHERE id = '" . mysql_real_escape_string($_GET['id']) . "'"; $result = dbQuery ($query); $itemCategory = dbAll($result); dbFree ($result); foreach ($itemCategory as $i) { $category = $i['category']; } } // ID is a number $query = "SELECT p.id as parentID, p.name as parentName, p.description, p.logo as parentLogo, p.parent, p.active FROM com_catalogue_category p LEFT JOIN com_catalogue_category c ON (c.id = p.parent) WHERE p.id = '" . $category . "'"; $result = dbQuery ($query); $currentCategory = dbAll($result); dbFree ($result);
  18. Something like this (placed after the db connection script)? What is WHERE p.id = %u? $var = 1; $query = sprintf("SELECT p.id as parentID, p.name as parentName, p.description, p.logo as parentLogo, p.parent, p.active FROM com_catalogue_category p LEFT JOIN com_catalogue_category c ON (c.id = p.parent) WHERE p.id = %u", intval($var)); function dbAll ($result) { $rows = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($rows, $row); } return $rows; } function dbFree ($result) { mysql_free_result($result); }
  19. Because I don't know how to. I'm trying!
  20. The lines from the script mentioned in the email are stated below. function dbQuery ($query) { $result = mysql_query($query); return $result; } function dbAll ($result) { $rows = array(); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($rows, $row); } return $rows; } function dbFree ($result) { mysql_free_result($result); } ?>
  21. Sorry to be thick Jazzman, but could you give me an example of what you mean? Thanks.
  22. I cannot see any database credentials confirmed in the db.php file. I assume you're referring to specifics such as username, password, etc..?
  23. Would it be safe to post the .php file handling the DB query result here for someone to have a look at or not?
  24. Thanks for the quick reply adam_bray. I'm receiving literally 80-100 Emails with the same result every 10 minutes or so! What is the best way of making the query more secure?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.