Hi. I'm trying to make a ClickBank validation script in PHP. The only problem is, that they only provide it for C and Perl. I know C is much like PHP, so I was wondering if anyone would possibly be able to translate it for me?
The C code is;
Thanks
Andy
The C code is;
Code:
int valid(char *arg_seed, char *arg_cbpop, char *secret_key)
// - Pass seed, cbpop, and your key as strings.
// - Function returns 0 or 1.
{
// Copyright Keynetics Inc. Patents pending.
char a[100], w[100], q[9];
char *charsmask = "0123456789BCDEFGHJKLMNPQRSTVWXYZ";
char *p;
unsigned long int h, l, i, wi, x, y, z, n, s[10];
if (!strcmp(arg_seed, "")) { return 0; }
if (!strcmp(arg_cbpop, "")) { return 0; }
h=0x80000000; l=0x7fffffff; strcpy(q, "");
sprintf(w,"%s %s",secret_key,arg_seed);
p=w; while(*p){*p=toupper(*p);p++;}
x=y=z=17; n=strlen(w);
for(i=0;i<10;i++){s[i]=0;}
for(i=0;i<256;i++)
{ wi=((x&l)+(y&l))^((x^y)&h);
wi=(wi<<z)|(wi>>(32-z));
wi=((wi&l)+w[i%n])^(wi&h);
s[i&7]+=wi&31;
z=y&31; y=x; x=wi;
}
for (i=0; i < 8; i++) { q[i] = charsmask[s[i] & 31]; }
q[8] = '\0';
if (!strcmp(arg_cbpop, q)) { return 1; }
else { return 0; }
}
Thanks
Andy