View Full Version : Tokens?

03-17-2010, 10:30 PM
Hello CodingForums!

At the moment, I am setting up a script that allows people to register a cpanel email automatically. Got that working lovely! Its just, I now want to add a extra on that will stop others from registering an email(people without my consent)

So basically, I want to make it so I set a big list of tokens in a file, or strings and then I would give one out. The user would then use it and get their email address, and the token being deleted from the file it was called from.

Anyone got any ideas?

04-04-2010, 06:20 PM

04-04-2010, 06:30 PM
$string = file_get_contents($tokenfile);

if (strpos($string, $token) !== false)
$string = str_replace($token, '', $string);
file_put_contents($tokenfile, $string);
[valid token code]
[invalid token code]

That's assuming you have PHP5+. PHP4, you would need to use fopen etc.