How to protect my EA with multiple account number
long login=AccountInfoInteger(ACCOUNT_LOGIN);try this
try this
Would you please explain me a little, where and how to use this code?
int liveAccountNumber = 535621; int liveAccountNumber2 = 737213; int start() { if(( AccountNumber() == liveAccountNumber) || ( AccountNumber() == liveAccountNumber2)) { Print("Account Number recognized.thanks"); Alert("Account Number recognized."); return(1); } else { Print("Account Number not recognized."); Alert("Account Number not recognized,Contact EA author to validate account"); return(-1); } }Your if logic is incorrect. I've made the changes for you.
Your if logic is incorrect. I've made the changes for you.
There is a better way to do this... Add as few or many account numbers to an array with an initialization list and then iterate over the list to find a matching account number.
void OnStart() { int my_acc = (int)AccountInfoInteger(ACCOUNT_LOGIN); //--- add as many accounts as necessary -- example- int auth_accounts[] = { 123456, //live 1 123457, //live 2 123458, //demos 123459, 123444 }; bool is_auth = false; for(int i=0;i<ArraySize(auth_accounts);i++) if(auth_accounts[i] == my_acc) is_auth = true; if(!is_auth) Print("Account not authorized!"); else Print("Your account is authorized"); }
There is a better way to do this... Add as few or many account numbers to an array with an initialization list and then iterate over the list to find a matching account number.
i like this - I'm still on my quest to find a way to extract from a CSV via drive.google.com
Love that this works with account numbers :)
i like this - I'm still on my quest to find a way to extract from a CSV via drive.google.com
Love that this works with account numbers :)
Hello, I am trying to do in this way but it is not working for the second or multiple account number. I want to get a code that will allow my EA only for some accounts. If the account number do not match between two or more accounts then EA will not work.
Please, help me to do this. Advice me the correct code.Thanks in advanced.