Hi there,
hope you can help me.
I´m coding on a domainnameregistration service, wich saves the formfields in a database. once the entries are done , the pdf will be generated with the values from the database. the dpf-file will then be written and saved into the directory. now i want to send the file as attachment to the registrator. therefore i use a script wich is "class CMailFile".
My problem(e.g file named 240.pdf):
when i specify the filename like this "$filename = "240.pdf";" it works and i can open the attachment, but
when i specify the name dynamicly, like "$filename = "$data[id].pdf";" (which is the same filename(240.pdf) the attachment is 3 Kb smaller than the file on the server and acrobat cant open the file.
###########Here the source#################
function makepdf() {
global $id, $datas,$ansprechpartner,$domainname,$domainname1,$domainname2,$domainname3,$domainname4,$domainname5,$ripe,$coco,$anrede,$vorname,$nachname,$titel,$firma,$anschrift1,$anschrift2,$staat,$plz,$ort,$bundesland,$telefon,$telefax,$emailadminc,$anrede_billing,$vorname_billing,$nachname_billing,$titel_billing,$firma_billing,$anschrift1_billing,$anschrift2_billing,$staat_billing,$plz_billing,$ort_billing,$bundesland_billing,$telefon_billing,$telefax_billing,$email_billing,$bank,$konto,$blz,$kontoinhaber,$IP,$REMOTE_ADDR,$bestellnr,$check1,$check2,$check3,$check4,$check5,$namebesteller,$emailbesteller,$anredebesteller,$online,$server,$account,$domainzahl,$traffic,$webspace,$emails,$plattform,$setup,$miete,$rechnungsturnus,$features,$file,$ext,$pdfnr;
dbconnect();
$queryid = "SELECT LAST_INSERT_ID()";
$resultid = mysql_query($queryid);
if ($resultid) {
$nrows = mysql_num_rows($resultid);
$row = mysql_fetch_row($resultid);
$lastID = $row[0];
$result = mysql_query ("SELECT id,account,domainzahl,traffic,webspace,emails,plattform,setup,miete,rechnungsturnus,domain1,domain2,domain3,domain4,domain5,ripeadminc,corenicadminc,anredeadminc,vornameadminc,nachnameadminc,titeladminc,firmaadminc,strasseadminc,strasse2adminc,staatadminc,plzadminc,ortadminc,landadminc,teladminc,faxadminc,emailadminc,anredebilling,vornamebilling,nachnamebilling,titelbilling,firmabilling,strassebilling,strasse2billing,staatbilling,plzbilling,ortbilling,landbilling,telbilling,faxbilling,emailbilling,bank,blz,kto,ktoinhaber,timestamp,ip,bestellnr,namebesteller,emailbesteller,anredebesteller,online,server,account,domainzahl,traffic,webspace,emails,plattform,setup,miete,rechnungsturnus,features FROM dombest where id = $lastID");
$datas = mysql_fetch_array($result);
$fp = fopen("".$datas["id"].".pdf", "w");
$pdf = PDF_open($fp);
pdf_begin_page($pdf, 595, 842);
$pdfimage = pdf_open_image_file($pdf, "jpeg", "logobest.jpg");
pdf_place_image($pdf, $pdfimage, 0, 600, 0.24);
$pdfimage = pdf_open_image_file($pdf, "jpeg", "hosting.jpg");
pdf_place_image($pdf, $pdfimage, 320, 360, 0.6);
pdf_set_info_author($pdf, "Mario Liebener");
PDF_set_info_title($pdf, "Limado New Media Domainbestellung");
PDF_set_info_author($pdf, "Mario Liebener");
pdf_set_info_creator($pdf, "Mario Liebener");
pdf_set_info_subject($pdf, "Domainbestellung");
PDF_add_outline($pdf, "Item ". $datas["id"]);
pdf_set_font($pdf, "Helvetica" , 10, winansi);
pdf_set_text_rendering($pdf, 0);
pdf_show_xy($pdf, "Limado New Media Domainbestellung",20,580);
PDF_show_xy($pdf, "Bestellnr : ". $datas["bestellnr"], 450, 580);
$text =
"Hiermit bestelle ich das angegebene Web-Paket ".$datas["account"]." zum monatlichen Pauschalpreis von $miete.".
"\n\n".
"Angaben über das Web-Paket ".$datas["account"].":".
"\n______________________________________".
"\n\n".
"".$datas["domainzahl"]." Domainnamen\n".
"".$datas["webspace"]." Webspace\n".
"".$datas["emails"]." eMail-Konten\n".
"Datentransfervolumnen ".$datas["traffic"]."\n".
"Voller FTP-Zugang\n".
"einmalige Einrichtungspauschale ".$datas["setup"]."\n".
"Monatsmiete ".$datas["miete"]."\n".
"Abrechnung ".$datas["rechnungsturnus"]."\n".
"".$datas["features"]."\n".
"\n".
"Der Vertrag über dieses Web-Paket kommt unter Einbeziehung der AGB's von Limado New Media zustande (www.limado.com), die uns vorliegen und hiermit akzeptiert werden.".
"\n\n".
"Angaben über die Domainnamen:".
"\n___________________________________".
"\n\n".
"Hauptdomain: ".$datas["domain1"]."\n".
"Subdomains: ".$datas["domain2"]."\n".
" ".$datas["domain3"]."\n".
" ".$datas["domain4"]."\n".
" ".$datas["domain5"]."".
"\n\n".
"Angaben über den Domaininhaber ( Admin-C):".
"\n___________________________________".
"\n\n".
"Firma: ".$datas["firmaadminc"]."\n".
"Vorname, Nachname: ".$datas["titeladminc"]." ".$datas["vornameadminc"]." ".$datas["nachnameadminc"]."\n".
"Anschrift: ".$datas["strasseadminc"]."\n".
" ".$datas["strasse2adminc"]."\n".
"Plz, Ort: ".$datas["plzadminc"]." ".$datas["ortadminc"]."\n".
"\n\n".
"Angaben über den Rechnungsempfänger:".
"\n______________________________".
"\n\n".
"Firma: ".$datas["firmabilling"]."\n".
"Vorname, Nachname: ".$datas["titelbilling"]." ".$datas["vornamebilling"]." ".$datas["nachnamebilling"]."\n".
"Anschrift: ".$datas["strassebilling"]."\n".
" ".$datas["strasse2billing"]."\n".
"Plz, Ort: ".$datas["plzbilling"]." ".$datas["ortbilling"]."".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n".
"\n\nAngaben zur Bankverbindung:".
"\n______________________________".
"\n\n".
"Institut: ".$datas["bank"]."\n".
"Kontonummer: ".$datas["kto"]."\n".
"Bankleitzahl: ".$datas["blz"]."\n".
"Kontoinhaber: ".$datas["ktoinhaber"]."\n".
"\n\n".
"Bitte ziehen Sie die vorgenannten Beträge jeweils bei Fälligkeit von unserem Konto ein. Wir sind einverstanden, dass Entgelte für das Web - Paket ".$datas["account"]." für ".$datas["rechnungsturnus"]." eingezogen werden. Teileinlösungen werden im Lastschrifteinzugsverfahren nicht vorgenommen.".
"\n\n\n\n".
"____________________________________________\n".
"Datum Unterschrift Kontoinhaber".
"\n\n".
"\n\n\n".
"_______________________________________________\n".
"Datum Unterschrift für die Bestellung\n\n".
"Die Bestellung kann nur mit rechtsverbindlicher Unterschrift bearbeitet werden.\n".
"Firma, Name und Anschrift leiten wir für Sie umgehend an die Denic und die Ripe weiter. Dort sind sie nach den Registrierungsbedingungen für Sie und andere im Internet jederzeit abrufbar.";
$nr = pdf_show_boxed($pdf, $text, 20.0, 20.0, 270.0, 540.0, "justify");
$nr = pdf_show_boxed($pdf, substr($text, -$nr), 300.0, 20.0, 270.0, 540.0, "justify");
pdf_stroke($pdf);
PDF_end_page($pdf);
PDF_close($pdf);
$empfaenger = "$datas[emailadminc]";
echo $pdfnr;
echo $empfaenger;
$subject = "Ihre Domain - Bestellung";
$message = "Vielen Dank für Iher Bestellung bei Limado New Media.\n\nIm Anhang finden Sie Ihr Bestellformular. Das Formular ist im .pdf-Format erstellt. Sollten Sie kein Programm zum Bearbeiten von PDF-Dateien installiert haben, können Sie sich den neuesten Acrobat-Reader hier downloaden.\nhttp://www.adobe.com/products/acrobat/readstep2.html <--- Hier klicken um Acrobat Reader herunterzuladen\n\nBitte öffnen Sie dieses Formular und senden Sie es uns unterschrieben per Fax zurück. \n\nDomainbestellungen können nur mit rechtsverbindlicher Unterschrift bearbeitet werden.\n\n Sobald das Fax bei uns angekommen ist, werden wir Ihre Account freischalten und Sie erhalten per eMail und Post Ihre Zugangsdaten.\n\n Mit freundlichen Grüssen\n\n Ihre Limado New Media";
$subjectadmin = "Neue Domain - Bestellung";
$message1 = "Neue Domains wurden registriert.";
$emaillimado = "info@limado.com";
mail($emaillimado." <".$emaillimado.">", $subjectadmin, $message1, "From: Limado New Media <".$emaillimado.">");
$sendto = $empfaenger;
$filename = "".$datas["id"].".pdf";
$mimetype = "application/pdf";
$replyto = $emaillimado;
$mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
$mailfile->sendfile();
##################EOF######################
I´m getting stupid on this.
Please help !
Greets Mario