www.webdeveloper.com
Results 1 to 4 of 4

Thread: works on one domain but not on another

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    47

    works on one domain but not on another

    Hi, i've made a small program that will an uploadet attachment to an email that is entered.
    It works fine on one webhotel but when I transfer the same files to another webhotel it won't work.

    Can it have something to do with the hosts settings?
    It doesn't continue with the code after that, it doesn't give me an error, it just shows a blank page.

    I've debbugged and found out that the problem is with this:

    if($flgSend)

    My entire code looks like this:

    PHP Code:

    <?php



        
    include_once( 'class/class.upload.php' );
        
        if(isset(
    $_POST['upload'])){
        
            
    $filname=$_FILES['file_name'];
            
            
    $handle = new upload($filname);
            
            
    $handle->allowed = array('image/*');
            
            if(
    $handle -> uploaded){
            
                
    $handle->image_border          5;   // defining border width
                
    $handle->image_border_color    '#000'// defining border color
                
    $handle->image_watermark 'images/badge.png';  // watermark image src
                
    $handle->image_watermark_position 'BR'// watermark image position again "B" for bottom and so on.
                
    $handle->image_resize         true;   // making resize function to true
                
    $handle->image_x              160;    // making width to 160px
                
    $handle->image_y              160;    // making hight to 160px
                
    $handle->image_watermark_x = -5//change to fit your needs
                
    $handle->image_watermark_y = -5//change to fit your needs

                
    $handle->process('uploads/');
               
    // if ($handle->processed) {
                    
                    //$message = '<div class="center"><p>Border color #F58462 added successfully</p><img src="uploads/'.$handle->file_dst_name.'" alt="" /></div>';
                    
                    

                    
                    
                     //*** Uniqid Session ***//
        
    $strSid md5(uniqid(time()));
        
    $to $_POST['mail'];
        
    $from 'info@gmail.dk'
        
    $subject 'Your new facebook picture';
        
    $headers 'From: '.$from"\r\n" 'Reply-To: '.$from"\r\n";
        
    $headers .= "MIME-Version: 1.0\n";
        
    $headers .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
        
    $headers .= "This is a multi-part message in MIME format.\n";
        
    $headers .= "--".$strSid."\n";
        
    $headers .= "Content-type: text/html; charset=utf-8\n";
        
    $headers .= "Content-Transfer-Encoding: 7bit\n\n";
        if(
    $_FILES["file_name"]["name"] != "") {
        
    $strFilesName $_FILES["file_name"]["name"];
        
    $strContent chunk_split(base64_encode(file_get_contents('uploads/'.$strFilesName)));
        
    $headers .= "--".$strSid."\n";
        
    $headers .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
        
    $headers .= "Content-Transfer-Encoding: base64\n";
        
    $headers .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
        
    $headers .= $strContent."\n\n";
        }
        
    $flgSend = @mail($to$subject$message$headers); // @ = No Show Error //
        
    echo "1";
       if(
    $flgSend){
       echo 
    "2";
    echo 
    "<font color='black'>Mail send completed</font>";
    $tmpfile 'uploads/'.$strFilesName;
    // http://php.net/manual/en/function.file-exists.php
    if(file_exists($tmpfile)) {
    // http://php.net/manual/en/function.unlink.php
    unlink($tmpfile);


    }


    }


                }
                
                else {
            
            echo 
    " <div id='error_txt'>file too large, can not be more than 2 megabytes</div><br /><br />"
            echo 
    "<div id='ok_button'> <a href='ajax/profile.php'>OK</a></div>";
            
            }
                
            }
        
    //}

    ?>
    I hope someone can help. thank you

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    there may be some different configurations. normally some servers may require authentication to send emails. remove @ before mail() and enable error reporting to find errors

  3. #3
    Join Date
    Feb 2009
    Posts
    47
    Thank's how is it I enable error reporting

  4. #4
    Join Date
    Feb 2009
    Posts
    47
    I got it to work by linking to the webhotel where it works.

    Thank's for your help though

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles