Killerclown
Gebruiker
- Lid geworden
- 30 dec 2007
- Berichten
- 181
Goeiemorgen,
Ik heb een lastig probleem maar ik zie de oplossing niet.
Ik heb een script (van het internet geplukt) om bij de email een attachment bij te voegen.
Het originele script van het internet werkt perfect. Ik heb het aangepast naar de layout van de site en dan doet hij rare dingen.
Wanneer ik een mail stuur met bijlage, wordt deze de eerste keer niet verzonden. Wanneer ik de webpagina refresh wordt deze wel verzonden. Beu probleem.
Of...
Wanneer ik een mail stuur met bijlage, wordt deze de eerste keer niet verzonden. Wanneer ik een nieuwe mail verzend, krijg ik de eerste binnen en de 2de weer niet.
Blijkbaar wordt er dus met 1 mail achterstand verzonden.
Ik zit me suf te zoeken maar ik zie het probleem niet en ik vind de oplossing niet.
Iemand een idee waarom dit raar doet?
Originele code van het internet
Aangepaste code naar weblayout
Alvast dank.
Ik heb een lastig probleem maar ik zie de oplossing niet.
Ik heb een script (van het internet geplukt) om bij de email een attachment bij te voegen.
Het originele script van het internet werkt perfect. Ik heb het aangepast naar de layout van de site en dan doet hij rare dingen.
Wanneer ik een mail stuur met bijlage, wordt deze de eerste keer niet verzonden. Wanneer ik de webpagina refresh wordt deze wel verzonden. Beu probleem.
Of...
Wanneer ik een mail stuur met bijlage, wordt deze de eerste keer niet verzonden. Wanneer ik een nieuwe mail verzend, krijg ik de eerste binnen en de 2de weer niet.
Blijkbaar wordt er dus met 1 mail achterstand verzonden.
Ik zit me suf te zoeken maar ik zie het probleem niet en ik vind de oplossing niet.
Iemand een idee waarom dit raar doet?
Originele code van het internet
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Download PHP mail with attachment.</title>
<link rel="stylesheet" media="screen" href="calendar.css" />
</head>
<body>
<div class="maindiv">
<div><?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
// Set the "To" email address
$to="myemail@website.com";
//Subject of the mail
$subject="Join Us E-mail with Resume attachment";
// Get the sender's name and email address plug them a variable to be used later
$from = stripslashes($_POST['name'])."<".stripslashes($_POST['email']).">";
// Check for empty fields
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
// Get all the values from input
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
// Check the email address
if (!eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address))
{
$errors .= "\n Error: Invalid email address";
}
// Now Generate a random string to be used as the boundary marker
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
// Now Store the file information to a variables for easier access
$tmp_name = $_FILES['filename']['tmp_name'];
$type = $_FILES['filename']['type'];
$file_name = $_FILES['filename']['name'];
$size = $_FILES['filename']['size'];
// Now here we setting up the message of the mail
$message = "\n\n Name: $name \n\n Email: $email_address \n\nMessage: \n\n $message \n\nHere is your file: $file_name";
// Check if the upload succeded, the file will exist
if (file_exists($tmp_name)){
// Check to make sure that it is an uploaded file and not a system file
if(is_uploaded_file($tmp_name)){
// Now Open the file for a binary read
$file = fopen($tmp_name,'rb');
// Now read the file content into a variable
$data = fread($file,filesize($tmp_name));
// close the file
fclose($file);
// Now we need to encode it and split it into acceptable length lines
$data = chunk_split(base64_encode($data));
}
// Now we'll build the message headers
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
// Next, we'll build the message body note that we insert two dashes in front of the MIME boundary when we use it
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Now we'll insert a boundary to indicate we're starting the attachment we have to specify the content type, file name, and disposition as an attachment, then add the file content and set another boundary to indicate that the end of the file has been reached
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$file_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
// Thats all.. Now we need to send this mail... :)
if (@mail($to, $subject, $message, $headers))
{
?>
<div><center><h1>Mail Sent successfully !!</h1></center></div>
<?php
}else
{
?>
<div><center>
<h1>Error !! Unable to send Mail..</h1></center></div>
<?php
}
}
}
?></div>
<div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<div>
<p><label for="email">Email:</label><br>
<input id="email" name="email" type="text" />
</p>
<p>
<label for="tele">Upload Your Resume:</label><br>
<input id="tele" name="filename" type="file" />
</p>
<p>
<label for="message">Message:<br></label>
<textarea cols="71" rows="5" name="message"></textarea>
</p>
</div>
<input class="formbtn" type="submit" value="Send Message" />
</form>
</div>
</div>
</body>
</html>
Aangepaste code naar weblayout
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBegintemplate="/Templates/algemeen.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<link rel="stylesheet" href="../../../menu/style.css" type="text/css" media="screen"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>The Riddle Box: Contact us...</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script src="../../../Scripts/swfobject_modified.js" type="text/javascript"></script>
<link href="../../../css/backgroundimage.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.style5 {font-size: 10px}
</style>
<link href="../../../css/body.css" rel="stylesheet" type="text/css" />
<link href="../../../css/link_img.css" rel="stylesheet" type="text/css" />
<link href="../../../css/link.css" rel="stylesheet" type="text/css" />
<link href="../../../css/title.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
background-image: url(../../../images/titles/black-grey-stone-wall.jpg);
background-repeat: repeat;
}
</style>
</head>
<body>
<table width="900" border="0" align="center">
<tr>
<th height="160" colspan="3" bgcolor="#999" scope="col"><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="900" height="156">
<param name="movie" value="../../../images/titles/riddlebox_title.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
<param name="expressinstall" value="../../../Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../../../images/titles/riddlebox_title.swf" width="900" height="156">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="../../../Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<img src="../../../images/titles/header_no_flash.jpg" alt="" width="900" height="156" />
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object></th>
</tr>
<tr>
<th width="164" height="20" scope="row"> </th>
<td width="20" height="20"> </td>
<td width="700" height="20"> </td>
</tr>
<tr>
<th height="452" valign="top" scope="row">
<ul class="ac-menu">
<li id="Home"> <a href="../../home.htm">Home</a></li>
<li id="Short News"> <a href="../../news/news.htm">Short News</a></li>
</ul>
<ul class="ac-menu2">
<li id="Biography"> <a href="#Biography">Biography</a>
<ul class="sub-menu3">
<li><a href="../../biography/violent_j.htm">Violent J</a></li>
<li><a href="../../biography/shaggy_2_dope.htm">Shaggy 2 Dope</a></li>
<li><a href="../../biography/relatives_home.htm">Relatives</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id=" Books"> <a href="../../books/books_home.htm"> Books</a></li>
</ul>
<ul class="ac-menu2">
<li id="Comic Books"> <a href="#Comic Books">Comic Books</a>
<ul class="sub-menu3">
<li><a href="../../comic_books/comic_books_home.htm">Overview</a></li>
<li><a href="../../comic_books/comic_books_years_home.htm">Years</a></li>
<li><a href="../../comic_books/the_pendulum_home.htm">The Pendulum</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id="Dictionary"> <a href="../../dictionary/dictionary.htm">Dictionary</a></li>
</ul>
<ul class="ac-menu2">
<li id="Discography"> <a href="#Discography">Discography</a>
<ul class="sub-menu10">
<li><a href="../../discography/discography_home.htm">Overview</a></li>
<li><a href="../../discography/years/years_home.htm">Years</a></li>
<li><a href="../../discography/forgotten_freshness/forgotten_freshness_home.htm">Forgotten Freshness</a></li>
<li><a href="../../discography/hallowicked/hallowicked_home.htm">Hallowicked</a></li>
<li><a href="../../discography/inner_city_posse/inner_city_posse_home.htm">Inner City Posse</a></li>
<li><a href="../../discography/joker_cards/joker_cards_home.htm">Joker Cards</a></li>
<li><a href="../../discography/psychopathics_from_outer_space/psychopathics_from_outer_space_home.htm">Psychopathics F.O.S.</a></li>
<li><a href="../../discography/the_pendulum/the_pendulum_home.htm">The Pendulum</a></li>
<li><a href="../../discography/violent_j/violent_j_home.htm">Violent J</a></li>
<li><a href="../../discography/shaggy_2_dope/shaggy_2_dope_home.htm">Shaggy 2 Dope</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id="Faygo"> <a href="../../faygo/faygo_home.htm">Faygo</a></li>
</ul>
<ul class="ac-menu2">
<li id="Filmography"> <a href="#Filmography">Filmography</a>
<ul class="sub-menu6">
<li><a href="../../filmography/filmography_home.htm">Overview</a></li>
<li><a href="../../filmography/years_home.htm">Years</a></li>
<li><a href="../../filmography/juggalo_champion****_wrestling/juggalo_champion****_wrestling_home.htm">J.C.W.</a></li>
<li><a href="../../filmography/jcw_live/jcw_live_home.htm">J.C.W. Live PPV</a></li>
<li><a href="../../filmography/slamtv/slam_tv_home.htm">Slam TV</a></li>
<li><a href="../../filmography/stranglemania/stranglemania_home.htm">Stranglemania</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id="Games"> <a href="../../games/games_home.htm">Games</a></li>
</ul>
<ul class="ac-menu2">
<li id="GOTJ"> <a href="#GOTJ">G.O.T.J.</a>
<ul class="sub-menu4">
<li><a href="../../gathering/the_gathering_history.htm">History</a></li>
<li><a href="../../gathering/the_gathering_editions.htm">Editions</a></li>
<li><a href="../../gathering/the_gathering_pictures.htm">Pictures</a></li>
<li><a href="../../gathering/the_gathering_movies.htm">Movies</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id="Hatchetgear"> <a href="../../hatchetgear/hatchetgear.htm">Hatchetgear</a></li>
</ul>
<ul class="ac-menu2">
<li id="Juggalos"> <a href="#Juggalos">Juggalos</a>
<ul class="sub-menu3">
<li><a href="../fans/fans_home.htm">Fans</a></li>
<li><a href="../juggalo_day/juggalo_day_home.htm">Juggalo Day</a></li>
<li><a href="../fbi_lawsuit/fbi_lawsuit_home.htm">FBI Lawsuit</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu2">
<li id="Media"> <a href="#Media">Media</a>
<ul class="sub-menu3">
<li><a href="../../media/pictures.htm">Pictures</a></li>
<li><a href="../../media/music.htm">Music</a></li>
<li><a href="../../media/videos.htm">Video</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu2">
<li id="Tour"> <a href="#Tour">Tour / Shows</a>
<ul class="sub-menu4">
<li><a href="#Tour">Years</a></li>
<li><a href="../../shows/big_ballas_xmas_party/big_ballas_xmas_party_home.html">Big Ballas X-mas</a></li>
<li><a href="../../shows/hallowicked/hallowicked_home.html">Hallowicked</a></li>
<li><a href="../../shows/hatchet_attacks/hatchet_attacks_home.html">Hatchet Attacks</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu2">
<li id="Wrestling"> <a href="#Wrestling">Wrestling</a>
<ul class="sub-menu8">
<li><a href="../../wrestling/backyard_wrestling/backyard_wrestling_home.htm">Backyard Wrestling</a></li>
<li><a href="../../wrestling/events/events_home.html">Events</a></li>
<li><a href="../../wrestling/juggalo_championship_wrestling/juggalo_championship_wrestling_home.htm">J.C.W.</a></li>
<li><a href="../../wrestling/juggalo_world_order.htm">J.W.O</a></li>
<li><a href="../../wrestling/juggalo_arena.htm">Juggalo Arena</a></li>
<li><a href="../../wrestling/slam_tv/slam_tv.htm">Slam TV</a></li>
<li><a href="../../wrestling/titles/jcw_titles_home.htm">Titles</a></li>
<li><a href="../../wrestling/wrestlers/wrestlers_home.htm">Wrestlers</a></li>
</ul>
</li>
</ul>
<ul class="ac-menu">
<li id="Thanks to..."> <a href="../../thanks_to/thanks_to_home.htm">Thanks to...</a></li>
<li id="Contact"> <a href="../../contact/mailform.php">Contact</a></li>
</ul></th>
<td> </td>
<td class="backgroundimage"><!-- InstanceBeginEditable name="algemeen" -->
<table width="698" border="0">
<tr>
<td width="18"> </td>
<td width="648"> </td>
<td width="18"> </td>
</tr>
<tr>
<td> </td>
<td>
</head>
<body>
<div class="maindiv">
<div><?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
// Set the "To" email address
$to="myemail@website.com";
//Subject of the mail
$subject="Join Us E-mail with Resume attachment";
// Get the sender's name and email address plug them a variable to be used later
$from = stripslashes($_POST['name'])."<".stripslashes($_POST['email']).">";
// Check for empty fields
if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
// Get all the values from input
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
// Check the email address
if (!eregi( "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email_address))
{
$errors .= "\n Error: Invalid email address";
}
// Now Generate a random string to be used as the boundary marker
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
// Now Store the file information to a variables for easier access
$tmp_name = $_FILES['filename']['tmp_name'];
$type = $_FILES['filename']['type'];
$file_name = $_FILES['filename']['name'];
$size = $_FILES['filename']['size'];
// Now here we setting up the message of the mail
$message = "\n\n Name: $name \n\n Email: $email_address \n\nMessage: \n\n $message \n\nHere is your file: $file_name";
// Check if the upload succeded, the file will exist
if (file_exists($tmp_name)){
// Check to make sure that it is an uploaded file and not a system file
if(is_uploaded_file($tmp_name)){
// Now Open the file for a binary read
$file = fopen($tmp_name,'rb');
// Now read the file content into a variable
$data = fread($file,filesize($tmp_name));
// close the file
fclose($file);
// Now we need to encode it and split it into acceptable length lines
$data = chunk_split(base64_encode($data));
}
// Now we'll build the message headers
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
// Next, we'll build the message body note that we insert two dashes in front of the MIME boundary when we use it
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Now we'll insert a boundary to indicate we're starting the attachment we have to specify the content type, file name, and disposition as an attachment, then add the file content and set another boundary to indicate that the end of the file has been reached
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$file_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
// Thats all.. Now we need to send this mail... :)
if (@mail($to, $subject, $message, $headers))
{
?>
<div><center><h1>Mail Sent successfully !!</h1></center></div>
<?php
}else
{
?>
<div><center>
<h1>Error !! Unable to send Mail..</h1></center></div>
<?php
}
}
}
?></div>
<div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<div>
<p><label for="email">Email:</label><br>
<input id="email" name="email" type="text" />
</p>
<p>
<label for="tele">Upload Your Resume:</label><br>
<input id="tele" name="filename" type="file" />
</p>
<p>
<label for="message">Message:<br></label>
<textarea cols="71" rows="5" name="message"></textarea>
</p>
</div>
<input class="formbtn" type="submit" value="Send Message" />
</form>
</div>
</div>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<th height="20" valign="top" scope="row"> </th>
<td> </td>
<td align=center>* Created by Clowndesign *</td>
</tr>
</table>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
<!-- InstanceEnd --></html>
Alvast dank.