开发者

PHP - unknown character in variable after sending out HTML email

I'm developing a user registration module in phpNuke and i've encountered a problem that I have no idea what this is.

What the function is suppose to do:

  1. take all the data from user registration form, put it into a MySql table for temp users.
  2. At this point, a html email will be sent to the site admin for approval.
  3. Once the admin approves this via a link in the html email, an email will be sent to the user telling them account has been approved.


    $check_num = md5($user_email);

if($creditcard == "1"){
            $finishlink = "http://$siteurl/modules.php?name=$module_name&op=activate&username=$username&check_num=$check_num&adminApproval=2";
        }else{
     开发者_StackOverflow       $finishlink = "http://$siteurl/modules.php?name=$module_name&op=activate&username=$username&check_num=$check_num&adminApproval=1";
            $rejectlink = "http://$siteurl/modules.php?name=$module_name&op=activate&username=$username&check_num=$check_num&adminApproval=0";
        }


$from_admin = $adminmail;
$admin_header = "MIME-Version: 1.0" . "\r\n";
$admin_header .= "Content-type: text/html; charset=UTF-8" ."\r\n";
$admin_header .= "From: $from_admin" . "\r\n";
$admin_msg = "<html><head><title>Membership Request</title></head>"
."<body><b>Membership Request</b><br /><br />" 
."<table width=\"500\" border=\"0\">"
."<tr><td width=\"150\">Country/Region :</td><td width=\"350\">$region</td></tr>"
."<tr><td width=\"150\">Company Name :</td><td width=\"350\">$organization</td></tr>"
."<tr><td width=\"150\">Email Address :</td><td width=\"350\">$user_email</td></tr>"
."<tr><td width=\"150\">Name :</td><td width=\"350\">$fullname</td></tr>"
."<tr><td width=\"150\">Title :</td><td width=\"350\">$title</td></tr>"
."<tr><td width=\"150\">Telephone :</td><td width=\"350\">$phone</td></tr>"
."<tr><td width=\"150\">Referral :</td><td width=\"350\" valign=\"top\">$referral</td></tr>"
."<tr><td width=\"150\">Area of interest :</td><td width=\"350\">$areaOfInterest</td></tr>"
."<tr><td width=\"150\">Sign up for updates :</td><td width=\"350\">$newsletter</td></tr>"
//."<tr><td width=\"150\">Activate Member :</td><td width=\"350\"><a href=\"$finishlink\">YES</a>/<a href=\"$rejectlink\">NO</a></td></tr>"
.'<tr><td width="150">Activate Member :</td><td width="350"><a href="'.$finishlink.'">YES</a>&nbsp;<a href="'.$rejectlink.'">NO</a></td></tr>'
."</table></body></html>";
$admin_subj = "Membership Request from ".ucwords($fullname).",".$region;
mail($adminmail,$admin_subj,$admin_msg, $admin_header);  

Above is the script that send out the HTML email, it works perfect in the IIS environment, however when I migrated this over to a Linux server on Network Solutions, the $finishlink has "! " added in the $checksum variable. this only happens in the Linux environment.

As you can see from above, both $finishlink and $rejectlink are almost identical, the difference is &adminApproval=value at the end. And this "unknown variable" only happens in the $finishlink, the $rejectlink is fine.

an example of the error in my email, the finishlink:


http://$siteurl/modules.php?name=$module_name&op=activate&username=$username&check_num=f17cde8f32a68d06af5301!  bda67653e4&adminApproval=1">YES

rejectlink:


http://$siteurl/modules.php?name=$module_name&op=activate&username=$username&check_num=f17cde8f32a68d06af5301bda67653e4&adminApproval=0">NO

If someone would be able to point me at the right direction, I would be most grateful! I've spent more time that I should have on this.


From what I can tell your code looks fine, and there's no reason this should happen.

The generic answer is to simplify the code until you get to the exact point where it's failing. Is it correct if you don't email the body, but just display it in a browser or save to a file?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