4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP: Does anyone seen the error in this script?
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
fredmatrack
Junior WebHelper
Junior WebHelper


Joined: 27 Feb 2002
Posts: 24
Location: Hoboken (Antwerpen, Belgium)

PostPosted: Tue Feb 25, 2003 3:40 pm (14 years, 8 months ago) Reply with QuoteBack to Top

Is there somebody who finds the error in this script. Most of the time it works, but sometimes it goes wrong.
The data are always correctly writed in the gegevens.txt file. When I receive the mail with the attachement, there are words missing.


Eg.
On the server, in the file gegevens.txt:
Hxxxx Norbert 234 rue Gustave - 59000Rijsel (Frankrijk) buitenland 00xxx2030xx41 xxxxxxxxxx PTI Condédreef 10 8500 Kortrijk Secundair onderwijs ja


I get in the file, attached to the mail:
Hxxxx Norbert 234 rue Gustave - 59000Rijsel (Frankrijk) buitenland 00xxx2030xx41 xxxxxxxxxx PTI Condédreef 10 8500 K

This is the script I use. Sorry for my english!
Code:

<?php
include('taal.php');
if(!isset($taal)){$taal="nl";}
?>

<html>
<head>
<title><?php echo $woord[$taal][0]; ?></title>
</head>

<body bgcolor="#FFFFFF">

<?php
$filename = 'gegevens.txt';

if (empty($voornaam) OR empty($achternaam) OR empty($straat_nr) OR empty($postcode) OR empty($gemeente) OR empty($telefoon)){
 echo "<font color=\"#FF0000\" size=\"2\" face=\"Verdana\">";
 echo "<b>";
 echo $woord[$taal][24];
 echo ":</b></font>";
 echo "<font color=\"#000000\" size=\"2\" face=\"Verdana\">";
 echo "<br>&&&&<a href=\"JavaScript:history.back()\">";
 echo $woord[$taal][25];
 echo "</a>";
 echo "</font>";
}

else{
 if(empty($inteam)){$inteam="nee";}

 $inhoud = "$achternaam\t$voornaam\t$straat_nr\t$postcode\t$gemeente\t$provincie\t$telefoon
\t$fax\t$gsm\t$email\t$school\t$straat_nr_school\t$postcode_school\t$gemeente_school
\t$onderwijstype\t$vakgebied1\t$vakgebied2\t$inteam";

 if (is_writable($filename)){
    if (!$handle = fopen($filename, 'w')){
         echo "Kan het bestand ($filename) niet openen";
         exit;}
    if (!fwrite($handle, $inhoud)){
        echo "Kan niet schrijven in ($filename)";
        exit;}
     
    fclose($handle);


$from = "Teamsite";
$to = "geert@fredmatrack.com,info@teamnl.be";
$subject= "Nieuw TEAM lid";
$header = "From: " . $from . "\n"; 
$type = "text/plain";
$encoding = "8bit";     
$body = "Bijgevoegd vindt u de gegevens van het nieuwe TEAM lid\n\n $inhoud";
   

    $fp = @fopen($filename,"r");
    $file_content = fread($fp,filesize($filename)); 
    if (!$fp){ 
      echo "Ik kon het databestand niet openen...<br>\n"; 
      echo "Uw inschrijving is NIET verzonden<br><br>"; 
      echo "Probeer later nog eens!"; 
      exit;} 
   

    $boundary = strtoupper(md5(uniqid(time()))); 

    $header .= "MIME-version: 1.0\n"; 
    $header .= "Content-Type: multipart/mixed;\n"; 
    $header .= "\tboundary= " . $boundary . "\n\n"; 

    $header .= "This is a multi-part message in MIME format.\n\n"; 

    $header .= "--" . $boundary . "\n"; 
    $header .= "Content-Type: " . $ct . ";\n"; 
    $header .= "\tcharset=\"iso-8859-1\"\n"; 
    $header .= "Content-Transfer-Encoding: quoted-printable\n\n"; 

    $header .=  $body . "\n\n"; 

    $header .= "--" . $boundary . "\n"; 
    $header .= "Content-Type: " . $type . "\n"; 
    $header .= "Content-Transfer-Encoding: " . $encoding . "\n"; 
    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\n\n"; 

    $header .= $file_content . "\n\n"; 
    $header .= "--" . $boundary . "--"; 
   

 if(@mail($to,$subject,"",$header)){ 
    echo "Uw inschrijving werd verzonden!";} 
 else{ 
    echo "Er liep iets fout in het verzenden van de mail, probeer nogmaals!";}






 } 
 else{ echo "Het bestand $filename is niet writable"; }
}
?>
</body>
</html>
OfflineView User's ProfileFind all posts by fredmatrackSend Personal MessageSend emailVisit Poster's WebsiteMSN MessengerICQ Number
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Tue Feb 25, 2003 4:32 pm (14 years, 8 months ago) Reply with QuoteBack to Top

My guess is that the problem lies here:

Code:
    $file_content = fread($fp,filesize($filename));


Maybe replacing that with this would work (not an expert on file manipulation - sorry Sad)

Code:
    $file_content = fread($fp,filesize($filename)+1000);


Let us know.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
fredmatrack
Junior WebHelper
Junior WebHelper


Joined: 27 Feb 2002
Posts: 24
Location: Hoboken (Antwerpen, Belgium)

PostPosted: Tue Feb 25, 2003 7:39 pm (14 years, 7 months ago) Reply with QuoteBack to Top

It seems to work. I hope it really does.
If not, I will let you know.

Thanks!
OfflineView User's ProfileFind all posts by fredmatrackSend Personal MessageSend emailVisit Poster's WebsiteMSN MessengerICQ Number
Himansh
Junior WebHelper
Junior WebHelper


Joined: 23 Feb 2015
Posts: 1
Location: Australia

PostPosted: Mon Feb 23, 2015 8:58 am (2 years, 7 months ago) Reply with QuoteBack to Top

This is exceptionally decent and fair post....You shook posting it...Thanks a considerable measure for posting it...!!

________________________________
We provide guarantee to Testking compass test gmat with online exam hesi practice test training itil and you can also get best quality Palm Beach Atlantic University mcat along with Northwestern University mcat for your guaranteed success.
OfflineView User's ProfileFind all posts by HimanshSend Personal Message
fifa15coins
Junior WebHelper
Junior WebHelper


Joined: 21 Apr 2015
Posts: 1

PostPosted: Mon Jun 01, 2015 2:34 am (2 years, 4 months ago) Reply with QuoteBack to Top

Samuel Eto’o’s Fifa 15 Coins for XBOX alarming ‘Old Man’, such as accepting your abiding and alarming to the abode while biting Jose Mourinho for sly asides about the ageing process, is engaged. Luis Suarez’s ancillary the hug manoeuvres are aswell accessible and you can even accomplish Fabio Borini’s ‘hand bite’. You may as able-bodied seeing as he won’t be accepting the adventitious while austere beyond Anfield on the Luton frequent. http://www.fifa2coins.com/
OfflineView User's ProfileFind all posts by fifa15coinsSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.088114 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme