Scripted contact form for swishmax onwards.
contains form field validation, captcha security and profanity filter.
Preview:

on Scene_1 of _root or Scene_1 of a Movieclip add the following script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | onSelfEvent (load) { /* Scripted Contact Form With form Validation Captcha Security & Profanity Filter By Craig Lowe swish-designs.co.uk & loweonline.co.uk Swishmax 4 */ //---- Profanity Filter ----// badWords = ["cat", "dog", "bird"]; // your list of bad/swear words. //---- Name Input Box Settings ----// this.createTextField("staticName",1,15,10,100,20); staticName.text = "Name:"; staticName.type = "static"; staticName.selectable = false; this.createTextField("Namea",2,50,10,100,20); Namea.multiline = false; Namea.wordWrap = true; Namea.border = true; Namea.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; Namea.setTextFormat(myformat); Namea.background = true; Namea.backgroundColor = '0xFFFFCC'; Namea.type = "input"; Namea.target =//---- Email Input Box Settings ----// this.createTextField("staticEmail",3,15,40,100,20); staticEmail.text = "Email:"; staticEmail.type = "static"; staticEmail.selectable = false; this.createTextField("Emaila",4,50,40,200,20); Emaila.multiline = false; Emaila.wordWrap = true; Emaila.border = true; Emaila.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; Emaila.setTextFormat(myformat); Emaila.background = true; Emaila.backgroundColor = '0xFFFFCC'; Emaila.type = "input";//---- Tel Input Box Settings ----// this.createTextField("staticTel",5,15,70,100,20); staticTel.text = "Tel:"; staticTel.type = "static"; staticTel.selectable = false; this.createTextField("Tela",6,50,70,150,20); Tela.multiline = false; Tela.wordWrap = true; Tela.border = true; Tela.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; Tela.setTextFormat(myformat); Tela.background = true; Tela.backgroundColor = '0xFFFFCC'; Tela.type = "input"; //---- Message Input Box Settings ----// this.createTextField("staticMessage",7,0,100,100,20); staticMessage.text = "Message:"; staticMessage.type = "static"; staticMessage.selectable = false; this.createTextField("Messagea",8,50,100,250,100); Messagea.multiline = false; Messagea.wordWrap = true; Messagea.border = true; Messagea.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; Messagea.setTextFormat(myformat); Messagea.background = true; Messagea.backgroundColor = '0xFFFFCC'; Messagea.type = "input"; Message.multiline = true; Message.wordWrap = true; //---- captcha dynamic Box Settings ----// this.createTextField("staticCaptcha",15,0,210,210,20); staticCaptcha.text = "Capcha:"; staticCaptcha.type = "static"; staticCaptcha.selectable = false; this.createTextField("CaptchaShow",16,50,210,40,20); CaptchaShow.multiline = false; CaptchaShow.wordWrap = true; CaptchaShow.border = true; CaptchaShow.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; CaptchaShow.setTextFormat(myformat); CaptchaShow.background = true; CaptchaShow.backgroundColor = '0xcccccc'; CaptchaShow.type = "dynamic"; CaptchaShow.selectable=false; CaptchaShow.multiline = false; CaptchaShow.wordWrap = true; //--- captcha enter Box settings ---// this.createTextField("CaptchaEnter",17,100,210,60,20); CaptchaEnter.multiline = false; CaptchaEnter.wordWrap = true; CaptchaEnter.border = true; CaptchaEnter.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformata.size = 12; CaptchaEnter.setTextFormat(myformata); CaptchaEnter.background = true; CaptchaEnter.backgroundColor = '0xFFFFCC'; CaptchaEnter.type = "input"; CaptchaEnter.selectable=true; CaptchaEnter.multiline = false; CaptchaEnter.wordWrap = true; //---- Reset Button Settings ----// this.createTextField("staticreset",9,185,210,100,20); staticreset.text = "Reset"; staticreset.type = "static"; staticreset.selectable = false; _root.createEmptyMovieClip("btn_Reset", 10); _root.btn_Reset.lineStyle(1, 0x333333, 100); _root.btn_Reset.beginFill(0xFFFF00, 30); _root.btn_Reset.moveTo(-30, -10); _root.btn_Reset.lineTo(30, -10); _root.btn_Reset.lineTo(30, 10); _root.btn_Reset.lineTo(-30, 10); _root.btn_Reset.lineTo(-30, -10); _root.btn_Reset.endFill(); _root.btn_Reset._x += 200; _root.btn_Reset._y += 220; //---- Send Button Settings ----// this.createTextField("staticsend",11,256,210,100,20); staticsend.text = "Send"; staticsend.type = "static"; staticsend.selectable = false; _root.createEmptyMovieClip("btn_Send", 12); _root.btn_Send.lineStyle(1, 0x333333, 100); _root.btn_Send.beginFill(0xFFFF00, 30); _root.btn_Send.moveTo(-30, -10); _root.btn_Send.lineTo(30, -10); _root.btn_Send.lineTo(30, 10); _root.btn_Send.lineTo(-30, 10); _root.btn_Send.lineTo(-30, -10); _root.btn_Send.endFill(); _root.btn_Send._x += 270; _root.btn_Send._y += 220; //---- Info Box Settings ----// this.createTextField("info",13,50,240,250,20); info.multiline = false; info.wordWrap = true; info.border = true; info.borderColor = '0x0099FF'; var myformat:TextFormat = new TextFormat(); myformat.size = 12; info.setTextFormat(myformat); info.background = true; info.backgroundColor = '0xFFFFFF'; info.type = "dynamic"; info.selectable = false; CaptchaShow.text=random(9999); } //Reset Button Settings// onSelfEvent (enterFrame) { if(CaptchaShow.text.length<4){ CaptchaShow.text=random(9999); } _root.btn_Reset.onPress = function() { Namea.text=""; Emaila.text=""; Tela.text=""; Messagea.text=""; info.text=""; CaptchaEnter.text=""; CaptchaShow.text=random(9999); }; //Validation Settings// _root.btn_Send.onPress = function() { if(Namea.text==""){ info.text="You Must Enter Your Name!" return; } if(Namea.length<4){ info.text="You Must Enter Your Full Name!" return; }if(Emaila.text==""){ info.text="You Must Enter Your Email Address!" return; }if(Emaila.length<5){ info.text="You Must Enter A Valid Email Address!" return; }if(Emaila.text.indexOf("@") == -1){ info.text="The Entered Email Is Not Valid!" return; }if(Emaila.text.indexOf(".") == -1){ info.text="The Email Must Be A Valid Email Address!" return; }if(Tela.text.length<10){ info.text="Please Provide A Telephone Number" return; }if(Messagea.text==""){ info.text="You Must Enter A Message!" return; }if(CaptchaEnter.text==""){ info.text="You Must Enter The Captcha" return; }if(CaptchaEnter.text!=CaptchaShow.text){ info.text="The Captcha Code Does Not Match!" return; } for (i in badWords) { if (Messagea.text.indexOf(badWords[i])>-1) { info.text = "Swear Words Have Been Detected!"; return; } } info.text="Thank You Your Message has Been Sent"; loadVariables("send.php",'POST'); } // }; onSelfEvent (enterFrame) { Name=Namea.text; Email=Emaila.text; Tel=Tela.text; Message=Messagea.text; } |
copy and paste the following into notepad and save as send.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php // scripted contact form $EmailFrom = "Change this to email from"; $EmailTo = "change this to your email address"; $Subject = "Change this to your subject"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Message = Trim(stripslashes($_POST['Message'])); $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); ?> |
Thats it enjoy.
Social Connect
Login with one of the following.Enter your WordPress.com blog URL
http://.wordpress.com
Proceed