Pages: [1]   Go Down
Author Topic: PHP Mail script... Need help!  (Read 97 times)
go0n
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


« on: March 15, 2010, 06:47:28 AM »

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);
}


?>
Report to moderator   Logged

TomSayer
Jr. Member
**

Karma: +0/-0
Offline Offline

Posts: 14


« Reply #1 on: March 16, 2010, 06:17:59 AM »

$message=$un."misc content";
Problem solved
Report to moderator   Logged

farooqbright@gmail.com
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 2


« Reply #2 on: March 17, 2010, 02:34:25 PM »

$message=$un."misc content";
Problem solved
Report to moderator   Logged

hotnoob
PhpBar.isgreat.org
Hero Member
*****

Karma: +0/-0
Offline Offline

Posts: 113


WWW
« Reply #3 on: March 19, 2010, 03:30:08 PM »

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 Cheesy

 $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?
Report to moderator   Logged

http://phpbar.isgreat.org
Feel free to check out my forums for more tutorials and help Cheesy

Pages: [1]   Go Up
Print
 
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC | Theme Kani By Fussilet

Page created in 0.037 seconds with 19 queries.