Jump to content

Recommended Posts

Where would that go in my code

 

<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

send_email("no-reply@texasfluorescents.com", "danielg@fleco.com", 
$subject , 
$messageee);
?>

$message = implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));
print $message;

function fmessage($key, $value) {
   return "$key: $value";
}

 

Outputs something like:

username: energysuperstore09

password: energy

email_address: energy@superstore.com

Here is the form

 

<form action="confirm.php" method="post" name="form1" class="dress"><br /><br /><br /><br />
            <label for="repnumber"><span class="algin"><span class="login">Rep Number</span></span></label>
          <input name="repnumber" type="text" class="rep" size="5" />
<br />
            <label for="fname"><span class="algin"><span class="login">First Name</span></span></label>
            <input name="fname" type="text" class="field" />
          <br>
            <label for="lname" class="li1"><span class="algin"><span class="login">Last Name</span></span></label>
            <input name="lname" type="text" class="field" />
          <br>
            <label for="cname"><span class="algin"><span class="login">Company Name</span></span></label>
            <input name="cname" type="text" class="field" />
          <br>
            <label for="phone"><span class="algin"><span class="login">Phone Number</span></span></label>
            <input name="phone" type="text" class="field" />
          <br>
            <label for="email"><span class="algin"><span class="login">Email Address</span></span></label>
          <input name="email" type="text" class="field" />
          <br>
            <span class="formtext">You will use your email address as your username            </span>
            <br><br><label for="password"><span class="algin"><span class="login">Password</span></span></label>
          <input name="pass" type="password" class="field" />
          <br>
            <label for="password" class="login"><span class="algin">Verify Password</span></label>
        <input name="pass2" type="password" class="field" /><br><br />
            <input type="image" src="images/register-button.jpg" class="login-submit" value="Regsiter"/>
            
          <br>
            <br>
  <br />
	    <br />
	    <br />
	    <br />
        <br />
	    <br />
  </form>

 

and here is the script that processes the from

 

<?php

$email = $_POST['email'];
$password = $_POST['pass'];
$password2 = $_POST['pass2'];

@mysql_connect("205.178.146.75","fleco2008","xxxxxx") or die("Error: unable to connect to database");
@mysql_select_db("test09");

$result = mysql_query("SELECT * FROM `loginreg` WHERE `email`='$email'");
if (mysql_num_rows($result) != 0) {
die("Another account is already using that email");
}
if ($password != $password2) {
die("The two passwords did not match");
}
$password = md5($password);
mysql_query("INSERT INTO `loginreg` (`email`, `password`, `fname`, `lname`, `repnumber`, `cname`, `phone`) VALUES ('$email', '$password', '$fname', '$lname', '$repnumber', '$cname', '$phone')") or die(mysql_error());
header("Location: /account-pending.php");

?>

and here is the code that is placed in the head of my register page

 

<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers,$repnumber,$fname,$lname,$cname,$phone,$email) ) {
} else {
}
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

send_email("no-reply@texasfluorescents.com", "danielg@fleco.com", 
$subject , 
$messageee);
?>

You can't do:

 

mail($to,$subject,$message,$headers,$repnumber,$fname,$lname,$cname,$phone,$email)

 

The proper syntax is:

 

bool mail  ( string $to  , string $subject  , string $message  [, string $additional_headers  [, string $additional_parameters  ]] )

 

..
$dashedline = str_repeat('-', 70);
$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));
send_email('no-reply@texasfluorescents.com, danielg@fleco.com', $subject, $messageee)

function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}

function fmessage($key, $value) {
   return "$key: $value";
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

$dashedline = str_repeat('-', 70);
$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));
send_email('no-reply@texasfluorescents.com, danielg@fleco.com', $subject, $messageee);

I get an error when I am use this script "Only variables can be passed by reference"

 

on line 211 which is the following

 

$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));

I am getting an error on line 30

 

$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));

 

 

Here is the full code

 

<?php
function send_email($from, $to, $subject, $message){
$headers = "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
$headers .= "Content-type: text/html\r\n"; 

if (mail($to,$subject,$message,$headers) ) {
} else {
}
}

function fmessage($key, $value) {
   return "$key: $value";
}


$messageee = "";
$subject = "Someone has Registered for Distributor Login";
$messageee .= "<html><body>";
$messageee .= "<b>Please inform Daniel.<br></b>";
$messageee .= "<br>";
$messageee .= "<br>Daniel will send an email to user once account is activated.<br>";
$messageee .= "<br>If you need assistance with your login information please contact Daniel Garvin at danielg@fleco.com";
$messageee .= "<br><br>";
$messageee .= "<br>Regards, <br>Texas Fluorescents";
$messageee .= "</body></html>";

$dashedline = str_repeat('-', 70);
$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', array_keys($_POST), array_values($_POST)));
send_email('no-reply@texasfluorescents.com, danielg@fleco.com', $subject, $messageee);

?>

$keys = array_keys($_POST);
$values = array_keys($_POST);
$messageee .= "\r\n\r\n$dashedline\r\nForm Information:\r\n\r\n" . implode("\r\n", array_walk('fmessage', $keys, $values));

 

Please apply this first.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.