Jump to content
jonny

Problema contact form - dau (chiar dau) o bere :-)

Recommended Posts

Posted

Se da urmatorul site - Yami TakeAway . Am o problema la contact, dupa ce completez formularul, dau send, apare ca se trimite cu succes, dar pe mail nu imi vine mesajul propriu-zis (e gol), imi vine doar emailul si subiectul.

Tema folosita este Pluto.

Rog pe cineva serios, care are timp, si vrea sa bea o bere, sa-mi dea un mesaj privat cu un id de messenger ceva, si daca reuseste sa imi rezolve problema se rezolva si cu berea.

jonny

  • Moderators
Posted (edited)

Ar trebui sa iti mearga acum. Scriptul iti lua mesajul din GET, dar formularul iti trimite datele prin POST.

    <?php
/**
* Template Name: Contact
* The main template file for display contact page.
*
* @package WordPress
*/

session_start();

/**
* if not submit form
**/
if(!isset($_GET['your_name']))
{
?>

<?php
if(!isset($hide_header) OR !$hide_header)
{
?>
<script type="text/javascript">
$j(document).ready(function(){
setTimeout(function() {
$j('#map_contact').css('visibility', 'visible');
$j('#homepage_wrapper').animate({width: 'toggle'},{
duration: 500,
complete: function() {
$j('#homepage_wrapper').fadeIn();
$j('#homepage_wrapper').children('.inner').fadeIn('slow');
$j('#corner_right').css('display', 'block');
$j('#corner_right_bottom').css('display', 'block');
$j('#slidecaption').css('visibility', 'visible');
$j('#supersized-loader').css({display: 'none'});
$j('#slidecaption').css('visibility', 'hidden');
}
});
}, 2000);
});
</script>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/screen.css" type="text/css" media="screen" />
<?php
if(isset($_SESSION['pp_skin']))
{
$pp_skin = $_SESSION['pp_skin'];
}
else
{
$pp_skin = get_option('pp_skin');
}

if($pp_skin == 'dark')
{
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/dark.css" type="text/css" media="screen" />
<?php
}
elseif($pp_skin == 'transparent')
{
?>
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/transparent.css" type="text/css" media="screen" />
<?php
}
?>
<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri(); ?>/js/custom.js"></script>

<div id="page_content_wrapper">
<div class="inner">
<div class="sidebar_content">

<h1 class="page_header"><?php the_title(); ?></h1><hr/>

<?php the_content(); ?>

<!-- Begin main content -->
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

<?php do_shortcode(the_content()); ?><br class="clear"/><br/>

<?php endwhile; ?>

<?php
$target_url = curPageURL();
}
else
{
$obj_contact = get_page($current_page_id);
$target_url = $obj_contact->guid;
$pp_contact_content = $obj_contact->post_content;

echo do_shortcode($pp_contact_content).'<br class="clear"/><br/>';
}
?>

<form id="contact_form" method="post" action="<?php echo $target_url; ?>">
<p>
<input id="your_name" name="your_name" type="text" title="<?php _e( 'Name', THEMEDOMAIN ); ?>*" style="width:94%"/>
</p>
<p style="margin-top:20px">
<input id="email" name="email" type="text" title="<?php _e( 'Email', THEMEDOMAIN ); ?>*" style="width:94%"/>
</p>
<p style="margin-top:20px">
<input id="phone" name="phone" type="text" title="<?php _e( 'Phone', THEMEDOMAIN ); ?>*" style="width:94%"/>
</p>
<p style="margin-top:20px">
<textarea id="message" name="message" style="width:94%" title="<?php _e( 'Message', THEMEDOMAIN ); ?>*"></textarea>
</p>
<p style="margin-top:30px"><br/>
<input type="submit" value="<?php _e( 'Send Message', THEMEDOMAIN ); ?>"/>
</p>
</form>
<div id="reponse_msg"></div>
<br/><br/>
<!-- End main content -->

<?php
if(!isset($hide_header) OR !$hide_header)
{
?>
</div>
</div>
</div>

<?php
get_footer();

} // En if not hide header
}

//if submit form
else
{

/*
|--------------------------------------------------------------------------
| Mailer module
|--------------------------------------------------------------------------
|
| These module are used when sending email from contact form
|
*/

//Get your email address
$contact_email = get_option('pp_contact_email');

//Enter your email address, email from contact form will send to this addresss. Please enter inside quotes ('myemail@email.com')
define('DEST_EMAIL', $contact_email);

//Change email subject to something more meaningful
define('SUBJECT_EMAIL', __( 'Email from contact form', THEMEDOMAIN ));

//Thankyou message when message sent
define('THANKYOU_MESSAGE', __( 'Thank you! We will get back to you as soon as possible', THEMEDOMAIN ));

//Error message when message can't send
define('ERROR_MESSAGE', __( 'Oops! something went wrong, please try to submit later.', THEMEDOMAIN ));


/*
|
| Begin sending mail
|
*/

$from_name = $_GET['your_name'];
$from_email = $_GET['email'];

$mime_boundary_1 = md5(time());
$mime_boundary_2 = "1_".$mime_boundary_1;
$mail_sent = false;

# Common Headers
$headers = "";
$headers .= 'From: '.$from_name.'<'.$from_email.'>'.PHP_EOL;
$headers .= 'Reply-To: '.$from_name.'<'.$from_email.'>'.PHP_EOL;
$headers .= 'Return-Path: '.$from_name.'<'.$from_email.'>'.PHP_EOL; // these two to set reply address
$headers .= "Message-ID: <".$now."webmaster@".$_SERVER['SERVER_NAME'].">";
$headers .= "X-Mailer: PHP v".phpversion().PHP_EOL; // These two to help avoid spam-filters

# Boundry for marking the split & Multitype Headers
$headers .= 'MIME-Version: 1.0'.PHP_EOL;
$headers .= "Content-Type: multipart/mixed;".PHP_EOL;
$headers .= " boundary=\"".$mime_boundary_1."\"".PHP_EOL;

$message = 'Name: '.$from_name.PHP_EOL;
$message.= 'Email: '.$from_email.PHP_EOL.PHP_EOL;
$message.= 'Phone: '.$_POST['phone'].PHP_EOL.PHP_EOL;
$message.= 'Message: '.PHP_EOL.$_POST['message'];


if(!empty($from_name) && !empty($from_email) && !empty($message))
{
mail(DEST_EMAIL, SUBJECT_EMAIL, $message, $headers);

echo THANKYOU_MESSAGE;

exit;
}
else
{
echo ERROR_MESSAGE;

exit;
}

/*
|
| End sending mail
|
*/
}

?>

Edited by Dragos

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.   Paste as plain text instead

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