Results 1 to 2 of 2

Thread: PHP help

  1. #1
    urble
    Guest
    Question PHP help
    well, i had a friend come to me yesterday and ask me 'why won't this work?' this referring to www.lod4life.net/join.html. what it is supposed to do is send the form to the guys email... after you submit, the php i have doesn't work. i don't know to much php, or well, i don't know any functions and i have it embeded into the next document that follows when you hit submit and this is my script i have so far.
    Code:
    <?php
    $TO = 'midnight_supra@hotmail.com';
    $userip;
    if (getenv("HTTP_CLIENT_IP")) 
    	$userip = getenv("HTTP_CLIENT_IP");
    else if(getenv("HTTP_X_FORWARDED_FOR)) 
    	$userip = getenv("HTTP_X_FORWARDED_FOR");
    else if(getenv("REMOTE_ADDR")) 
    	$userip = getenv("REMOTE_ADDR");
    else $userip = "UNKNOWN";
    return $userip;
    $headers  = 'From: Anonymous on $SERVER_NAME <$mail>\n';
                .'X-Mailer: LOD Join Application PHP Mailer\n';
                .'X-host: $userip\n';
    $subject = 'LOD Application';
    $host = gethostbyaddr($REMOTE_ADDR);
    $message = '';
    while (list($key, $val) = each($HTTP_POST_VARS)) { 
    	$message .= $key.' : '.$val.'\n'; 
    } 
    $message .= '\nSent by $REMOTE_ADDR\n';
    mail($TO, $subject, $message, $headers); 
    echo '<p>Application Sent.</p>';
    ?>
    sorry if i am so rediculous off track with that script...any help would be appreciated

  2. #2

    Murlyn's Avatar
    Member Since
    Jun 11, 2003
    Location
    Mount Vernon, WA
    Posts
    4,915
    Specs:
    MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
    Quote Originally Posted by urble
    Code:
    <?php
    $TO = 'midnight_supra@hotmail.com';
    $userip;
    if (getenv("HTTP_CLIENT_IP")) 
    	$userip = getenv("HTTP_CLIENT_IP");
    else if(getenv("HTTP_X_FORWARDED_FOR)) 
    	$userip = getenv("HTTP_X_FORWARDED_FOR");
    else if(getenv("REMOTE_ADDR")) 
    	$userip = getenv("REMOTE_ADDR");
    else $userip = "UNKNOWN";
    return $userip;
    $headers  = 'From: Anonymous on $SERVER_NAME <$mail>\n';
                .'X-Mailer: LOD Join Application PHP Mailer\n';
                .'X-host: $userip\n';
    $subject = 'LOD Application';
    $host = gethostbyaddr($REMOTE_ADDR);
    $message = '';
    while (list($key, $val) = each($HTTP_POST_VARS)) { 
    	$message .= $key.' : '.$val.'\n'; 
    } 
    $message .= '\nSent by $REMOTE_ADDR\n';
    mail($TO, $subject, $message, $headers); 
    echo '<p>Application Sent.</p>';
    ?>
    Well for one.. you only use return in functions.. so I would just get rid of "return $userip;" and that should do it from the look of it. Plus use \r\n in your header vars, instead of just \n

    From the look of it though.. everything else should be fine.

    Cheers!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PHP 4.3.11 to PHP 5
    By prplxd in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 12-04-2005, 11:57 AM
  2. PHP Help
    By JoeyRamoneLives in forum Web Design and Hosting
    Replies: 2
    Last Post: 04-26-2005, 11:01 PM
  3. Setting up PHP and PHP Nuke
    By EvoMac in forum Web Design and Hosting
    Replies: 2
    Last Post: 02-18-2005, 01:38 PM
  4. Php
    By vtupser in forum Web Design and Hosting
    Replies: 5
    Last Post: 02-16-2005, 04:36 AM
  5. PHP Help
    By knaggsy in forum Web Design and Hosting
    Replies: 11
    Last Post: 10-20-2004, 10:53 AM

Posting Permissions

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