Jump to content

johnhenry

Members
  • Posts

    19
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

johnhenry's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What information about me is on your database? Is it just user name and password?
  2. Thanks Guru and Moderator. I have seen the light. I was using $value = mysql_real_escape_string($value) and $value = strip_tags($value) before the str_replace() function. Without them it works as expected, although the nl2br suggestion seems like a better way to go.
  3. I want to email a post data message and I find that if, when writing the message in a text area and the enter key is pressed, the message has '\r\n' in it. When emailed the '\r\n is shown and there is no new line. I want to replace the '\r\n' with '<br>' and so I used the following script... $message = str_replace("\r\n","<br>",$message); This does not do a replace. The message stays the same. Can anyone tell me why this doesn't work please?
  4. I have solved my problem. I just wanted to thank you for your attempts to help. I have gone in a different direction, using PHPmailer. It is so easy to install and use I cannot understand why I haven't discovered it before. If anyone else has problems mailing I would recommend using it.
  5. Thanks. I copied that entire code, made the correction ( took out the dashes ) and substituted my piece of html instead of theirs, as... $html = '<html><head></head><body><a href='.$url.'>Web page</a></body></html>'; I get the email but no text at all and no URL link. Maybe it didn't work for them either! From my research I think there seem to be many ways of sending an email message with attachment. My way works except for the URL being plain text. It's not really my way, of course. I got it from some tutorial.
  6. I tried your suggestion but no luck. Not sure of the syntax.
  7. I have written the following script which sends an email with attachment. I also want to include a message with a URL, but the URL is not clickable. I have tried it with the message portion containing the URL at the end, as shown, and at the start before '$message = "This is a multi-part message in MIME format.\n\n" .' (I changed that line to $message.= "etc. to concatenate. Is there a way to include a URL that is clickable? <?php $url="http://www.mydomain.com"; // Settings $pdf_name="my_pdf.pdf"; $email = "me@myemail.com"; $to = "$name <$email>"; $from = "admin@myheadoffice.com"; $subject = "Job sheet with attachment"; $fileatt = "admin/pdfs/".$pdf_name; $fileatttype = "application/pdf"; $fileattname = $pdf_name; $headers = "From: $from"; $file = fopen($fileatt, 'rb'); $data = fread($file, filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $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"; $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatttype};\n" . " name=\"{$fileattname}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileattname}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "-{$mime_boundary}-\n"; $message.= "\n\nPDF attached. \n\n".$url; if(mail($to, $subject, $message, $headers)) { echo "Successfully sent with attachment"; } else { echo "There was an error sending the mail."; } ?>
  8. Great. I did it and it works exactly how I want it. I appreciate your help.
  9. OK. I want it renamed but I guess it will be a two stage operation. Copy first then rename the copy. I'm a bit shaky on file handling but with your help it is getting better. Thanks
  10. I tried out the renaming idea, and I put the renamed file into a new folder. It works well but the problem is that it deletes the master file. How can I do this without losing the original? Here is what I did. rename("pdf/55656-Oct21-2.pdf", "pdfs/55656.pdf");
  11. I didn't think of that. Sounds like a good idea. Thanks
  12. That was my gut-feeling, but I had to ask. Many thanks for the quick response.
  13. I wonder if anyone knows whether this is possible, Sorry if this should be in the html section, but the rest is a php script. I have to upload a file which always stays the same, When it is processed for upload I change the name according to some other criteria. That is all done and working, but what I would like to do is that the person doing the upload does not have to choose the file each time. I tried putting in a value attribute into the form field like this.. <input type="file" name="filename" value="55656-Oct21-2.pdf" size="20"> It seems to ignore the value and processes nothing. Choosing the file works OK. I just want them to be able to press 'Submit' without looking for it. Still no joy. Ideas would be appreciated
  14. I was running the script exactly as is. I was planning to integrate it into a larger script when I got this part working correctly. The error message appears after the new image has been saved back to overwrite the original. I guess you have given me the answer. Many thanks.
  15. I have looked at this problem again - (and again) - and I now notice that the error message which I reported as being .... 'The image “bla-bla-bla” cannot be displayed, because it contains errors' ..... is actually pointing to the answer. I put "bla bla bla" in instead of the URL that it gave. The URL it gave was the location and name of the php script and not the image. So it seems that it is trying to print the script to the page. I'm still baffled.
×
×
  • 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.