Location: PHPKode > projects > HypatiaDB > hypatiadb/email.php
<?php

/* HypatiaDB - Easy to use web-based database management system. Written primarily in PHP using  * the MySQL database engine.
 * Copyright (C) 2004 Simon D'Alfonso
 *
 * 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
 */


include("common_db.php");

$name = $_GET['name'];
$mail_to = $_GET['email'];

mysql_connect($host, $admin_username, $admin_password) or die("couldn't connect");
mysql_selectdb(HypatiaDB) or die("couldn't select database HypatiaDB");

$query = "SELECT password
          FROM users
          WHERE username = '$name' AND email = '$email'";

($result = mysql_query($query)) or die ("Query unsuccesful");

while($row = mysql_fetch_array($result)) 
{
   $password = $row['password'];      
}

?>

<HTML>
<HEAD>
<TITLE>Email Retrieval Confirmation</TITLE>
</HEAD>

<BODY>

<?php
/*
$mail_subject = "Your HypatiaDB password";
$mail_body = "Here is your password $name: $password";

if(mail($mail_to, $mail_subject, $mail_body))
{
   echo "<P align='center'>Your password is being automatically sent to the email address you 
         specified</P>";
   echo "<P align='center'><A HREF='index.php'>Back to login page</A>";
}
else 
   echo "<P align='center'>Failed to send your password via email. Please re-try"</P>;
*/

?>

</BODY>
</HTML>
Return current item: HypatiaDB