<% '************************************************************************* ' ASP Scripting: ' Filename: handler_read_promo_code.asp ' Written by: Wilbert Madarang ' Date: Jun 21, 2003 '************************************************************************* ' Description: This function retrieves and keeps the Promo Code. '************************************************************************* ' Revision History: '************************************************************************* %> <% '***************************** ' MAIN CODE '***************************** Dim strPromoCode 'Obtain Promo Code strPromoCode = Request("promo_code") Session("MyPromoCode") = strPromoCode 'Validate Whether this is a Valid Promo Code Call ValidatePromoCode( strPromoCode ) 'Redirect to Originating Page Response.Redirect Request.ServerVariables("HTTP_REFERER") '************************************************************ ' Function: ValidatePromoCode ' Description: Validates Whether the Promo Code is Valid or Not ' Date: Jun 21, 2003 ' Written By: Wilbert Madarang '************************************************************ ' SIDE-EFFECTS: Updates the Session Variables '************************************************************ Function ValidatePromoCode( strPromoCode ) Dim strSQL, rs 'Validate Free Shipping: From constants.asp File If ( strPromoCode = PROMO_CODE_FREE_SHIPPING ) Then Session( "MyPromoCodeIsValid") = True Session( "MyPromoCodeFreeShipping" ) = True Session("MyPromoCodeType") = "" Session("MyPromoCodeValue") = 0 Else 'Validate Promo Code from the Database Call openDataConnection() strSQL = "select * from dirPromoCode where promoCodeLabel='" & strPromoCode & "'" Set rs = dataConnection.Execute( strSQL ) Call closeDataConnection() 'If PromoCode is Found If rs.EOF AND rs.BOF Then Else Session( "MyPromoCodeIsValid") = True Session( "MyPromoCodeFreeShipping" ) = False Session( "MyPromoCodeType" ) = rs.Fields( "promoCodeType" ) Session( "MyPromoCodeValue" ) = rs.Fields( "promoCodeValue" ) End If End If End Function %>