Jump to content

sun14php

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Posts 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. 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



  6. 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.
  7. [!--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.
  8. 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
  9. [!--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.
  10. 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
  11. 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
×
×
  • 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.