Guest User

Untitled

a guest
Aug 19th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. Getting the the error message : The requested method POST is not allowed for the URL /default.htm
  2. <form onsubmit="return signup();" method="post" name="subform" id="subform" action="">
  3. <table width="100%" border="0" >
  4. <tr>
  5. <td align="right" width="50%"> <div class="loginboxdiv" align="center">
  6. <input class="loginbox" name="email" type="text" />
  7. </div></td>
  8. <td align="left" width="50%"><input type="image" value="submit" src="submitbutton.gif" width="128" height="24" /></td>
  9. </tr>
  10. </table>
  11. </form>
  12.  
  13. <script type="text/javascript" language="javascript">
  14. function trim(str){str = str.replace(/^s*$/, '');return str;}
  15. function signup() {
  16. var email = trim($F("email"));
  17. //EMAIL VALIDATION
  18. var goodEmail = email.match(/b(^(S+@).+((.com)|(.net)|(.edu)|(.mil)|(.gov)|(.org)|(.info)|(.sex)|(.biz)|(.aero)|(.coop)|(.museum)|(.name)|(.pro)|(.arpa)|(.asia)|(.cat)|(.int)|(.jobs)|(.tel)|(.travel)|(.xxx)|(..{2,2}))$)b/gi);
  19. apos=email.indexOf("@");dotpos = email.lastIndexOf(".");lastpos=email.length-1;
  20. var badEmail = (apos<1 || dotpos-apos<2 || lastpos-dotpos<2);
  21. if (email=="" || !goodEmail || badEmail) {
  22. $('.success').fadeIn(200).hide();
  23. $('.error').fadeOut(200).show();
  24. $("email").focus();
  25. return false;
  26. }
  27. else {
  28.  
  29. var url = "optIn.php";
  30. var params = $("subform").serialize();
  31. new Ajax.Request(url, {onException:showException, onFailure:showException, asynchronous:true, method:'post', evalScripts:false, postBody:params});
  32. $('.success').fadeIn(200).show();
  33. $('.error').fadeOut(200).hide();
  34. return false;
  35. }
  36. }
  37. function showException(req) {
  38. $("myResponse").innerHTML=req.responseText;
  39. alert("An error occured while talking to the server. Please try again.");
  40. $("loading", "myResponse").invoke('hide');
  41. $("submit").show();
  42. $("name", "email").invoke('clear');
  43. }
  44. </script>
  45.  
  46. <?php
  47.  
  48.  
  49.  
  50. $email = trim($_REQUEST["email"]);
  51.  
  52.  
  53.  
  54. $pdbHost = "localhost";
  55. $pdbUserName = "-------";
  56. $pdbPassword = "------";
  57. $pdbName = "-----------";
  58.  
  59.  
  60. // Connect to mySQL
  61. $conlink = mysql_connect($pdbHost, $pdbUserName, $pdbPassword);
  62. if(!$conlink) {die('Unable to connect to '.$pdbHost);}
  63. if (!mysql_select_db($pdbName, $conlink)){die('Cannot find database '.$pdbName);}
  64.  
  65. //SQL query
  66. $SQL2= "INSERT INTO lighthou_EmailAddresses.SubscriberEmails ( 'Email_Address`) VALUES ('".$Email."')";
  67.  
  68. mysql_query($SQL2);
  69.  
  70. mysql_close($conlink);
  71. ?>
Add Comment
Please, Sign In to add comment