Jump to content

[SOLVED] Standard Please Help Me Gods -


Chezshire

Recommended Posts

My goal is simple, i want to adjust the code below so that when a message is sent to the person registering/join my stupid little rpg site all those in the mod group get the e-mail. I hoped that I could just add the addresses in and tried that but I got the following error:

 

Warning: mail(): Bad parameters to mail() function, mail not sent. in /home/content/z/a/n/zanland/html/xpg/adduser.php on line 173

 

So what i need to know is how to set a mail function. Ideally i'd like to do it by setting a single group like 'Reply-To: XPG <$eModChar2>' which would be for one group of people and 'Reply-To: XPG <$eModChar1> which would be a different group. below is what i'm working with. I'm very new to this - I am reading tutorials on this stuff but it's still very confusing to me - i'm just a little notive swimming with the sharks :)

 

 

 

This Code works, but it doesn't do exactly what I want it to do.

<?php
include ("functions.php");

approveVars(array("id", "submit", "VERIFICATION", "VERCHECK"));

$verifications = array(1=>"verification",
2=>"assurance",
3=>"trustworthy",
4=>"truthfulness");


// ========= DEFINE VARIABLES

$errorText="";
$player=array();

$fields = array("id","username", "password", "password2", "name", "email", "emailprivate", "web", "city", "state", "state2", "country", "comments", "sampleLDB", "fcRequestLDB", "moderator", "approved","aim","yahoo","icq","moderated");
FOREACH ($fields as $thisField) { $player[$thisField] = ""; }

if ($id) { $player=readDatabase("SELECT *, DATE_FORMAT(dateadded, '%b %e, %Y') AS added, TO_DAYS(NOW()) - TO_DAYS(lastlogin) AS llogin FROM login where id=$id"); }

$sendNotice = "";
if (!$player["approved"]) { $sendNotice = "true"; }

