Location: PHPKode > projects > MySQLauction > libphp/recallpwd.php
<?php
  ######################################################################
  # 
  # In accordance with the GPL, this copyright notice MUST remain
  # intact:
  #
  # MySQLauction Release Version 0.1.0 (021001)
  # Copyright (C) 2002 High Sierra Networks, Inc.
  # http://www.servers-r-us.com
  # hide@address.com
  #
  ######################################################################
  #
  # 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.
  #
  ######################################################################

  ######################################################################
  #
  # Written by Jorge Gonzalez - Athena Soft, S.A. de C.V.
  # http://www.athenasoft.com.mx
  # hide@address.com
  #
  # Name: recallpwd.php
  # Date: 021001
  # Purpose:
  # This script checks a username and if correct, emails the user's
  # password.
  # Restrictions:
  # None.
  # Change history:
  # 021001 First version.
  ######################################################################

  function recallpwd($email) {
    include("auction.conf.php");
    if($email) {
      if($link = mysql_connect($DBHOST,$DBUSR,$DBPWRD)){
        mysql_select_db($DBNAME) or die($mysql_error());
        $result = mysql_query("
          SELECT password
          FROM user
          WHERE email='$email' ")
        or die($mysql_error);
        $numrows = mysql_num_rows($result);
        if($numrows == 1) {
          $row = mysql_fetch_array($result) or die($mysql_error);
          $password = $row[password];
          include("$LIBDIR/auction.conf.lang.php");

          $to = "$email";
          $headers = "From: $SUPPORTBOX\n";
          $headers .= "Reply-to: $SUPPORTBOX\n";
          $headers .= "X-Sender: $SUPPORTBOX\n";
          $headers .= "X-Mailer: PHP at MySQLauction\n";
          $headers .= "Return-Path: $SUPPORTBOX\n";
          $subject = "$L_RECALLSUBJECT";
          $message = "$L_RECALLTXT\n";

          mail($to,$subject,$message,$headers);

          mysql_close($link);
          return(true);}
        else {
          mysql_close($link);
          return(false);}}
      else {
        die($mysql_error);}}
    else {
      return(false);}}
?>
Return current item: MySQLauction