[!] ************************************************************* Euca Design Center EDC Review System by Donovan Feb. 2008 All credits to Euca Design Center ************************************************************* [/!] [!] ************************************************************* Instructions: overview: This is an include file that is meant to be included on the live page that will do the new reviews. Use the syntax: "[include file=edcreviews/inc/newreview.inc]" inside your live page. Please start by setting the text variables below! ************************************************************* [/!] [!] ************************************************************** -Donovan Adding Checks for preceeding form. (captcha etc.) -Donovan Feb. 19 2008 - Added title to review *********************************************************** [/!] [!] ** First, Set Variables Below! ** [/!] [text]new_rev_name=store_review_new.html[/text] [!] ** the above is the name of the page where this file is "included" into ** [/!] [text]new_rev_path=http://www.knifecenter.com/kc_new/[/text] [!] example: "http://www.domain.com/subdirectory/"[/!] [!] ** the above is the absolute path to the "edcreview" folder (usually located in the same directory as your "review page" above) hint: use ending "/" in this variable! ** [/!] [text]admin_email=ki@mail.knifecenter.com[/text] [!] ** set an email address above that will be in charge of approving/denying the a new review ** [/!] [switch value=[action]] [case value=thanks]
 
Thanks for your submission!
Your review will be "live" once approved by the site administrator.

Click here to go back to the [s] product detail page.

Enter promotional code KCREVIEW on your next order during checkout to receive a free gift!
 
[/case] [case value=submitreview] [!] ** first we do some checking ** [/!] [text]errorcheck=1[/text] [!]** good **[/!] [!] ** CAPTCHA check ** [/!] [If ("[Decrypt seed=4742][UnURL][_matchthis][/UnURL][/Decrypt]"="[_numbertomatch]")] [Else][text multi=T]errorcheck=0&mssg=1[/text][/Else] [/if] [!] ** other checks ** [/!] [hideif |1|2|3|4|5|^|[rev_rating]|] [text multi=T]errorcheck=0&mssg=2[/text] [/hideif] [showif [url][rev_name][/url]=] [text multi=T]errorcheck=0&mssg=3[/text] [/showif] [!] ** review is bad, send back to form ** [/!] [showif [errorcheck]=0] [switch value=[mssg]] [case value=1] [text]errortext=Sorry, the CAPTCHA entry did not pass. Please click "Go Back" to reenter that information.[/text] [/case] [case value=2] [text]errortext=You have to select a rating to complete this review. Please click "Go Back" to reenter that information.[/text] [/case] [case value=3] [text]errortext=A name is needed for this review. Please click "Go Back" to reenter that information.[/text] [/case] [/switch]

[formvariables name=pro_&exact=F] [/formvariables] [formvariables name=con_&exact=F] [/formvariables] [errortext]

[/showif] [!] ** ALL CHECKS GOOD, add the review to the database with a pending status ** [/!] [hideif [errorcheck]=0] [!] ** SET registration date/time ** [/!] [text]timestamp=[math]((([math]{[date]}[/math])-1)*86400)+([math]{[time]}[/math])[/math][/text] [!] ** get a unique ID ** [/!] [exclusivelock db=edcreview/db/globalID.db] [append db=edcreview/db/globalID.db&AUTONUMBER=G_ID][/append] [/exclusivelock] [commitdatabase db=edcrview/db/globalID.db] [exclusivelock db=edcreview/db/reviews.db] [append db=edcreview/db/reviews.db]R_ID=[lastautonumber]&R_PRODID=[url][s][/url]&R_STATUS=PENDING&R_REG_DT=[url][timestamp][/url]&R_POSTERNAME=[url][rev_name][/url]&R_POSTERSTATE=[url][rev_state][/url]&R_POSTERBODY=[url][rev_body][/url]&R_RATING=[url][rev_rating][/url]&R_IPADDRESS=[url][IPADDRESS][/url]&R_POSTERTITLE=[url][rev_title][/url][/append] [/exclusivelock] [commitdatabase db=edcreview/db/reviews.db] [text]thereviewID=[lastautonumber][/text] [exclusivelock db=edcreview/db/review_quals.db] [exclusivelock db=edcreview/db/globalID.db] [formvariables name=pro_&exact=F] [!] ** get unique ID's for each itteration ** [/!] [append db=edcreview/db/globalID.db&AUTONUMBER=G_ID][/append] [commitdatabase db=edcrview/db/globalID.db] [append db=edcreview/db/review_quals.db]QR_ID=[lastautonumber]&QR_R_ID=[url][thereviewID][/url]&QR_Q_ID=[url][getchars start=5][name][/getchars][/url][/append] [/formvariables] [formvariables name=con_&exact=F] [!] ** get unique ID's for each itteration ** [/!] [append db=edcreview/db/globalID.db&AUTONUMBER=G_ID][/append] [commitdatabase db=edcrview/db/globalID.db] [append db=edcreview/db/review_quals.db]QR_ID=[lastautonumber]&QR_R_ID=[url][thereviewID][/url]&QR_Q_ID=[url][getchars start=5][name][/getchars][/url][/append] [/formvariables] [/exclusivelock] [/exclusivelock] [commitdatabase db=edcreview/db/review_quals.db] [!]** We now need to send a notice to an admin ** [/!] [sendmail to=[admin_email]&cc=hk@mail.knifecenter.com&from=ki@knifecenter.com&subject=New Review] Hello, a new review has been made. Please follow the link below to approve or disaprove the review for posting on the live site. [new_rev_path]edcreview/index.html?page=edit&theID=[thereviewID] [/sendmail] [redirect url=[url]store_review_new.html?s=[s]&action=thanks[/url]] [!]

Test:
[listvariables] [name]=[value]
[/listvariables]
Form:
[formvariables] [name]=[value]
[/formvariables] [/!] [/hideif] [/case] [default] [!] ** New Review Form ** [/!] [include file=edcreview/inc/newreview_test.html] [/default] [/switch]