alright, this has been driving me crazy, I go through with these forms and all the code looks perfect, but at the end it just has a big blank for the person's e-mail ($email) and I get a no reciepent specificed in e-mail error message from my server, what am i doing wrong???
The Form:
<?php
$username = $usercook;
$password = $passcook;
setcookie(usercook, $username);
setcookie(passcook, $password);
require("functions.php");
global $myrow, $fontString, $tableColor;
if(authenticate($username, $password, 10) == 1) {
echo("
<table width=450>
<tr><td>
$fontString
<b><center><font size=5>Add Member</font></center></b>
</td></tr>
<tr><td>
$fontString
<b><center><font size=2 color=#1874CD face=verdana><br>GuideLines for Recruiting</font></center></b><br>
» Tell your recruit to goto their e-mail and follow the instructions provided.<br>
» Remember to tell your recruit to log in everyday, or once every 10 days.<br>
» In their battle.net profile, please tell them to put the following information:<br><br>
<font size=1 color=#1874CD face=verdana><b> » Date Joined: <br>
» Recruited by:<br>
» Rank: <br><br>
<font color=yellow size=3 face=verdana>*</font><font color=red size=1 face=verdana>WARNING: You MUST enter both their username and e-mail, otherwise you will be DEMOTED.
<br><br></b>
</td></tr>
</table>
<table width=225>
<tr><td>
<tr><td bgcolor=$tableColor>
$fontString
<form action=addMember.php method=post>
<table border=0 cellspacing=0 cellpadding=5 width=100%>
<tr><td>
$fontString
<b>Username: </b>
</td><td width=100>
<input type=text size=15 length=20 name=user value=\"\">
</td></tr>
<tr><td>
$fontString
<b>Email:</b>
</td><td width=100>
<input type=text size=15 length=40 name=email>
</td></tr>
<tr><td colspan=2>
<center><input type=submit value=\"Add Member\"></center>
</td></tr>
</table>
</form>
</td></tr>
<tr><td colspan=2>
<center><font size=2 face=verdana><b><a href=main.php>Return to main menu</font></b></center>
</td></tr>
</table>
");
}
else {
echo("
$fontString You are not allowed to recruit, becuase you are not on the recruiting council.
<br><br><center><font size=2 face=verdana><b><a href=main.php>Return to main menu</font></b></center>
");
}
include("footer.php");
?>
The code for it, and sequel page:
// This function adds a member to the database.
function addMember($user, $email, $ip) {
global $today, $today2, $fontString, $myrow, $fontcolor;
$pass = rand(1, 100000);
$result = @mysql_query("SELECT * FROM status");
$recruiting = mysql_fetch_array($result);
$rank = getRankByNum($myrow["rank"]);
if($recruiting["recruiting"] == 0) {
$result = @mysql_query("SELECT * FROM members WHERE username = \"$user\"");
$test = @mysql_fetch_array($result);
if($test["username"] == NULL) {
$numRecruits = $myrow["recruits"] + 1;
$mailTo = $email;
$mailSubject = "Welcome to The Legion";
$mailBody = "Welcome to The Legion $user! You have been recruited by $myrow[username].
Your Name: $user
Your Password: $pass
Note: Be sure to change your password once you login to the website.
The Legion is a clan with many advancement opportunities, and a unique ranking system. We at The Legion are an online gaming community , who support Warcraft, Starcraft, and Diablo.
Once you have logged in be sure too visit [url]http://www.the-legion.net/redknight/newMember.php[/url] for a complete tutorial on The Legion.
-http://www.the-legion.net-
The Legion - \"For We Are Many\"";
$mailHeaders = "From: The Legion".
"system@the-legion.net";
mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
@mysql_query("
INSERT INTO members SET username = \"$user\", password = \"$pass\", email = \"$email\", recruiter = \"$myrow[username]\",
datejoined = \"$today\", datejoined2 = \"$today2\", logindays = \"$today\"
");
@mysql_query("
INSERT INTO log SET info = \"$rank $myrow[username] successfully recruited $user on $today2\",
ip = \"$ip\"
");
@mysql_query("
UPDATE members SET recruits = \"$numRecruits\" WHERE username = \"$myrow[username]\"
");
echo("
$fontString
Private $user has been successfully recruited. <br><br>
<b>Username:</b> $fontString $user<br>
<b>E-Mail:</b> $fontString $email
<br><br>
$fontcolor $rank $myrow[username] successfully recruited $user on $today2 $fontString- was written into log.
<center><br><font size=2 face=verdana><b><a href=main.php>Click Here to return to main menu</font></b></center>
");
}
else {
echo("
$fontString
Sorry, but that name has already been recruited. <center><br><font size=2 face=verdana><b><a href=main.php>Click Here to return to main menu</font></b></center>
");
}
}
// Else if recruiting is closed...
else {
echo("
$fontString
Recruiting has been closed. Please inform the new member and offer to add him at a later date.<br>
<center><br><font size=2 face=verdana><b><a href=main.php>Click Here to return to main menu</font></b></center>
");
}
}
All help is appreciated ahead of time 🙂.
EDIT: incase your wondering, the e-mail isn't even logged in the database, so I'm thinking its either in the form, or in the function heading...