/    Sign up×
Community /Pin to ProfileBookmark

A problem with mail()

I’ve tried using mail() on it’s own and it only sends the mail once but in this script it sends it out twice. Could it be something to do with headers or sessions? I’m calling this script by

[code=php]header(“location: registerc.php”);[/code]

registerc.php:

[code=php]
<? session_start();
include(“connect.php”);
$p_result = mysql_query(“SELECT * FROM personal_details WHERE userid=’$user'”);
$p_row = mysql_fetch_row($p_result);
$l_result = mysql_query(“SELECT * FROM login WHERE userid=’$user'”);
$l_row = mysql_fetch_row($l_result);
include(“header.php”);
include(“tab3.php”);
$nav_title=”Open An Account”;
include(“navbar.php”);
?>
<div class=”progressbar”>
<div style=”float:left; margin-right:20px;”>1. Enter Information</div>
<div style=”float:left; margin-right:20px;”><b>2. Verify Information</b></div>
<div style=”float:left; margin-right:20px;”>3. Check Email</div>
</div>
<div class=”content”>
<h1>Verify Information</h1>
<div class=”divider”></div>
<?
$body = “Hello $p_row[1] $p_row[2], nn”;
$body .= “Click the link below to activate your Auction.Beta account: nn”;
$body .= “http://www.argyllnewmedia.co.uk/auction/validate.php?u=$l_row[0]&v=$l_row[3] nn”;
$body .= “If you’re unable to click the link above, cut and paste it into your web browser. nn”;
$body .= “Should you forget your password, you can request a new one which will be sent to this email address. nn”;
$body .= “Thank you for registering. nnn”;
$body .= “Auction.Beta Team nn”;
$from = “[email protected]”;
$mailheader = “From: $fromrn”;
mail(“$l_row[2]”,”Auction.Beta Registration”,”$body”,”$mailheader”);
echo “We just sent an email to <b>$l_row[2]</b> to verify your registration. It contains a link you’ll need to
follow to confirm your email address. Please check your email now.<br><br>”;
?>
<p>If you do not receive the message in the next 10 minutes, you can <b>
<a class=”bluelink” href=”registerc.php”>request another verification email.</a></b></p>
<p>If you’ve been waiting for over 15 minutes:
<ol>
<li>Make sure you have entered the correct email address</li>
<li>Make sure your spam filter allows email from “[email protected]”</li>
<li>Request the verification email again</li>
</ol></p>
<p>For your records, here are your account details:</p>
<div class=”inner_content”>
<div class=”mailing”><b>Address</b><br><? echo “$p_row[1] $p_row[2]”; ?></div>
<div class=”mailing”><? echo $p_row[3]; ?></div>
<div class=”mailing”><? echo $p_row[4]; ?></div>
<div class=”mailing”><? echo $p_row[5]; ?></div>
<div class=”mailing”><? echo $p_row[6]; ?></div>
<div class=”mailing”><? echo $p_row[7]; ?></div>
<div class=”mailing”><br><b>User Name</b><br><? echo $l_row[0]; ?></div>
<div class=”mailing”><br><b>Password</b><br><? echo $l_row[1]; ?></div>
<div class=”mailing”><br><b>Sectret Question</b><br><? echo $l_row[4]; ?></div>
<div class=”mailing”><br><b>Sectret Answer</b><br><? echo $l_row[5]; ?></div>
</div>
</div>
<? include(“footer.php”); ?>[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@nooor83May 10.2006 — check if you are calling the same page again using header() function..cuz you are not using any form to post the date..by just calling it by mistake..it can send another mail..

Noor
Copy linkTweet thisAlerts:
@asa_carterauthorMay 10.2006 — How do check if i'm calling the page again?
Copy linkTweet thisAlerts:
@nooor83May 10.2006 — echo some value in the page and see..
Copy linkTweet thisAlerts:
@asa_carterauthorMay 10.2006 — Hi, Just discovered that in IE 6 and FireFox it sends 1 email but in IE 7 beta 2, it sends 2. Does anyone know of a fix for this?
×

Success!

Help @asa_carter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...