Advertisement
Guest User

Signup

a guest
Aug 8th, 2011
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.58 KB | None | 0 0
  1. <script src="../javascripts/js/lib/jquery.js" type="text/javascript"></script>
  2. <script src="../javascripts/js/jquery.validate.js" type="text/javascript"></script>
  3.  
  4. <script type="text/javascript">
  5. $(document).ready(function()
  6. {
  7. $("#signupForm").validate({
  8. rules: {
  9. first_name: {required:true,minlength:3},
  10. last_name: {required:true,minlength:3},
  11. address1: "required",
  12. city: "required",
  13. postal_code: "required",
  14. country: "required",
  15. business_name: "required",
  16. business_phone: "required",
  17. email1: {required:true, email:true },
  18. liscence_number: "required",
  19. province: "required",
  20. about_us: {required:true,minlength:15}
  21. },
  22. messages: {
  23. first_name: " - Please enter your first name",
  24. last_name: " - Please enter your last name",
  25. address1 : " - Please enter your address",
  26. city: " - Please enter your city",
  27. postal_code: "- Please enter your postal code",
  28. country: " - Please select your country ",
  29. business_name: " - Please enter you business name",
  30. business_phone: " - Please enter your business phone number",
  31. email1: " - Please enter your email address",
  32. liscence_number : " - Please enter your Liscence Number",
  33. province: " - Please select your province"
  34. },
  35. errorElement: "span",
  36. errorPlacement: function(error, element) {
  37. element.siblings("label").append(error);
  38. },
  39. highlight: function(element) {
  40. $(element).siblings("label").addClass("error");
  41. },
  42. unhighlight: function(element) {
  43. $(element).siblings("label").removeClass("error");
  44. },
  45. submitHandler: function() {
  46. form.submit();
  47. }
  48. });
  49. });
  50. </script>
  51. <!-- #INCLUDE file="../include/header2.asp"-->
  52. <!-- #INCLUDE file="../include/ado.asp"-->
  53. <!-- #INCLUDE file="../include/functions.asp"-->
  54.  
  55. <%
  56. dim do_what
  57. dim Member_ID
  58.  
  59.  
  60. do_what = Request.QueryString("do_what")
  61.  
  62.  
  63. OpenDB("../database/cpio.mdb")
  64.  
  65.  
  66. %>
  67.  
  68.  
  69. <!-- THERE ARE 5 COLUMNS IN THIS OUTTER TABLE -->
  70. <tr>
  71. <td colspan="5" align="left" valign="top" style="font-family:Tahoma,arial; font-size:12px; color:#464646">
  72.  
  73. <a href="../default.asp" style="padding-left:10px;">Home</a> &raquo; <a href="default.asp">Memberships</a> &raquo; Online Application Form
  74. <br>
  75.  
  76. <table cellpadding="0" cellspacing="0" border="0" style="padding-top:40px;">
  77. <tr>
  78.  
  79. <td width="140" align="center" valign="top" style="font-family: Tahoma, Arial; font-size: 12px; padding-left:30px;">
  80. <img src="../images/memberships-1.jpg" alt=""><br><br><strong><small>&quot;Join a winning team&quot;</small></strong>
  81.  
  82. <td valign="top" style="font-family: Tahoma, Arial; font-size: 12px; padding-left:30px;">
  83.  
  84. <div style="font-family:Century Gothic; font-weight:bold; font-size:20px; padding-top:0px; padding-bottom:20px;">
  85. Membership Application Form</div>
  86.  
  87.  
  88. <div style="padding-right:35px; padding-bottom:30px; font-family: Tahoma; font-size: 12px; color:#464646; line-height:20px;">
  89.  
  90.  
  91. <% if do_what = "" then %>
  92.  
  93. Please complete the following form in detail. &nbsp;For security reasons, your full legal name and business name (if applicable) are required. &nbsp;Failure to complete all fields may delay your application.<br>
  94.  
  95. <br><br>
  96.  
  97. <form name="signupForm" method="post" id="signupForm" action="signup.asp?do_what=submit">
  98. <fieldset>
  99. <legend>Personal Information</legend>
  100. <div class="row">
  101. <label for="last_name">Last Name:*</label>
  102. <input type="text" name="last_name" class="required" maxlength="30" size="35">
  103. </div>
  104.  
  105. <div class="row">
  106. <label for="first_name">First Name*:</label>
  107. <input type="text" name="first_name" class="required" maxlength="30" size="35">
  108. </div>
  109.  
  110. <div class="row">
  111. <label for="middle_initial">Middle Initial:</label>
  112. <input type="textbox" name="middle_initial" maxlength="1" size="2">
  113. </div>
  114. <div class="row">
  115. <label for="dob">Birth Date:</label>
  116. <input type="textbox" name="dob" maxlength="10" size="15">&nbsp;&nbsp; <small>(MM/DD/YYYY)</small>
  117. </div>
  118. </fieldset>
  119. <br/>
  120. <fieldset>
  121. <legend>Business Address</legend>
  122. <div class="row">
  123. <label for="address1">Address1:*</label>
  124. <input type="textbox" name="address1" class="required" maxlength="50" size="35">
  125. </div>
  126. <div class="row">
  127. <label for="address2">Address2:</label>
  128. <input type="textbox" name="address2" maxlength="50" size="35">
  129. </div>
  130. <div class="row">
  131. <label for="city">City:*</label>
  132. <input type="textbox" name="city" class="required" maxlength="30" size="35">
  133. </div>
  134. <div class="row">
  135. <label for="Province:">Province:*</label>
  136. <% Call LoadProvinces() %>
  137. </div>
  138. <div class="row">
  139. <label for="postal_code">Postal Code:*</label>
  140. <input type="textbox" name="postal_code" class="required" maxlength="15" size="15">
  141. </div>
  142. <div class="row">
  143. <label for="country">Country:*</label>
  144. <select name="country" class="required" >
  145. <option></option>
  146. <option value="Canada">Canada</option>
  147. <option value="United States">United States</option>
  148. </select>
  149. </div>
  150. </fieldset>
  151. <fieldset>
  152. <legend>Business Contact Information</legend>
  153. <div class="row">
  154. <label for="business_name">Business Name:*</label>
  155. <input type="textbox" name="business_name" class="required" maxlength="100" size="35">
  156. </div>
  157. <div class="row">
  158. <label for="business_phone">Business Phone:*</label>
  159. <input type="textbox" name="business_phone" class="required" maxlength="40" size="35">
  160. <div class="row">
  161. <label for="toll_free">Toll Free:</label>
  162. <input type="textbox" name="toll_free" maxlength="40" size="35">
  163. </div>
  164. <div class="row">
  165. <label for="fax_number">Fax Number:</label>
  166. <input type="textbox" name="fax_number" maxlength="40" size="35">
  167. </div>
  168. <div class="row">
  169. <label for="cell_phone">Cell Phone:</label>
  170. <input type="textbox" name="cell_phone" maxlength="40" size="35">
  171. </div>
  172. <div class="row">
  173. <label for="email1">Email #1:*</label>
  174. <input type="textbox" name="email1" class="required" maxlength="60" size="35">
  175. </div>
  176. <div class="row">
  177. <label for="email2">Email #2:</label>
  178. <input type="textbox" name="email2" maxlength="60" size="35">
  179. </div>
  180. <div class="row">
  181. <label for="website_url">Business Url:</label>
  182. <input type="textbox" name="website_url" maxlength="60" size="35" >
  183. </div>
  184. <div class="row">
  185. <label for="about_us">Business History:*</label>
  186. <textarea name="about_us" rows="5" cols="30" class="required"></textarea>
  187. </div>
  188. </fieldset>
  189. <fieldset>
  190. <legend>Membership Details</legend>
  191. <div class="row">
  192. <label for="lisence_number">P.I. License #:*</label>
  193. <input type="textbox" name="license_number" class="required" maxlength="300" size="35">
  194. </div>
  195. <div class="row">
  196. <label for="Agency_Number">Agency. License #:*</label>
  197. <input type="textbox" name="Agency_Number" class="required" maxlength="300" size="35">
  198. </div>
  199. <div class="row">
  200. <label for="membership_type_id">Membership Type:*</label>
  201. <select name="membership_type_id" class="required">
  202. <option></option>
  203. <%
  204. SQL = "SELECT * FROM Membership_Types ORDER BY Membership_Type ASC"
  205. dbRS2.Open SQL, dbConn, adOpenForwardOnly, adLockReadOnly
  206. RS2Open = true
  207. do until dbRS2.EOF
  208. select case ucase(trim(dbRS2.fields("Membership_Type") & ""))
  209. case "INDIVIDUAL","AGENCY","ASSOCIATE","STUDENT"
  210. response.write "<option value='" & dbRS2.fields("Membership_Type_ID") & "'>"
  211. response.write UCase(GetField("Membership_Type", "Membership_Types", "Membership_Type_ID", dbRS2.fields("Membership_Type_ID")))
  212. response.write "</option>"
  213. end select
  214. dbRS2.MoveNext
  215. loop
  216. dbRS2.Close
  217. RS2Open = false
  218. %>
  219. </select>
  220. </div>
  221. </fieldset>
  222. <fieldset>
  223. <legend>Legal Information</legend>
  224. <label for="privacy">I agree that I have read and understand the <a href="http://www.cpi-ontario.com/governance/privacy_policy.asp">Privacy Policy</a>. I understand that my information may be shared on this site.</label>
  225. <input type="checkbox" name="privacy" class="required" />
  226. <br>
  227. <br>
  228. <label> I agree that i have read, and will abide by the code of ethics <a href="http://www.cpi-ontario.com/disclaimer.asp">Code of Ethics</a></label>
  229. <input type="checkbox" name="ethics" class="required" />
  230. <br>
  231. <br>
  232.  
  233. </fieldset>
  234. <div align="center" style="padding-right:30px; padding-top:30px;">
  235. <!--<input type="button" name="submitBtn" value="Submit Application" onClick="javascript:check_form(this, 'signup.asp?do_what=submit');">-->
  236.  
  237. <input class="submit" type="submit" value="submit"/></div>
  238.  
  239. </form>
  240.  
  241. <%
  242. elseif do_what = "submit" then
  243.  
  244. Call SaveApplication()
  245.  
  246. dim full_name
  247. full_name = GetField("Full_Name", "Members", "Member_ID", Member_ID)
  248.  
  249. msgBody = "<html><body><div style='font-family:Tahoma; font-size:12px; line-height:18px;'>" _
  250. & "Dear " & full_name & ":<br><br>" _
  251. & "Thank you for your application for membership with the CPIO. &nbsp;Your message will be reviewed within the next " _
  252. & "24 to 48 hours. &nbsp;If your application is approved, you will receive a confirmation by e-mail along with a " _
  253. & "'Welcome' package. <br><br><strong>Your temporary membership ID # is <u>ON" & right("00000" & cstr(Member_ID), 5) & "</u>" _
  254. & ".</strong><br><br>" _
  255. & "If you have not heard back from us within this time frame, please contact our <a href='mailto:webadmin@cpi-ontario.com'>" _
  256. & "Website Administrator</a> and/or our <a href='mailto:director.memberships@cpi-ontario.com'>Director of Memberships</a>." _
  257. & "<br><br><br>Thanks again,<br><br><br>Council of Private Investigators - Ontario" _
  258. & "</div></div></body></html>"
  259.  
  260. 'if len(trim(full_name)) >= 5 then
  261. Call SendMsg2(msgBody)
  262. 'end if
  263.  
  264.  
  265. end if %>
  266.  
  267. </div>
  268.  
  269.  
  270. </td>
  271. </tr>
  272. </table>
  273.  
  274.  
  275. </td>
  276. </tr>
  277.  
  278. <%
  279.  
  280.  
  281. function LoadProvinces()
  282.  
  283. %><select name="province" class="required" ><option></option>
  284. <%
  285. sql = "SELECT * FROM Provinces WHERE Country = 'Canada' ORDER BY Province ASC"
  286.  
  287. dim rs
  288. dim rsOpen
  289.  
  290. set rs = Server.CreateObject("ADODB.Recordset")
  291.  
  292. rs.Open SQL, dbConn, adOpenDynamic, adLockOptimistic
  293. rsOpen = True
  294. do until rs.eof
  295. %>
  296. <option value="<% = ucase(trim(rs.fields("Code") & ""))%>"><% =ucase(trim(rs.fields("Code") & "")) & " - " & trim(rs.fields("Province") & "")%></option>
  297. <% rs.MoveNext
  298. loop
  299. rs.Close()
  300. rsOpen = false
  301.  
  302. %><option>-----------------------------------------</option><%
  303. sql = "SELECT * FROM Provinces WHERE Country = 'United States' ORDER BY Province ASC"
  304.  
  305. rs.Open SQL, dbConn, adOpenDynamic, adLockOptimistic
  306. rsOpen = True
  307. do until rs.eof
  308. %>
  309. <option value="<% = ucase(trim(rs.fields("Code") & ""))%>"><% =ucase(trim(rs.fields("Code") & "")) & " - " & trim(rs.fields("Province") & "")%></option>
  310. <% rs.MoveNext
  311. loop
  312. rs.Close()
  313. rsOpen = false
  314.  
  315. set rs = nothing
  316.  
  317. %></select><%
  318.  
  319. end function
  320.  
  321.  
  322.  
  323.  
  324.  
  325. function SaveApplication()
  326.  
  327. dim alreadyOnFile
  328.  
  329. SQL = "SELECT * FROM Members WHERE Last_Name = '" & Trim(Request.Form("last_name") & "") & "' AND First_Names LIKE '" & Trim(Request.Form("first_name") & "") & "%'"
  330.  
  331. dim rs
  332. dim rsOpen
  333.  
  334. set rs = Server.CreateObject("ADODB.Recordset")
  335. 'response.write "<br>sql = " & sql
  336. 'response.end
  337. rs.open sql, dbConn, adOpenDynamic, adLockOptimistic
  338.  
  339. if rs.eof then
  340. alreadyOnFile = false
  341. else
  342. alreadyOnFile = true
  343. Member_ID = rs.fields("Member_ID")
  344. end if
  345.  
  346. if not alreadyOnFile then
  347. rs.AddNew
  348. Member_ID = rs.fields("Member_ID")
  349. fname = Trim(Request.Form("first_name") & "") & " " & Trim(Request.Form("middle_initial") & "")
  350. rs.fields("First_Names") = ProperCase(Trim( fname ))
  351. rs.fields("Last_Name") = ucase(Trim(Request.Form("last_name") & ""))
  352. rs.fields("Full_Name") = Trim(rs.fields("First_Names") & " " & Trim(Request.Form("last_name") & ""))
  353. if isdate(trim(Request.Form("DOB"))) then
  354. rs.fields("DOB") = Trim(Request.Form("dob") & "")
  355. else
  356. rs.fields("DOB") = null
  357. end if
  358.  
  359. rs.fields("Operating_Name") = ProperCase(DoubleUpQuotes(Trim(Request.Form("business_name") & "")))
  360. rs.fields("Address1") = ProperCase(DoubleUpQuotes(Trim(Request.Form("address1") & "")))
  361. rs.fields("Address2") = ProperCase(DoubleUpQuotes(Trim(Request.Form("address2") & "")))
  362. rs.fields("City") = ProperCase(DoubleUpQuotes(Trim(Request.Form("city") & "")))
  363. rs.fields("Province") = ProperCase(Trim(Request.Form("province") & ""))
  364. rs.fields("Postal_Code") = ucase(Trim(Request.Form("postal_code") & ""))
  365. rs.fields("Country") = ProperCase(Trim(Request.Form("country") & ""))
  366. rs.fields("Business_Phone") = FormatPhoneNumber(Request.Form("business_phone"))
  367. rs.fields("Toll_Free") = FormatPhoneNumber(Request.Form("toll_free"))
  368. rs.fields("Cell") = FormatPhoneNumber(Request.Form("cell"))
  369. rs.fields("Business_Fax") = FormatPhoneNumber(Request.Form("business_fax"))
  370. rs.fields("Email1") = lcase(Trim(Request.Form("email1") & ""))
  371. rs.fields("Email2") = lcase(Trim(Request.Form("email2") & ""))
  372. rs.fields("Website_URL") = lcase(Trim(Request.Form("website_url") & ""))
  373. rs.fields("about_us") = lcase(Trim(Request.Form("about_us") & ""))
  374. rs.fields("Membership_Number") = "ON" & RIGHT("00000" & cstr(Member_ID), 5)
  375. rs.fields("Agency_Number") = lcase(Trim(Request.Form("Agency_Number") & ""))
  376. rs.fields("Membership_Status") = "PENDING"
  377. rs.fields("Membership_Type_ID") = Request.Form("membership_type_id")
  378. rs.fields("Last_Updated") = now
  379. rs.fields("Membership_Application_Date") = now
  380. rs.fields("Allow_View_Private_Topics")= true
  381.  
  382. if(Request.Form("membership_type_id")="1") then 'Individual
  383. rs.fields("Allow_View_Private_Topics")= true
  384. rs.fields("Allow_Submit_Topics")= true
  385. rs.fields("Allow_View_Threads") = true
  386. rs.fields("Allow_Submit_Threads") = true
  387. end if
  388. if(Request.Form("membership_type_id")="2") then 'Agency
  389. rs.fields("Allow_View_Private_Topics")= true
  390. rs.fields("Allow_Submit_Topics")= true
  391. rs.fields("Allow_View_Threads") = true
  392. rs.fields("Allow_Submit_Threads") = true
  393.  
  394. end if
  395. if(Request.Form("membership_type_id")="3") then 'Associate
  396. rs.fields("Allow_View_Private_Topics")= true
  397. rs.fields("Allow_Submit_Topics")= true
  398. rs.fields("Allow_View_Threads") = true
  399. rs.fields("Allow_Submit_Threads") = true
  400.  
  401. end if
  402. if(Request.Form("membership_type_id")="4") then 'Student
  403. rs.fields("Allow_View_Private_Topics")= true
  404. rs.fields("Allow_Submit_Topics")= true
  405. rs.fields("Allow_View_Threads") = true
  406. rs.fields("Allow_Submit_Threads") = true
  407.  
  408. end if
  409.  
  410. ' MEMBERSHIPS EXPIRE 1 YEAR + 1st day of following month
  411. y = year(now) + 1
  412. m = month(now)
  413. d = day(now)
  414. if m = 12 then
  415. m = 1
  416. y = y + 1
  417. d = 1
  418. end if
  419. rs.fields("Membership_Expiry_Date") = "01/01/" & cstr(y)
  420.  
  421. rs.Update
  422. end if
  423.  
  424. rs.Close
  425. rsOpen = False
  426.  
  427. if not alreadyOnFile then
  428. %>
  429. Thank you for completing and submitting the online application form.<br><br><br>Your application will be reviewed within the next 48 hours and you will be notified by e-mail once it has been approved.
  430. <%
  431. else
  432. %>
  433. <div style="color:red; font-weight:bold">An application has already been submitted in your name.
  434. <%
  435. end if
  436.  
  437. set rs = nothing
  438.  
  439. end function
  440. %>
  441.  
  442. <%
  443. function SendMsg2 (msgBody)
  444. Dim objMessage 'Holds the CDONTS NewMail Object
  445. dim email1
  446. dim email2
  447.  
  448. email1 = GetField("Email1", "Members", "Member_ID", Member_ID)
  449. email2 = GetField("Email2", "Members", "Member_ID", Member_ID)
  450.  
  451. Set objMessage = Server.CreateObject("CDO.Message")
  452. Set objConfig = Server.CreateObject ("CDO.Configuration")
  453.  
  454.  
  455.  
  456. 'Outgoing SMTP server
  457. objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.cpi-ontario.com"
  458. objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 2525
  459. objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  460. objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  461. ObjConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic
  462. '(clear-text) authentication
  463. ObjConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") ="noreply@cpi-ontario.com"
  464. ObjConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="*****"
  465. objConfig.Fields.Update
  466.  
  467. 'Update the CDOSYS Configuration
  468. Set objMessage.Configuration = objConfig
  469.  
  470. 'WORKS
  471. objMessage.From = "noreply@cpi-ontario.com"
  472. objMessage.To = email1
  473. objMessage.Cc = "adam@affordabletechs.net"
  474. objMessage.Bcc = "act1@affordabletechs.net"
  475. objMessage.Subject = "New Membership Application"
  476. objMessage.HtmlBody = "<html><body>" & status & "<br><br>" & msg & "</body></html>"
  477.  
  478. SendMsg = objMessage.Send
  479.  
  480. Set objMessage = Nothing
  481. Set objConfig = Nothing
  482.  
  483. End function
  484. %>
  485. <%
  486. CloseDB()
  487. %>
  488. <!-- #INCLUDE file="../include/footer2.asp" -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement