Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 9.36 KB | None | 0 0
  1. <%
  2.  
  3. 'func_admin_login(target_username, target_password)
  4. Private function func_admin_login(target_username, target_password)
  5.     dim login_data
  6.     Set login_data = Server.CreateObject("ADODB.RecordSet")
  7.     login_data.Open "SELECT * FROM ul_user_list WHERE ul_username = '"& target_username &"' AND ul_password = '"& target_password &"' ", Connect, adopenstatic, adlockreadonly
  8.     if login_data.RecordCount = 1 then
  9.         func_admin_login = "success"
  10.     else
  11.         func_admin_login = "failed"
  12.     end if
  13. end function
  14.  
  15. 'func_date_format
  16. Private function func_date_format(date_input, target_length)
  17.     dim date_info
  18.     date_info = date_input
  19.     if len(date_info) = target_length then
  20.         func_date_format = date_info
  21.         exit function
  22.     else if target_length = "2" then
  23.         if len(date_info) = 2 then
  24.             func_date_format = date_info
  25.         else if len(date_info) < 2 then
  26.             date_info = "0"&date_info
  27.             func_date_format = date_info
  28.         else
  29.             date_info = "01"
  30.             func_date_format = date_info
  31.         end if
  32.         end if
  33.         exit function
  34.     else if target_length = "4" then
  35.         if len(date_info) <> 4 then
  36.             date_info = year(date)
  37.             func_date_format = date_info
  38.         else
  39.             func_date_format = date_info
  40.         end if
  41.         exit function
  42.     end if
  43.     end if
  44.     end if 
  45. end function
  46.  
  47. 'func_date_get_day
  48. Private function func_date_get_day(serial_input)
  49.     if len(serial_input) <> 8 then
  50.         func_date_get_day = day(date)
  51.     else
  52.         func_date_get_day = right(serial_input, 2)
  53.     end if
  54. end function
  55.  
  56. 'func_date_get_month
  57. Private function func_date_get_month(serial_input)
  58.     if len(serial_input) <> 8 then
  59.         func_date_get_month = month(date)
  60.     else
  61.         func_date_get_month = mid(serial_input, 5, 2)
  62.     end if
  63. end function
  64.  
  65. 'func_date_get_year
  66. Private function func_date_get_year(serial_input)
  67.     if len(serial_input) <> 8 then
  68.         func_date_get_year = int(year(date))
  69.     else
  70.         func_date_get_year = int(left(serial_input, 4))
  71.     end if
  72. end function
  73.  
  74. 'func_date_make_serial
  75. Private function func_date_make_serial(date_input)
  76.     Dim datearrayln, datearray, date_day, date_month, date_year
  77.     datearray = split(date_input, "/", -1)
  78.         datearrayln = Ubound(datearray)
  79.         if datearrayln = 2 then
  80.             date_month = func_date_format(int(datearray(0)), "2")
  81.             date_day = func_date_format(int(datearray(1)), "2")
  82.             date_year = func_date_format(int(datearray(2)), "4")
  83.             func_date_make_serial = date_year & date_month & date_day
  84.         else
  85.             func_date_make_serial = func_date_format(year(date), "4") & func_date_format(month(date), "2") & func_date_format(day(date), "2")
  86.         end if
  87. end function
  88.  
  89. 'func_date_serial_2_regular
  90. Private function func_date_serial_2_regular(serial_input)
  91.     if len(serial_input) <> 8 then
  92.         func_date_serial_2_regular = func_date_format(month(date), "2") & "/" & func_date_format(day(date), "2") & "/" & func_date_format(year(date), "4")
  93.     else
  94.         func_date_serial_2_regular = func_date_get_month(serial_input) & "/" & func_date_get_day(serial_input) & "/" & func_date_get_year(serial_input)
  95.     end if
  96. end function
  97.  
  98. 'func_date_serial_2_regular_long
  99. Private function func_date_serial_2_regular_long(serial_input)
  100.     if len(serial_input) <> 8 then
  101.         func_date_serial_2_regular_long = func_date_format(month(date), "2") & "/" & func_date_format(day(date), "2") & "/" & func_date_format(year(date), "4")
  102.     else
  103.         func_date_serial_2_regular_long = FormatDateTime(func_date_serial_2_regular(serial_input), vbLongDate)
  104.     end if
  105. end function
  106.  
  107.  
  108. 'func_onlynumbers
  109. Private function func_onlynumbers(input_string)
  110.     dim regEx, strTagLess
  111.     strTagless = func_clearhtml(input_string)
  112.     set regEx = New RegExp
  113.     regEx.IgnoreCase = True
  114.     regEx.Global = True
  115.     regEx.Pattern = "([^0-9])"
  116.     strTagLess = regEx.Replace(strTagLess, "")
  117.     set regEx = nothing
  118.     if strTagLess = "" then
  119.         strTagLess = "0"
  120.     else
  121.     end if
  122.     func_onlynumbers = strTagLess
  123. end function
  124.  
  125. 'func_currency
  126. Private function func_currency(input_string)
  127.     dim regEx, strTagLess
  128.     strTagless = func_clearhtml(input_string)
  129.     set regEx = New RegExp
  130.     regEx.IgnoreCase = True
  131.     regEx.Global = True
  132.     regEx.Pattern = "([^0-9\s\.\,])"
  133.     strTagLess = regEx.Replace(strTagLess, "")
  134.     set regEx = nothing
  135.     if strTagLess = "" then
  136.         strTagLess = "0"
  137.     else
  138.     end if
  139.     func_currency = strTagLess
  140. end function
  141.  
  142. 'func_clearhtml(strHTML)
  143. Private function func_clearhtml(strHTML)
  144.    
  145.         dim regEx, strTagLess
  146.         strTagless = trim(strHTML)
  147.         if strTagLess = "" then
  148.         else
  149.             'strTagless = replace(strTagless, "`", "&rsquo;")
  150.             strTagless = replace(strTagless, "'", "`")         
  151.                 set regEx = New RegExp
  152.                 regEx.IgnoreCase = True
  153.                 regEx.Global = True
  154.                 regEx.Pattern = "<[^>]*>"
  155.                 if tb_allow_html = "no" then
  156.                     strTagLess = regEx.Replace(strTagLess, "")     
  157.                 else
  158.                 end if         
  159.         end if
  160.         set regEx = nothing
  161.         func_clearhtml = trim(strTagLess)  
  162. end function
  163.  
  164. 'func_no_html(strHTML)
  165. Private function func_no_html(strHTML)
  166.         dim regEx, strTagLess
  167.         strTagless = strHTML
  168.         if strTagLess = "" then
  169.         else
  170.             'strTagless = replace(strTagless, "`", "&rsquo;")
  171.             strTagless = replace(strTagless, "'", "`")         
  172.                 set regEx = New RegExp
  173.                 regEx.IgnoreCase = True
  174.                 regEx.Global = True
  175.                 regEx.Pattern = "<[^>]*>"
  176.                 strTagLess = regEx.Replace(strTagLess, "")         
  177.         end if
  178.         set regEx = nothing
  179.         func_no_html = trim(strTagLess)
  180. end function
  181.  
  182. 'HTMLDecode(sText)
  183. Private function HTMLDecode(sText)
  184.     Dim I
  185.     sText = Replace(sText, """, Chr(34))
  186.     sText = Replace(sText, "<" , Chr(60))
  187.     sText = Replace(sText, ">" , Chr(62))
  188.     sText = Replace(sText, "&" , Chr(38))
  189.     sText = Replace(sText, "&nbsp;", Chr(32))
  190.     For I = 1 to 255
  191.     sText = Replace(sText, "&#" & I & ";", Chr(I))
  192.     Next
  193.     HTMLDecode = sText
  194. End Function
  195.  
  196. 'func_tags_select_numeric_range
  197. Private function func_tags_select_numeric_range(start_num, end_num, default_entry, desired_name)
  198.     if start_num = "" OR end_num = "" OR start_num >= end_num then
  199.         func_tags_select_numeric_range = "<font color='red'>Failure -- Bad Input</font>"
  200.     else
  201.         Dim http_stream, counter
  202.         http_stream = ""
  203.         counter = int(start_num)
  204.             if desired_name = "" then
  205.                 desired_name = "form_numeric_range"
  206.             else
  207.             end if             
  208.                 http_stream = "<select name='" & desired_name & "'>"
  209.                     do while counter <= int(end_num)
  210.                         http_stream = http_stream & "<option "
  211.                             if counter = int(default_entry) then
  212.                                 http_stream = http_stream & "selected "
  213.                             else
  214.                             end if
  215.                         if len(counter) = 1 OR len(counter) = 2 then
  216.                             counter = func_date_format(counter, "2")
  217.                         else
  218.                             counter = func_date_format(counter, "4")
  219.                         end if
  220.                         http_stream = http_stream & "value='" & counter & "'>" & counter & "</option>"
  221.                     counter = counter+1
  222.                     loop
  223.                     http_stream = http_stream & "</select>"
  224.         func_tags_select_numeric_range = http_stream
  225.     end if 
  226. end function
  227.  
  228. 'func_tags_select_pic(target_folder, default_entry, desired_name)
  229. Private function func_tags_select_pic(target_folder, default_entry, desired_name)
  230.     if target_folder = "" then
  231.         response.Redirect("error.asp?err=func_tags_select_pic Function -- Bad target_folder")
  232.     else if default_entry = "" then
  233.         response.Redirect("error.asp?err=func_tags_select_pic Function -- Bad default_entry")
  234.     else if desired_name = "" then
  235.         response.Redirect("error.asp?err=func_tags_select_pic Function -- Bad desired_name")
  236.     else
  237.         Dim filesys, pic_data, http_stream, work_folder, work_path, work_files, file
  238.             work_path = Server.Mappath("/custom/" & target_folder)
  239.         Set filesys = CreateObject("scripting.filesystemobject")
  240.             If filesys.FolderExists(work_path) = True Then             
  241.                 Set work_folder = filesys.GetFolder(work_path)
  242.                     Set work_files = work_folder.files
  243.                         if desired_name = "" then
  244.                             desired_name = "form_picture"
  245.                         else
  246.                         end if
  247.                     http_stream = "<select name='" & desired_name & "'>"
  248.                         for each file in work_files
  249.                             http_stream = http_stream & "<option "
  250.                             if default_entry = file.Name then
  251.                                 http_stream = http_stream & "selected "
  252.                             else
  253.                             end if
  254.                         http_stream = http_stream & "value='" & file.Name & "'>" & file.Name & "</option>"
  255.                         next
  256.                     http_stream = http_stream & "</select>"
  257.                 Set work_folder = nothing
  258.                 Set work_files = nothing
  259.                 Set filesys = nothing
  260.             else
  261.                 response.Redirect("error.asp?err=func_tags_select_pic Function -- target_folder doesnt exist --- " & work_path)
  262.             end if
  263.         func_tags_select_pic = http_stream         
  264.     end if
  265.     end if
  266.     end if
  267. end function
  268.  
  269. 'func_tags_spacer
  270. Private function func_tags_spacer(width, height)
  271.     Dim http_stream
  272.         http_stream = "<img height='" & height & "' width='" & width & "' src='images/spacer.gif' class='invisible_img' alt='" & tb_status & "'>"
  273.         func_tags_spacer = http_stream         
  274. end function
  275.  
  276. 'func_show_html(strHTML)
  277. Private function func_show_html(strHTML)
  278.     dim strTagLess
  279.     strTagless = trim(strHTML)
  280.     if tb_convert_breaks = "yes" then
  281.         strTagless = replace(strTagless, vbcrlf, "<br>")
  282.     else
  283.     end if
  284.     if len(strTagless) > 0 then
  285.      strTagless = replace(strTagless, "�", "'")
  286.      func_show_html = trim(strTagLess)
  287.     end if
  288. end function
  289.  
  290. 'func_show_code(strHTML)
  291. Private function func_show_code(strHTML)
  292.     dim strTagLess
  293.     strTagless = trim(strHTML)
  294.     if tb_convert_breaks = "yes" then
  295.         strTagless = replace(strTagless, "<br>", vbcrlf)
  296.     else
  297.     end if
  298.     if len(strTagless) > 0 then
  299.         strTagless = replace(strTagless, "'", "�")
  300.     else
  301.         strTagless = strTagless
  302.     end if
  303.     func_show_code = trim(strTagLess)
  304. end function
  305.  
  306. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement