Hi
Please let me give code.
I want to know how a admin can generate activation key code. so that admin can send an email with key code to
download songs after receiving payment from customer through bank transfer.
That key code need to expire after 2 days.
How it can be done.

Member Avatar for diafol

A bit like movieberry? You need this to be automated - without the intervention of an admin.
Generating a key is easy enough. Have a look at some hash functions.

Below function will return random string.

<?
    function getRandomString($length=6) 
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
        $string = '';   
        for($i = 0; $i < $length; $i++) 
        {
            $string .= $characters[mt_rand(0, strlen($characters))];
        }
        return $string;
    }
    echo getRandomString(10);
    ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.