I'm working on adding a confirmation email for the approval of new members in my fanlisting management script, but the emails aren't sending, at least not to my testing email. The script is as follows, using the mail () function ... it's most likely that I'm not using it correctly, as I've never used it before...
<?php
/*************************************
* Addict v0.1 *
* Manage.Members.php *
* ================================== *
* Copyright 2005 *
* Coded by Nite Phire *
* http://dissonance.ketsukaiten.net/ *
* nitephire@ketsukaiten.net *
*************************************/
/* Approve ()
This function moves an approved member to the proper member
table based on the listing. */
function Approve () {
GLOBAL $tableprefix;
$id = $_GET['id'];
$query = mysql_query ('SELECT * FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"');
$member = mysql_fetch_assoc ($query);
$listing = $member['listing'];
$name = $member['name'];
$country = $member['country'];
$email = $member['email'];
$hideemail = $member['hideemail'];
$website = $member['website'];
mysql_query ('INSERT INTO ' . $tableprefix . $listing . '_members SET name="' . $name . '",
country="' . $country . '",
email="' . $email . '",
hideemail="' . $hideemail . '",
website="' . $website . '"')
or die ('Could not move member to correct database.');
mysql_query ('DELETE FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"')
or die ('Could not remove from pending table.');
$getlisting = mysql_query ('SELECT name FROM ' . $tableprefix . 'addict_listings WHERE listing="' . $listing . '"');
$listinginfo = mysql_fetch_assoc ($getlisting);
$listingname = $listinginfo['name'];
$adminquery = mysql_query ('SELECT name, email FROM ' . $tableprefix . $listing . '_members WHERE id="1"');
$admininfo = mysql_fetch_assoc ($adminquery);
$adminname = $admininfo['name'];
$adminemail = $admininfo['email'];
$emailsubject = 'Added To ' . $listingname;
$emailbody = 'You have been added to the fanlisting for ' . $listingname . '.\n
\n
Name: ' . $name . '\n
Country: ' . $country . '\n
Hide Email: ' . $email . '\n
Website: ' . $website . '\n
\n
If you have any questions, email ' . $adminname . ' at ' . $adminemail . '.';
$emailheader = 'From: ' . $adminemail . '\r\n';
mail ($email, $emailsubject, $emailbody, $emailheader);
print ('Added ' . $name . ' to ' . $listingname . '.<br /><br />');
ManageMembers ();
};
/* ApproveNoURL ()
This function moves an approved member to the proper member
table based on the listing. */
function ApproveNoURL () {
GLOBAL $tableprefix;
$id = $_GET['id'];
$query = mysql_query ('SELECT * FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"');
$member = mysql_fetch_assoc ($query);
$listing = $member['listing'];
$name = $member['name'];
$country = $member['country'];
$email = $member['email'];
$hideemail = $member['hideemail'];
mysql_query ('INSERT INTO ' . $tableprefix . $listing . '_members SET name="' . $name . '",
country="' . $country . '",
email="' . $email . '",
hideemail="' . $hideemail . '",
website=""')
or die ('Could not move member to correct database.');
mysql_query ('DELETE FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"')
or die ('Could not remove from pending table.');
$getlisting = mysql_query ('SELECT name FROM ' . $tableprefix . 'addict_listings WHERE listing="' . $listing . '"');
$listinginfo = mysql_fetch_assoc ($getlisting);
$listingname = $listinginfo['name'];
$adminquery = mysql_query ('SELECT name, email FROM ' . $tableprefix . $listing . '_members WHERE id="1"');
$admininfo = mysql_fetch_assoc ($adminquery);
$adminname = $admininfo['name'];
$adminemail = $admininfo['email'];
$emailsubject = 'Added To ' . $listingname;
$emailbody = 'You have been added to the fanlisting for ' . $listingname . '.\n
\n
Name: ' . $name . '\n
Country: ' . $country . '\n
Hide Email: ' . $email . '\n
\n
If you have any questions, email ' . $adminname . ' at ' . $adminemail . '.';
$emailheader = 'From: ' . $adminemail . '\r\n';
mail ($email, $emailsubject, $emailbody, $emailheader);
print ('Added ' . $name . ' to ' . $listingname . '.<br /><br />');
ManageMembers ();
};
/* ApproveNoName ()
This function moves an approved member to the proper member
table based on the listing. */
function ApproveNoName () {
GLOBAL $tableprefix;
$id = $_GET['id'];
$query = mysql_query ('SELECT * FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"');
$member = mysql_fetch_assoc ($query);
$listing = $member['listing'];
$country = $member['country'];
$email = $member['email'];
$hideemail = $member['hideemail'];
$website = $member['website'];
mysql_query ('INSERT INTO ' . $tableprefix . $listing . '_members SET name="Anonymous",
country="' . $country . '",
email="' . $email . '",
hideemail="' . $hideemail . '",
website="' . $website . '"')
or die ('Could not move member to correct database.');
mysql_query ('DELETE FROM ' . $tableprefix . 'addict_pending WHERE id="' . $id . '"')
or die ('Could not remove from pending table.');
$getlisting = mysql_query ('SELECT name FROM ' . $tableprefix . 'addict_listings WHERE listing="' . $listing . '"');
$listinginfo = mysql_fetch_assoc ($getlisting);
$listingname = $listinginfo['name'];
$adminquery = mysql_query ('SELECT name, email FROM ' . $tableprefix . $listing . '_members WHERE id="1"');
$admininfo = mysql_fetch_assoc ($adminquery);
$adminname = $admininfo['name'];
$adminemail = $admininfo['email'];
$emailsubject = 'Added To ' . $listingname;
$emailbody = 'You have been added to the fanlisting for ' . $listingname . '.\n
\n
Name: Anonymous\n
Country: ' . $country . '\n
Hide Email: ' . $email . '\n
Website: ' . $website . '\n
\n
If you have any questions, email ' . $adminname . ' at ' . $adminemail . '.';
$emailheader = 'From: ' . $adminemail . '\r\n';
mail ($email, $emailsubject, $emailbody, $emailheader);
print ('Added ' . $name . ' to ' . $listingname . '.<br /><br />');
ManageMembers ();
};
?>
Note: I removed a function from the end of the file that doesn't cause a problem, in order to stay under the 10,000 character limit.