Jump to content

Email Help - I want to do this better, smarter, faster!


Chezshire

Recommended Posts

Hi Everyone,

  So the code below works and it works fine, with one acceptation. I have to go and edit it all the time based on who joins or drops or goes on hiatus as a moderator on my little dumb site. I'd like to know if it's possible to replace ' mail("DITKO <[email protected]>, KIRBY <[email protected]>, GRANT <[email protected]>, WHEDON <[email protected]>", "[$siteName] New Player",' with something like 'mail("allmods.php", "[$siteName] New Player",...' and if that is possible, how would i write the little 'allmods.php' so that it would just insert in the e-mail addresses and I could just then edit the info in that vs. editing all the occurrences of it as i currently do.

 

 

Example of what I currently do:

if (!$APPROVED && !$id) {
mail("DITKO <[email protected]>, KIRBY <[email protected]>, GRANT <[email protected]>, WHEDON <[email protected]>", "[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xpg.us/home.php", "Return-Path: Ditko <[email protected]>\nErrors-To: Ditko <[email protected]>\nFrom: Ditko <[email protected]>\nReply-To: Ditko <[email protected]>\nX-Mailer: PHP/" . phpversion());
} // end if not approved

Hello Mchl, and yes i do. I can assign mod access by a pull down menu (i inherited a site and i'm learning to do PHP to maintain the site -- it's in 4.3). I'm a newb newbie newb who will be taking some classes this winter if i can find something to match my schedule :D.

 

So yes i have a database. Is it possible to do it as a database thingie? I never imaged that as an option. Please do tell, my enquiring mind wants to know!

 

Thanks for the interest!

So I imagine, that you have a table with data like that.

 

table users
user_id, username, email, moderator
1,       DITKO,     [email protected],   1
2,       other_user, [email protected],   0

 

Do you know how to query database from php?

If, not there's an example in the manual

I have a database for users called login which has:

ipLDB, id, username, password, name, email, emailprivate, dob, web, city, state, country, comments, sampleLDB, fcRequestLDB, lastmodified, dateadded, lastlogin, lastvisit, moderator, approved, moderated, yahoo, aim, icq, prefs.

 

 

 

Thank you Mchl,

 

I hope i'm understanding you correctly, I believe that below is how you are suggesting i can simplify the code and my life by using the 'SELECT username, email FROM login WHERE moderator IN ('true','super')' line to replace all the mod addresses which i have to continually replace with an action that pulls the addresses of whoever is a moderator.

 

Is that correct and is the execution below correct? (Huge thanks for opening my eyes to a completely new way of looking at PHP)

 

if (!$APPROVED && !$id) {

mail("SELECT username, email FROM login WHERE moderator IN ('true','super')", "[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xpg.us/home.php", "Return-Path: Ditko <[email protected]>\nErrors-To: Ditko <[email protected]>\nFrom: Ditko <[email protected]>\nReply-To: Ditko <[email protected]>\nX-Mailer: PHP/" . phpversion());

} // end if not approved

Thanks -- So i look at the reference and I've come up with this, I think i understand the general concept now, but i don't know that i'm writing the instruction correctly. (i'm a dweeb):

if (!$APPROVED && !$id) {
mail(;
$query = "SELECT username, email FROM login WHERE moderator IN ('true','super')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
{
"[$siteName] New Player", "A new member has submitted a profile to the $siteName website.\n\nName: $NAME\nUsername: $USERNAME\n\nVisit this URL to approve the member:\nhttp://www.xpg.us/home.php", "Return-Path: Ditko <[email protected]>\nErrors-To: Ditko <[email protected]>\nFrom: Ditko <[email protected]>\nReply-To: Ditko <[email protected]>\nX-Mailer: PHP/" . phpversion());
} // end if not approved

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.