- $result = SQL_QUERY_ESC("SELECT email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d AND status='CONFIRMED' LIMIT 1",
- array(bigintval($_SESSION['lead_uid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+ array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__);