Is this simple script to new to work on some servers?

Discussion in 'Programming' started by calisonder, Aug 24, 2009.

  1. #1
    Hi,


    I'm not a coder but I have a simple PHP script that I always use in my contact forms on websites. I usually use godaddy servers which have PHP Version 5.2.5 installed and the script works fine.

    Unfortunately, the site I am working on is hosted by yahoo and the PHP Version on their servers is Version 4.3.11. The script does not work on there servers, and PHP is enabled. I tested the website I am working on on my own Godaddy servers and the the form works fine, but once I upload it to the yahoo servers it does not work.

    Is the code I'm using written in a newer version of PHP which won't allow it to work on Yahoo servers? Thats the only thing I can think of. If so, can someone give me some hints on how to modify the code to work on those yahoo servers.

    Thanks to everyone in advance.

    
    
    <?php
    /*
       Flash Mail Form
    */
    // Create local PHP variables from the info the user gave in the Flash form
    $senderName   = $_POST['userName'];
    $senderEmail     = $_POST['userEmail'];
    $senderPhone     = $_POST['userPhone'];
    $senderAddress     = $_POST['userAddress'];
    $senderMessage = $_POST['userMsg'];
    
    
    
    // Strip slashes on the Local variables
    $senderName   = stripslashes($senderName);
    $senderEmail     = stripslashes($senderEmail);
    $senderPhone     = stripslashes($senderPhone); 
    $senderAddress     = stripslashes($senderAddress); 
    $senderMessage   = stripslashes($senderMessage); 
    
    
    	$to = "info@5twelvedesign.com";
    	
    	
         // Place sender Email address here
        $from = "$senderEmail ";
        $subject = "Contact from your site";
        //Begin HTML Email Message
        $message = <<<EOF
    <html>
      <body bgcolor="#FFFFFF">
    <b>Name</b> = $senderName<br /><br />
    <b>Email</b> = <a href="mailto:$senderEmail">$senderEmail</a><br /><br />
    <b>Phone Number</b> = $senderPhone<br /><br />
    <b>Address</b> = $senderAddress<br /><br />
    <b>Message</b> = $senderMessage<br />
      </body>
    </html>
    EOF;
       //end of message
        $headers  = "From: $from\r\n";
        $headers .= "Content-type: text/html\r\n";
        $to = "$to";
    
        mail($to, $subject, $message, $headers);
    	
    exit();
    ?>
    
    
    Code (markup):
     
    calisonder, Aug 24, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No, it doesn't seem to do anything special. You can try adding this:

    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    
    PHP:
    At the top of the file. It may show an error message the next time you execute it so that you know more.
     
    premiumscripts, Aug 24, 2009 IP
  3. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    PHP 5.0.0 been official since 2004, anyone who hasn't moved up from version 4 needs to get with the time, Most host that still have PHP4 already have a PHP5 migration plan in effect (usually by updating an .htaccess, or setting a setting in their hosting account). Yahoo hosting is like their domain registration service, overpriced for what you're actually getting.

    PHP4 ended it's updates at 4.4.9 bout a year ago after they fixed all the bugs they were gona fix.
     
    kblessinggr, Aug 24, 2009 IP
  4. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The only problem by the way that I see with your code is the use of mail() function, which should be PHP4 compatible, but it can break if your hosting provider has disabled sendMail capability (which I'm sure Yahoo did). You would have to end up using something like the PHP4 version of PHPMailer with SMTP capability and log into your own mail server.

    Everything else should work in PHP 4 as you got it as it's simple variables and operators, and no use of things like Class inheritances, pass-by-reference, and so forth.
     
    kblessinggr, Aug 24, 2009 IP