Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ncase
Visitor

Anyone willing to share reg code creation PHP/XML script?

We have a channel running but now need to link it to our existing website:

1. Users are shown the reg screen with a registration code (we have regscreen.brs but need to know how to generate a code)
2. Users go to our website, login
3. Our site checks if he is a member or not, if so, proceed to show him/her the registration code input box
4. Then we check if the code is valid, if so, activate the token + add this code to the database
5. Then the user can watch their Roku channels during their membership period with the above method
6. If whenever the user's membership expires, we need to unregister the code

It's really steps 1 & 6 we need help with, does anyone have any experience doing this?

Many thanks!
Casey
0 Kudos
1 REPLY 1
RokuKevin
Visitor

Re: Anyone willing to share reg code creation PHP/XML script

1) A simple way pseudo code to generate regCodes:


for (i=0; i<5;i++)
{
string code = Rand.String(Rand.Next(4, 7)).ToUpper();
// Replace O and I with characters that aren't so confusing
code = code.Replace("O", "X");
code = code.Replace("I", "Y");

bool found = dbLookup("select "+code+" from registeringCodes")
if (!found)
{
dbInsert("insert into registeringCodes set regCode="+code)
break;
}
}
return code


6) When membership expires remove the Device Service Token associated with the users account from the "valid DST tokens" table used for authentication. This is the table that associates that DST with a user account.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.