Jump to content

sun14php

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by sun14php

  1. ok anyhow i managed to send attachemnet with mail using php, but problem is that , while opening in rediffmail,yahoomail,my attachement is displayed in below format, though i attached a excle file & i tried on notepad file also. This is a multi-part message in MIME format. --==Multipart_Boundary_xa7bb2d8b920cbe5c4753085189780635x Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit --==Multipart_Boundary_xa7bb2d8b920cbe5c4753085189780635x Content-Type: application/x-msdownload; name="extraction.xls" Content-Disposition: attachment; filename="extraction.xls" Content-Transfer-Encoding: base64 CiAKIAogCiAKCiAKbG9naWQJdGRhdGUJdHRpbWUJc3J2aWQJcHJvdHlwZQlkZWF0aWxzCWFjdGlv bglhdHNzCXN3Zm0Jb3MJdHQJcmVtYXJrcwkKIjEiCSIyMDA2LTA3LTA3IgkiMTU6MTI6NDkiCSJz ZGxhOSIJImNwdSIJIjkxIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYWN0aW9uIHRha2VuIgki cmVzbG92ZWQiCSJvayIJIjciCSJvayIKIjIiCSIyMDA2LTA3LTA3IgkiMTc6NDk6MjMiCSJzZGxh NyIJImNwdSIJIjgyIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYWN0aW9uIHRha2VuIgkibm90 IHJlc2xvdmVkIgkib2siCSIyNSIJIm9rIgoiMyIJIjIwMDYtMDctMDciCSIxODoxNDoyNiIJInNk bGE3IgkiY3B1IgkiMTAwIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYXV0byByZWNvdmVyeSIJ infact it should have displayed in file attachement(as regular attacement) that can be downloaded form mail like a seprate file. with this attachement i can't downlaod file.what wrong with my coding: below is code:- PHP :code: <?php //require_once "Mail.php"; #--------From Html form $to      = $_POST['to']; $from    = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; // Obtain file upload vars $fileatt      = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; #$headers = "From: $from"; $headers = array ('From' => $from,   'To' => $to,   'Subject' => $subject); $smtp = Mail::factory('smtp',   array ('host' => $host,     'auth' => false,     'username' => $username,     'password' => $password)); if (is_uploaded_file($fileatt)) {   // Read the file to be attached ('rb' = read binary)   $file = fopen($fileatt,'rb');   $data = fread($file,filesize($fileatt));   fclose($file);   // Generate a boundary string   $semi_rand = md5(time());   $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";   // Add the headers for a file attachment   $headers .= "\nMIME-Version: 1.0\n" .               "Content-Type: multipart/mixed;\n" .               " boundary=\"{$mime_boundary}\"";   // Add a multipart boundary above the plain message   $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";   // Base64 encode the file data   $data = chunk_split(base64_encode($data));   // Add file attachment to the message   $message .= "--{$mime_boundary}\n" .               "Content-Type: {$fileatt_type};\n" .               " name=\"{$fileatt_name}\"\n" .               "Content-Disposition: attachment;\n" .               " filename=\"{$fileatt_name}\"\n" .               "Content-Transfer-Encoding: base64\n\n" .               $data . "\n\n" .               "--{$mime_boundary}--\n"; } #------------------ #$from = "sunil <sunil.phogat@sugaldamani.com>"; #$to = "sunil <afsa23@rediffmail.com>"; #$subject = "Hi!"; #$body = "Hi,\n\nHow are you?"; $host = "smtp.registeredsite.com"; $username = "sunil.phogat@registeredsite.com"; $password = "****"; $headers = array ('From' => $from,   'To' => $to,   'Subject' => $subject); $smtp = Mail::factory('smtp',   array ('host' => $host,     'auth' => false,     'username' => $username,     'password' => $password)); $mail = $smtp->send($to, $headers, $message); if (PEAR::isError($mail)) {   echo("<p>" . $mail->getMessage() . "</p>"); } else {   echo("<p>Message successfully sent!</p>"); } ?>
  2. ok anyhow i managed to sent attachemnet with mail using php, but problem is that , my attachement is displayed in below format, though i attached a excle file & i tried on notepad file also. This is a multi-part message in MIME format. --==Multipart_Boundary_xa7bb2d8b920cbe5c4753085189780635x Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit --==Multipart_Boundary_xa7bb2d8b920cbe5c4753085189780635x Content-Type: application/x-msdownload; name="extraction.xls" Content-Disposition: attachment; filename="extraction.xls" Content-Transfer-Encoding: base64 CiAKIAogCiAKCiAKbG9naWQJdGRhdGUJdHRpbWUJc3J2aWQJcHJvdHlwZQlkZWF0aWxzCWFjdGlv bglhdHNzCXN3Zm0Jb3MJdHQJcmVtYXJrcwkKIjEiCSIyMDA2LTA3LTA3IgkiMTU6MTI6NDkiCSJz ZGxhOSIJImNwdSIJIjkxIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYWN0aW9uIHRha2VuIgki cmVzbG92ZWQiCSJvayIJIjciCSJvayIKIjIiCSIyMDA2LTA3LTA3IgkiMTc6NDk6MjMiCSJzZGxh NyIJImNwdSIJIjgyIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYWN0aW9uIHRha2VuIgkibm90 IHJlc2xvdmVkIgkib2siCSIyNSIJIm9rIgoiMyIJIjIwMDYtMDctMDciCSIxODoxNDoyNiIJInNk bGE3IgkiY3B1IgkiMTAwIgkic2VydmVyIHN0YWZmIGluZm9ybWVkIgkiYXV0byByZWNvdmVyeSIJ infact it should have displayed in file attachement(as regular attacement) that can be downloaded form mail like a seprate file. with this attachement i can't downlaod file.what wrong with my coding: below is code:- PHP :code: <?php //require_once "Mail.php"; #--------From Html form $to      = $_POST['to']; $from    = $_POST['from']; $subject = $_POST['subject']; $message = $_POST['message']; // Obtain file upload vars $fileatt      = $_FILES['fileatt']['tmp_name']; $fileatt_type = $_FILES['fileatt']['type']; $fileatt_name = $_FILES['fileatt']['name']; #$headers = "From: $from"; $headers = array ('From' => $from,   'To' => $to,   'Subject' => $subject); $smtp = Mail::factory('smtp',   array ('host' => $host,     'auth' => false,     'username' => $username,     'password' => $password)); if (is_uploaded_file($fileatt)) {   // Read the file to be attached ('rb' = read binary)   $file = fopen($fileatt,'rb');   $data = fread($file,filesize($fileatt));   fclose($file);   // Generate a boundary string   $semi_rand = md5(time());   $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";     // Add the headers for a file attachment   $headers .= "\nMIME-Version: 1.0\n" .               "Content-Type: multipart/mixed;\n" .               " boundary=\"{$mime_boundary}\"";   // Add a multipart boundary above the plain message   $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";   // Base64 encode the file data   $data = chunk_split(base64_encode($data));   // Add file attachment to the message   $message .= "--{$mime_boundary}\n" .               "Content-Type: {$fileatt_type};\n" .               " name=\"{$fileatt_name}\"\n" .               "Content-Disposition: attachment;\n" .               " filename=\"{$fileatt_name}\"\n" .               "Content-Transfer-Encoding: base64\n\n" .               $data . "\n\n" .               "--{$mime_boundary}--\n"; } #------------------ #$from = "sunil <sunil.phogat@sugaldamani.com>"; #$to = "sunil <afsa23@rediffmail.com>"; #$subject = "Hi!"; #$body = "Hi,\n\nHow are you?"; $host = "smtp.registeredsite.com"; $username = "sunil.phogat@registeredsite.com"; $password = "****"; $headers = array ('From' => $from,   'To' => $to,   'Subject' => $subject); $smtp = Mail::factory('smtp',   array ('host' => $host,     'auth' => false,     'username' => $username,     'password' => $password)); $mail = $smtp->send($to, $headers, $message); if (PEAR::isError($mail)) {   echo("<p>" . $mail->getMessage() . "</p>"); } else {   echo("<p>Message successfully sent!</p>"); } ?>
  3. Hi, all,   as i hv build my website(under apache,redhat as 4,php,mysql) now i hv a login page as start-up page on site. it takes username & password & allow user to proceed. but it's not authentication .. i want that a user unable to access any page unless he give proper username & password at first page itself or he redirect to first page saying "Login first". it is just like session control or something. please guide me to get it fit. help needed
  4. jvrothjr,   u tried the best , but i could not understatnd ru code. let me explain u. A table showing records in browser as below(show.php): ID          class        marks        result 1              12              67 2              11              67 now since i encapuslated id filed(cell) into hyperlink to take me to update.php page from show.php. At ths point if i click on id's fileds value assume on 1 it will take me to the update.php page ,here i want it display the id filed's value(which clicked in show.php page)on update.php, in our case, it's 1. Is it clear ?
  5. Orio,   U saved me Really. Thanx 3 trucks of thanx with best wishes.  :D
  6. no orio i could not get ur script . please explain per my first query: how do i display time in minutes only ?
  7. look at below: my data stored in mysql table. LogId Date         Time     SrvID    Problem Deatils       Action     Status(5 min) Status TimeTaken    Rmarks 54 30-06-2006  13:49:03 #sdla12    cpu         94 server staff informed now i want to calculate  filed TimeTaken , that  should be calculated as TimeTaken=Time-Current system Time; preferbly in minutes usinh php. guide me please :P
  8. hi,   i could not get u please clarify more.. how do i access cell(hyperlink value ) into next php script
  9. i am using two time colums to store 2 time values using currtime() mysql function. now i want to store the diff. between above two time filed into [b]minutes[/b] in a another field like PASTTIME NOWTIMKE DIFFRENCE 05:10:00 05:20:00 10 how can i achive above result guide me please.
  10. [!--quoteo(post=389174:date=Jun 29 2006, 04:31 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 29 2006, 04:31 AM) [snapback]389174[/snapback][/div][div class=\'quotemain\'][!--quotec--] $date=("dmy"); input name="date" [/quote] this code didn't help too.
  11. i used ur code but instead of storing 02-06-06 it's storing 0000-00-00 in mysql database. why ? in browser it's showing : 30-11-1999 & what is the meaning of the line: //** add timestamp to a MySQL.int column
  12. what should i do for following results ? 1. I want to enter date in textbox(form html/php) in dd-mm-yy format 2. the above date i enter in dd-mm-yy format should be stored in mysql date column either in yyyy-mm-dd or dd-mm-yy format. 3. date stored in mysql column should be displayed in browser in dd-mm-yy fromat. i think i worte so simple. if yes help me out. thanx a lot
  13. [!--quoteo(post=389114:date=Jun 29 2006, 12:07 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 29 2006, 12:07 AM) [snapback]389114[/snapback][/div][div class=\'quotemain\'][!--quotec--] <? $date1="010101"; $date2="030303"; $result=$date2-$date1; echo $result; ?> i tried this way round. [/quote] Reply from Sun14php: I asked time difference not date difference ,that too in minutes . your post does not solve my problem. & my time is in hh-mm-ss format.
  14. HOW TO GET RESULT IN MINUTE OF DIFFRENCE BETWEEN TWO TIME FILEDS OF MYSQL USING PHP ? IS THR ANY FUNCTION SUGGEST ME. MY SQL HAS TWO TIME COLUMN I WANT TO STORE RESULT OF DIFFRENCE BETWEEN THOSE TIMES COLUMN IN A THIRD COLUMN IN INTEGER.
  15. Q1.how do i display mysql yyyy-mm-dd date into browse as dd-mm-yy format using php or whatever ? Q2. can set input-mask in html's textbox to accept date as dd-mm-yy ?
  16. working on mysql with php, as my data is displayed in browser in the tabular form as below id name class result 1 sun five i want as i click (making id filed hyperlink) on particular id it automatically take me to update form an & i can update "result" filed thr after that. it also display the clicked id value in a text box. how i code it ? regards
  17. jvr,.... please clear........ does i put ID manually in hyperlink command ? if so i do'nt like that solution. understand my problem first
  18. working on mysql with php, as my data is displayed in browser in the tabular form as below id name class result 1 sun five i want as i click (making id filed hyperlink) on particular id it automatically take me to update form an & i can update "result" filed thr after that. it also display the clicked id value in a text box. how i code it ? regards
  19. hi all , i m searching a gui php debugger for redhat linux. could u suggest one please, that should enable me to debugg script line by line.
×
×
  • 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.