![]() |
Sergey Kornilov admin 3/21/2006 |
Tommy, function BeforeAdd(&$values) { $email=$values["superemail"]; $message="Your message"; $subject="Sample subject"; mail($email, $subject, $message); return true; } |
T
|
Tommy B author 3/21/2006 |
Tommy, you can create new field called superemail, then add to Before record added or Before record edit events on the Events Tab some code. See my example below:
|
![]() |
Sergey Kornilov admin 3/23/2006 |
Tommy, global $conn; $sql = "select email,superemail from Users where user='".$_POST["username"]."' and pass='".$_POST["password"]."'"; $rs=db_query($sql,$conn); $data=db_fetch_numarray($rs); $_SESSION["email"] = $data[0]; $_SESSION["superemail"] = $data[1];
... $email=$_SESSION["superemail"]; ... |
T
|
Tommy B author 3/23/2006 |
I've added the following code you suggested (replacing the generic table/field names with my own). However, no email is being sent. Records are added with no errors though. Any idea what may be wrong? Hopefully I'm overlooking a typo. function AfterSuccessfulLogin()
function BeforeAdd(&$values) |
![]() |
Sergey Kornilov admin 3/24/2006 |
Tommy, |
T
|
Tommy B author 3/24/2006 |
If I enter a value rather than a session varialble for the simple email, it does send. I've used this and continue to use it on tables within the same project as this one. |
T
|
Tommy B author 3/27/2006 |
Sergey, |
![]() |
Sergey Kornilov admin 3/28/2006 |
Tommy, ... $sql = "select EmailAddress,superemail from Users where UserName='".$_POST["username"]."' and Password='".md5($_POST["password"])."'"; ... Anyway you should ensure that this SQL command returns a correct data. |
T
|
Tommy B author 3/30/2006 |
Tommy, the code above will work only if you don't use Password encryption option. Here is the code for Password encryption turned on: Anyway you should ensure that this SQL command returns a correct data. Echo $data array values to find out what exactly SQL command returns.
|
![]() |
Sergey Kornilov admin 3/31/2006 |
Insert these two lines: echo $sql; print_r($data); just after this line: $data=db_fetch_numarray($rs);
|