This topic is locked

sending email on password change

3/18/2008 8:05:16 PM
PHPRunner General questions
W
wfcentral author

can anyone give me a clue why I'm getting this error
Parse error: syntax error, unexpected T_STRING in /home/tojrgolf/public_html/register/Golf2008/include/events.php on line 62
line 62 is set rstmp = Server.CreateObject("ADODB.Recordset")
here's my code
// After password changed

function AfterChangePassword($oldpassword, $newpassword)

{

global $conn;

//select user email from LoginTable

set rstmp = Server.CreateObject("ADODB.Recordset")

rstmp.Open "select email, firstname from tbl2008Accounts where UserID = '" & Session("UserID") & "'"

email = rstmp("email")

firstname = rstmp("firstname")

rstmp.Close : set rstmp = nothing
// ** Send simple email ****

$email="robert@mywebsite.com";

$message="Dear ".$values[firstname]."\r\n\n";

$message="your email address was entered as : ".$values[email]."/r/n/n";

$subject="Your tojrGolf Registration Info";

mail($email, $subject, $message,'From:info@tojrgolf.com');
} // function AfterChangePassword

A
alang 3/18/2008

A few observations:

  1. PHP variables start with '$' so try
    set $rstmp = Server.CreateObject("ADODB.Recordset");
  2. You need to terminate each line with a semicolon.
  3. The string concatenation operator in PHP is "."
  4. The session variables are referenced like $_SESSION["..."]
    therefore:
    $rstmp.Open "select email, firstname from tbl2008Accounts where UserID = '".$_SESSION["UserID"]."'";

W
wfcentral author 3/18/2008

thanks for the help - I took some of your code and some from another post and got it working...
global $conn;

//select user email from LoginTable

$str = "select email, password from tbl2008Account where email = '".$_SESSION["UserID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);
// ** Send data email ****

$adminemail="admin@gmail.com";

$email=$data["email"];

$message="This email is a reminder that you have started a registration at golf.com.\r\n";

$message.="To complete this registration visit the website below and login using the information in this email.\r\n\n";

$message.="http://golf.com/register/login.php \r\n";

$message.="Username : ".$data["email"]."\r\n";

$message.="Password : ".$data["password"]."\r\n";

$subject="Your Golf Registration Info";

mail($email, $subject, $message,'From:info@golf.com');

mail($adminemail, $subject, $message,'From:info@golf.com');