Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Getting the the error message : The requested method POST is not allowed for the URL /default.htm
- <form onsubmit="return signup();" method="post" name="subform" id="subform" action="">
- <table width="100%" border="0" >
- <tr>
- <td align="right" width="50%"> <div class="loginboxdiv" align="center">
- <input class="loginbox" name="email" type="text" />
- </div></td>
- <td align="left" width="50%"><input type="image" value="submit" src="submitbutton.gif" width="128" height="24" /></td>
- </tr>
- </table>
- </form>
- <script type="text/javascript" language="javascript">
- function trim(str){str = str.replace(/^s*$/, '');return str;}
- function signup() {
- var email = trim($F("email"));
- //EMAIL VALIDATION
- 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);
- apos=email.indexOf("@");dotpos = email.lastIndexOf(".");lastpos=email.length-1;
- var badEmail = (apos<1 || dotpos-apos<2 || lastpos-dotpos<2);
- if (email=="" || !goodEmail || badEmail) {
- $('.success').fadeIn(200).hide();
- $('.error').fadeOut(200).show();
- $("email").focus();
- return false;
- }
- else {
- var url = "optIn.php";
- var params = $("subform").serialize();
- new Ajax.Request(url, {onException:showException, onFailure:showException, asynchronous:true, method:'post', evalScripts:false, postBody:params});
- $('.success').fadeIn(200).show();
- $('.error').fadeOut(200).hide();
- return false;
- }
- }
- function showException(req) {
- $("myResponse").innerHTML=req.responseText;
- alert("An error occured while talking to the server. Please try again.");
- $("loading", "myResponse").invoke('hide');
- $("submit").show();
- $("name", "email").invoke('clear');
- }
- </script>
- <?php
- $email = trim($_REQUEST["email"]);
- $pdbHost = "localhost";
- $pdbUserName = "-------";
- $pdbPassword = "------";
- $pdbName = "-----------";
- // Connect to mySQL
- $conlink = mysql_connect($pdbHost, $pdbUserName, $pdbPassword);
- if(!$conlink) {die('Unable to connect to '.$pdbHost);}
- if (!mysql_select_db($pdbName, $conlink)){die('Cannot find database '.$pdbName);}
- //SQL query
- $SQL2= "INSERT INTO lighthou_EmailAddresses.SubscriberEmails ( 'Email_Address`) VALUES ('".$Email."')";
- mysql_query($SQL2);
- mysql_close($conlink);
- ?>
Add Comment
Please, Sign In to add comment