if ($submit) {

// ================ IF THEY SUBMITTED THE CHANGES, MAKE THEM!

$patterns = array ("/([^\n\r\f])[\n\r\f]+([^\n\r\f])/");
$replace = array ("\\1\n\\2");

FOREACH ($fields as $thisField) {
$THISFIELD = strtoupper($thisField);

if (isset($_POST{$THISFIELD})) { ${$THISFIELD} = $_POST[$THISFIELD]; } else { ${$THISFIELD} = ""; }
${$THISFIELD} = preg_replace ($patterns, $replace, ${$THISFIELD});
} // end FOREACH

if (!$id) {

if ($PASSWORD != $PASSWORD2 || !$PASSWORD) { $errorText="You must choose a password and you must enter it twice for accuracy. Please go back and submit the form again."; }

if (preg_match("/[ \(\)\+\.]/",$AIM) || preg_match("/[ \(\)\+\.]/",$YAHOO)) { $errorText="Please only put the screen name in the AIM and Yahoo fields, no comments or special characters."; }

$existTest = readDatabase("SELECT * FROM login WHERE username=\"$USERNAME\" || email = \"$EMAIL\"",$db);

if ($existTest["email"] == $EMAIL) { $errorText = "That email address is already in use, and there's only one account allowed per person!<br>Please go back and submit the form again after making changes."; }

if ($existTest["username"] == $USERNAME) { $errorText = "That username is already in use. You'll have to choose a different one, I'm afraid!<br>Please go back and submit the form again after making changes."; }

} // end if no ID

if (!$USERNAME) { //if they didn't a name for their profile...
$errorText="You must choose a username for this profile.<br>Please go back and submit the form again after making changes.";
} // end if no NAME

if (!$NAME) { //if they didn't a name for their profile...
$errorText="You must enter a name or nickname.<br>Please go back and submit the form again after making changes.";
} // end if no NAME

if ($login != $id && !$moderator) { //If they're NOT ALLOWED
$errorText="You cannot edit another's profile unless you have moderator privileges.";
} // end if no privileges

if ($moderator != "super" && $id != $login && $player["moderator"]) { //If they're NOT ALLOWED
$errorText="You do not have the privileges to edit this profile; it belongs to a moderator.";
} // end if no privileges

if ((strtolower($VERIFICATION) != $verifications[$VERCHECK] || !$VERIFICATION) && !$moderator) { //if they didn't get the verification right and they're not a moderator...
$errorText="You did not enter the "Verification" text correctly.</p>";
} // end if no VERIFICATION

if ($errorText) { errorPage($errorText); }

if ($STATE2) { $STATE = $STATE2; }

$WEB = preg_replace ("/http:\/\//","",$WEB);

if (!$PASSWORD) { $PASSWORD = $player["password"]; }
if (!$MODERATED) { $MODERATED = $player["password"]; }

if (!$id) {
$sql = "INSERT INTO login (username,
password,
moderated,
name,
email,
emailprivate,
web,
city,
state,
country,
comments,
sampleLDB, 
fcRequestLDB,
lastmodified,
dateadded,
moderator,
aim,
yahoo,
icq,
approved) VALUES(\"$USERNAME\",
\"$PASSWORD\",
\"$MODERATED\",
\"$NAME\",
\"$EMAIL\",
\"$EMAILPRIVATE\",
\"$WEB\",
\"$CITY\",
\"$STATE\",
\"$COUNTRY\",
\"$COMMENTS\",
\"$SAMPLELDB\", 
\"$FCREQUESTLDB\",
NOW(),
NOW(),
\"$MODERATOR\",
\"$AIM\",
\"$YAHOO\",
\"$ICQ\",
\"$APPROVED\")";
$action = "Submitted";
$action2 = '<h2>Your member profile has been submitted! Once it\'s approved by a moderator, you will have access to the the site. <a href="/home.php">Click here to return to the main ' . $siteName . ' page.</a></h2>';
} else {
$sql = "UPDATE login SET username=\"$USERNAME\",
password=\"$PASSWORD\",
moderated=\"$MODERATED\",
name=\"$NAME\",
email=\"$EMAIL\",
emailprivate=\"$EMAILPRIVATE\",
web=\"$WEB\",
city=\"$CITY\",
state=\"$STATE\",
country=\"$COUNTRY\",
comments=\"$COMMENTS\",
sampleLDB=\"$SAMPLELDB\", 
fcRequestLDB=\"$FCREQUESTLDB\",
moderator=\"$MODERATOR\",
aim=\"$AIM\",
yahoo=\"$YAHOO\",
icq=\"$ICQ\",
approved=\"$APPROVED\"
WHERE id=$id";
$action = "Updated";
$action2 = '<h2>Member profile has been updated and is active immediately!</h2>';
} // end if $id

if ($APPROVED == "REMOVE") {
$sql="DELETE FROM login WHERE id=$id";
$action = "Deleted";
$action2 = '<h2>Member profile has been deleted from the database.</h2>';
} // end if removing

if ($id && !$moderator && $id != $login) {
$action = "Not Modified";
$action2 = "<h2>You really shouldn't be monkeying around with this unless you're a moderator.<br>Go on, scoot!</h2>";
} elseif ($id && $moderator=="true" && $id != $login && $player["moderator"]) {
$action = "Not Modified";
$action2 = "<h2>You really shouldn't be monkeying around with the profile of another moderator.<br>Go on, scoot!</h2>";
} else {
$result = mysql_query($sql);
} // end if password

echo "<!-- SQL: $sql -->\n";

$pageTitle="Profile " . $action . " Successfully!";
include ("header.php");

if (mysql_error()) { echo "<!-- ".mysql_errno(). " : (line 130) " . mysql_error() . " -->\n\n";
} else {

if (!$APPROVED && !$id) {
mail("Ditko <[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

if ($APPROVED && $sendNotice && $EMAIL) {
mail("$EMAIL", "[$siteName] Welcome to $siteName!", "Welcome, $NAME, to $siteName!\n\nThis notice is to inform you that your membership has been approved, and you may now log in to $siteName and begin work on your Character Bio. To do this, please first review the character creation rules at http://www.xpg.us/rules/characters.php. Once you've read this section you can begin the process of creatng an actual character by going to www.xpg.us/cerebra.php and clicking on the  big, bold, blue 'Click Here' text below the main image gallery. You can also begin the process by going directly to 'http://www.xpg.us/cerebra/edit.php?submit=true' to start the character creation process. When you are finished working on your Character Bio, click the submit button at the bottom of the character creation form and we will review it for approval. You can usually expect a notice regarding character approval within 2 days.\n\nVisit this URL and click the \"Authenticate\" button to log in:\nhttp://www.xpg.us\n\nUsername: $USERNAME\nPassword: $PASSWORD", "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 first time approved

} // end if error

if (!$id) { $id = mysql_insert_id(); }

 

I thought that this would work, but i get an error in stead. In the above code, I dropped the follow extra e-mail address into it: > "Byrne <[email protected]>", <

As shown below, it didn't work. Instead i got an error.

if (!$APPROVED && !$id) {
mail("Ditko <[email protected]>", "Byrne <[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

 

 

Link to comment
https://forums.phpfreaks.com/topic/112697-solved-standard-please-help-me-gods/
Share on other sites

The mail() function takes at most 5 parameters. The first parameter is the "To" address list. You need to include all of the addresses inside the quotes:

<?php
if (!$APPROVED && !$id) {
mail("Ditko <[email protected]>, Byrne <[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
?>

 

Ken

how about storing all the email address into a variable and then putting the variable as the parameter in the mail function?

 

What bendude15 says above, thats exactly what i want to do, i just don't understand how to. I know i put it in my functions.php file. But how i set it up with edress1, edress2, edress3, etc. thats what i don't understand. Please if you can help i'll worship at your PHP alter ;)

 

Thank you

Why do you want to turn it into a function? Just put the string where ever you need it. No sense in make more work.

 

As for the includes, you can put the string in the include file and it will work. Instead of asking the questions and waiting for an answer, try it. If what you try doesn't work, then ask.

 

Ken

I'd love to have it in various spots because we have different people who join and help  run the game as moderators and the leave so it'd be nice to have one spot where i could edit the contract edress that are used through out the site. So making it a function would be awesome. I'm just not sure how i do that.

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.