Location: PHPKode > projects > Radio404 > radio404/htdocs/getpin.php
<?php
/********************************************************************
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General
Public License along with this program; if not, write to
the Free Software Foundation, Inc.,
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
********************************************************************/

/**
 * Purpose: allow forgetful users to have their PIN # sent to their email
 */

require("../sql.inc");

if(isset($_POST['email']))
{
        $sql = "SELECT id FROM users WHERE email='" . addslashes($_POST['email']) . "'";
        $result = sql_query($sql);

        if(count($result) > 0)
        {
                mail($_POST['email'], "Your Radio404 PIN", $result[0]->id);

                echo "Your PIN Number is ".$result[0]->id." you have also recieved an email with this information.";
        }
        else
        {
                echo "We could not find a user with that email address.";
        }
}
else
{
        echo "<form action='getpin.php' method='post'>Your Email: <input type='text' name='email' /><br /><input type='submit' value='Search' /></form>";
}

?>
Return current item: Radio404