Ok, I am working on a method to have my app check a file on one of my domains on the internet. Then read the file and check the contents against some information in the registry.
So, look at the file on the internet, see if the registration number in the registry matches one listed as deactivated and if so notify the user and deactivate the app so they cannot make any changes.
I have all of that working fine but I also need to keep the app locked down if it has a deactivated registration number and they try to run it when they do not have an internet connection.
I can do that if I also have it set a field value that depending on its value would indicate that the app has been deactivated or not.
I also need to be able to reactivate the app by removing their registration number from the deactivated list in the file on the internet.
So, if it can find the file on the internet, test against it. If it cannot find the file then use the field value to determine if the app is deactivated or not.
I have tried " if .not. eval_valid("bad.body") " and that does not work.
I have tried reading " bad.error_code " and I get a value of 0 if it can find the file or if it cannot find the file so there is no difference between the two.
So, look at the file on the internet, see if the registration number in the registry matches one listed as deactivated and if so notify the user and deactivate the app so they cannot make any changes.
I have all of that working fine but I also need to keep the app locked down if it has a deactivated registration number and they try to run it when they do not have an internet connection.
I can do that if I also have it set a field value that depending on its value would indicate that the app has been deactivated or not.
I also need to be able to reactivate the app by removing their registration number from the deactivated list in the file on the internet.
So, if it can find the file on the internet, test against it. If it cannot find the file then use the field value to determine if the app is deactivated or not.
I have tried " if .not. eval_valid("bad.body") " and that does not work.
I have tried reading " bad.error_code " and I get a value of 0 if it can find the file or if it cannot find the file so there is no difference between the two.
Code:
bad = http_get("http://www.shopcalsoftware.com/t5/notactive.txt") if .not. eval_valid("bad.body")then 'This does not work ui_msg_box("Error","The Verification file was not downloaded from the server.",UI_STOP_SYMBOL) else dim num_regs as N num_regs = count_textblocks(bad.body,"<badnum>","</badnum>") dim item[num_regs] as P dim i as N dim this_item as C dim numstring as c dim fixed_L as C dim fixed_R as C dim bad_num as C for i = 1 to num_regs this_item = extract_string(bad.body,"<badnum>","</badnum>",i,.t.) item[i].badnum = extract_string(this_item,"<badnum>","</badnum>") 'numstring = property_to_string(item) numstring = this_item fixed_L = ltrim(numstring,"<[1]<badnum>") fixed_R = Rtrim(fixed_L,"</badnum>") bad_num = fixed_r if bad_num = vc_reg_num then vl_deactivated = .T. 'Displays a message box (style:'OK Button', image: 'Information symbol', id: 'delined_reg'). DIM SHARED declinedreg_result as N DIM SHARED declinedreg_OK_Button as L declinedreg_OK_Button = .F. title_var = "Deactivated Registration Number" message_text_var = <<%text% Your registration number has been deactivated for one or more of the following reasons. Your payment was declined or reversed. You requested a new number which deactivated this one. Please contact [email protected] if you feel this is in error. Registration Number: %text%+vc_reg_num declinedreg_result=ui_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL) 'Test to see which button on the message box was pressed.... SELECT CASE declinedreg_result = UI_OK_SELECTED declinedreg_OK_Button= .t. END SELECT sys_open("http://www.shopcalsoftware.com/helpdesk/") end if next i 'a5_show_variable(property_to_string(item)) 'Uncomment for testing if bad_num = "" then 'This does work if the file is not found but would also work if the file was empty. ui_msg_box("Error","The Verification file was not downloaded from the server.",UI_STOP_SYMBOL) end if end if
Comment