zero-perfoliate
zero-perfoliate

Author Topic: PHP Mail script... Need help!  (Read 292 times)

Offline go0n

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
PHP Mail script... Need help!
« on: March 15, 2010, 03:47:28 PM »
Hey guys, hopefully someone out there can help me with this one.  I want an email notification sent every time a user logs into my site.  Right now I get an email however it doesn't tell me what user has logged in.  the script is below.  All I get is "$un has logged into the ***** website."  PLEASE HELP!?!?!

<?php
session_start();
require_once 'classes/Membership.php';
$membership = new Membership();

// If the user clicks the "Log Out" link on the index page.
if(isset($_GET['status']) && $_GET['status'] == 'loggedout') {
   $membership->log_User_Out();
}

// Did the user enter a password/username and click submit?
if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])) {
   $response = $membership->validate_User($_POST['username'], $_POST['pwd']);
}
   
if($_POST)
{
   $un      = $_POST['username'];
   $to      = 'myemail@email.com';
   $subject = 'Login Instance at *****';
   $headers = 'From: DO NOT REPLY <donotreply@*****.com>';
   $message = '$un has logged into the ***** website.';

   
mail($to, $subject, $message, $headers);
}


?>

Offline TomSayer

  • PHP Workers
  • **
  • Posts: 14
  • Karma: +0/-0
Re: PHP Mail script... Need help!
« Reply #1 on: March 16, 2010, 03:17:59 PM »
$message=$un."misc content";
Problem solved

Offline farooqbright@gmail.com

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Re: PHP Mail script... Need help!
« Reply #2 on: March 17, 2010, 11:34:25 PM »
$message=$un."misc content";
Problem solved

hotnoob

  • Guest
Re: PHP Mail script... Need help!
« Reply #3 on: March 20, 2010, 12:30:08 AM »
It's pretty simple...
single quotes are static strings, double quotes are for dynamic.

so, as a solution.

 $message = "$un has logged into the ***** website.";

or

 $message = $un.' has logged into the ***** website.';

this works as well too :D

 $message = $un." has logged into the ***** website.";

There are many ways of doing it...
like...
 $message  = $un;
 $message .= ' has logged into the ***** website.';

But yeah get the idea... the difference between single and double quotes?

 

zero-perfoliate