SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Server Connection Has Reset - Why?

    Hi all,

    Please see this site:

    http://mktg.me/tHBUuB

    For some reason it keeps saying that the server has timed out. I don't fully understand it because it works on my test site

    http://mktg.me/szgoPx

    It's nothing particularly complicated, just a very small php file that sends an email when the form has been filled in. I really can't understand why on earth it works fine on one and not on the other.

    Any help is much appreciated.


    Also... I know it's the wrong forum, and probably not such a pressing issue... but if anyone knows why it is so difficult to click on the "no" part of the form I'd appreciate some knowledge on that too. It seems quite a usability problem that it's so difficult to click on it. It just seems to prefer "yes" to "no". My form is a yes man.

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    What error messages are being displayed or are being put into your error logs?

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's a clients site, so I don't currently have access to the error logs, I can always ask for access.

    The error message is:

    The connection was reset
    The connection to the server was reset while the page was loading.
    The site could be temporarily unavailable or too busy. Try again in a few
    moments.
    If you are unable to load any pages, check your computer's network
    connection.
    If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.

    Other pages for the site work. Indeed the page prior to sending the script works. The script is tiny, it shouldn't be timing out or anything like that. I shall go back and double check the script, perhaps there is some error there.

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Compare the output of phpinfo() on both machines.

    Ask for confirmation that the mail() function has not been disabled.

    Sorry, cannot think of anything else - otherwise you will have to post some code I think.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I'll see the phpinfo thing first. I am completely noob, but at least I can hopefully spot some differences at the very least!

    It already has a mail script on the current site so I think that is not the problem most likely.

    I particularly dislike this hosting set up, although perhaps it's more to do with what I'm used to!

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have checked the PHPinfo and everything seems ok to my noob eye. Both seem to have the mail settings turned on etc. In fact my contact form does indeed send me a contact form, it just appears like it won't, so god knows how long it actually takes. It also arrives from some funny address - the web hosts.

    I just can't get my head around what would cause this issue, it works on my local machine with XAMPP, and also on my test server, just not on the client machine. I also managed to receive a blank contact form randomly too, which I didn't do, so I'm not quite sure how that's worked either.

  7. #7
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As a further update... When I send from IE and Firefox it seems to be different servers that send the emails. I have so far received the email from 3 servers (I assume).
    opus15.register.it - which had the correctly formatted email title etc.
    opus05.register.it - which did not have the email from name but instead $EmailFrom@opus 05.register.it
    opus26.register.it - which had the same as above with a differing part after @

    Can anyone clear up as to why there would be three different servers? Firstly, 26 is the one sent from IE. The other two are both Firefox, yet have different results. The fact that $EmailFrom is appearing instead of the email address is quite strange, and might hold the key. Can anyone assist?

  8. #8
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    The fact that $EmailFrom is appearing instead of the email address is quite strange, and might hold the key.
    Probably best to show us the code leading up to the mail() being sent, where the var $EmailFrom is being invoked.

  9. #9
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Code PHP:
    <?php 
    $Message = 'This is a message sent by the My Page';
    $EmailFrom = 'My Website';
    $EmailTo = 'me@me.com';
    $Subject = 'Message from MySite';
    $Company = Trim(htmlentities($_POST['company']));
    $Employees = Trim(htmlentities($_POST['employees']));
    $Scheme = Trim(htmlentities($_POST['scheme'])); 
    $Phone = Trim(htmlentities($_POST['phone'])); 
    $Email = Trim(htmlentities($_POST['email'])); 
    $Forename = Trim(htmlentities($_POST['forename']));
    $Surname = Trim(htmlentities($_POST['surname']));
     
     
    //Provider
    if (isset($_POST['provider'])) {
        $Provider = 'The person does not have a provider';
    }
    	else {$Provider = Trim(htmlentities($_POST['provider']));}
     
     
     
    // prepare email body text
    $Body = '';
    $Body .= 'Forename:     ';
    $Body .= $Forename;
    $Body .= '\n';
    $Body .= 'Surname:     ';
    $Body .= $Surname;
    $Body .= '\n';
    $Body .= 'Tel:     ';
    $Body .= $Phone;
    $Body .= '\n';
    $Body .= 'Email:     ';
    $Body .= $Email;
    $Body .= '\n';
    $Body .= 'Do they Currently Have a scheme?    ';
    $Body .= $Scheme;
    $Body .= '\n';
    $Body .= 'Who is their current provider     ';
    $Body .= $Provider;
    $Body .= '\n';
    $Body .= 'How many employees do they have?     ';
    $Body .= $Employees;
    $Body .= '\n';
    $Body .= 'Company Name     ';
    $Body .= $Company;
    $Body .= '\n';
     
    // send email 
    $success = mail($EmailTo, $Subject, $Body, 'From: <$EmailFrom>', $Message);
     
    // redirect to success page 
    if ($success){
      print '<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mysite.co.uk/thank-you.php\">';
    }
    else{
      print '<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mysite.co.uk/form-error.php\">';
    }
    ?>

  10. #10
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any ideas you have would be excellent

  11. #11
    SitePoint Enthusiast doddsey_65's Avatar
    Join Date
    Sep 2010
    Location
    North East UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $success = mail($EmailTo, $Subject, $Body, 'From: <$EmailFrom>', $Message);
    $EmailFrom needs to be enclosed in double quotes, the way you have done it will just print the word EmailFrom not the variable content.

    if ($success){
    print '<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mysite.co.uk/thank-you.php\">';
    }
    else{
    print '<meta http-equiv=\"refresh\" content=\"0;URL=http://www.mysite.co.uk/form-error.php\">';
    }
    why not just use a header() redirect?
    Test and help out with a new
    100% open source forum package: A Simple Forum
    Check the A Simple forum Github Page
    Visit my Github profile to see what I work on.

  12. #12
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I changed it at some point trying to find a solution.

    Have implemented your header redirect suggestion too (any particular reason to choose one solution over another?)

    It still doesn't work on the live site. It seems to get stuck as soon as I press submit and just says waiting with the loading sign I'm at a loss as to why that file would take so long to load for any reason. It never reaches the next page, but the emails do eventually arrive.

  13. #13
    SitePoint Enthusiast doddsey_65's Avatar
    Join Date
    Sep 2010
    Location
    North East UK
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ive filled in the forum and get sent to emailer.php where it just seems to load on a loop. No errors popup. it does eventually bring up the mentioned error page after about 5 minutes. Your best bet is to get hold of the error logs. I dont see any immediate php errors so it may be something to do with the server setup. I didnt get the email however.
    Test and help out with a new
    100% open source forum package: A Simple Forum
    Check the A Simple forum Github Page
    Visit my Github profile to see what I work on.

  14. #14
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol you probably will do in a little while. You'll receive it from the server as you have correctly pointed out I haven't set it up properly to deal with the actual from name.

    I'll see if I can get the server logs.


Tags for this Thread

Bookmarks

Posting Permissions

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