Просмотр файла phpmytourney/passwd_mailer.php

Размер файла: 3Kb
<?php
// Note, this file is now part of the phpMyTourney package as well...
/*********************************************************************
*	This file is part of the phpmyleague freeware package.
*	PhpMyLeague 
*	By : Jйrфme Poulin
*	Website : http://phpmyleague.tuxfamily.org
*	Email : [email protected] (DO NOT USE THIS FOR SUPPORT)
*	Support : http://phpmyleague.tuxfamily.org/forums/
*********************************************************************/
/*********************************************************************
*	Filename : passwd_mailer.php
*	Created by : Jйrфme Poulin 
*	Last modification : 25-10-2001@Jйrфme Poulin
*
*	Modif @ 25-10-2001 @ Jйrфme Poulin 
*		==> Final Modification Before version 1.0.0a release
*	Modif @ 15-02-2002 @ Jйrфme Poulin 
*		==> Made it phpMyTourney Compatible...	
*
*********************************************************************/
/*********************************************************************
*  You can modify this file at your ease, but don't remove any 
*  copyright information !!!  In exchange for this entirely free 
*  scripts, all i'm asking is that you give me credit for it...
*
*  If you are interested in working on phpmyleague to make it even
*  better, i strongly encourage you to join my team.  Of course, i
*  w'ont pay you any money for your work, since i'm not making any 
*  from mine, but everything you do will be credited.
*********************************************************************/

include('config.inc');
include($path_includes . 'email_body.inc');
include($path_includes . 'header.inc');

// fill the msg string to work with phpmytourney
$msg_name = "Name";
$msg_password_mailer = "Password Mailer";
$msg_mail_password = "Mail Password";
$msgerr_passwd_mailer = "An error Occured...";
$msgsucc_passwd_send = "Password sent ";

function print_passwd_mailer_form(){

	global 	$msg_name,
		$msg_password_mailer,
		$msg_mail_password,
		$name;

	print_top_form($msg_password_mailer);
	print_textbox($msg_name,"name");
	print_submit($msg_mail_password);
}

function send_passwd($name){
	global 	$msgerr_passwd_mailer,
 		$msg_password_mailer_object,
 		$msgsucc_passwd_send;

if (isset($name)){	
	//Get submited players email...
	$SQL = "SELECT name, passwd, email from ALLTOURNEY_players where upper(name) = upper('$name')";
	$result = mysql_query($SQL);
	if ($result){
		if (mysql_num_rows($result) != 0){

			$row = mysql_fetch_array($result);
			$email = $row['email'];
			$name_db = $row['name'];
			$passwd = $row['passwd'];
		
			//create the body
			$body = generate_email_body_passwd_mailer($name_db,$passwd);
		
			//Send the mail
			$error = mail($email, $msg_password_mailer_object,$body);
			if ($error){
				// Si aucune erreur retourner 0
				echo($msgsucc_passwd_send . "<b> " . $email . "</b>");
				return 1;
			}
			
		}
	}

	print_error($msgerr_passwd_mailer);
	
} // $name n'est pas rempli, ne rien faire...
return 0;
}

if (!send_passwd($name))
	print_passwd_mailer_form();

do_not_remove_please();
include($path_includes . 'footer.inc');
?>