function create_person($params) { $firstname = $params['firstname']; $surname = $params['surname']; $res = ''; $external = my_mysql_query_hash('SELECT * FROM TbExternalType', 'id'); $query = sprintf('SELECT * FROM TbIdPerson WHERE firstname=%s AND surname=%s', my_mysql_real_escape_string($firstname), my_mysql_real_escape_string($surname)); $row = my_mysql_query_one_row($query); $id = $row['id']; $res .= '<ul>'; $res .= '<li>id: ' . $id . '</li>'; $res .= '<li>Name: ' . get_full_name($row, $honorifics) . '</li>'; // handle externals $query = sprintf('SELECT * FROM TbIdPersonExternal WHERE personId=%s', my_mysql_real_escape_string($id)); $result = my_mysql_query($query); while ($row = $result->fetch_assoc()) { $externalcode = $row['externalCode']; $externalid = $row['externalId']; $externalname = $external[$externalid]['name']; $externalidname = $external[$externalid]['idname']; $link = get_external_href($externalname, $externalcode); $link = '<a href=\'' . $link . '\'>' . $externalidname . ': ' . $externalcode . '</a>'; $res .= '<li>' . $link . '</li>'; } my_mysql_free_result($result); $res .= '</ul>'; return $res; }
function get_person_data() { $honorifics_hash = my_mysql_query_hash('SELECT * FROM TbIdHonorific', 'id'); $query = sprintf('select id,honorificId,firstname,surname,othername,ordinal from TbIdPerson order by firstname,surname'); $result = my_mysql_query($query); $row = $result->fetch_assoc(); while ($row != NULL) { $row['label'] = get_full_name($row, $honorifics_hash); $rows[] = $row; $row = $result->fetch_assoc(); } return $rows; }
function comment_repplied_name($replied_no, $rplcno) { $mno = get_fs_plcm_reply_mno($replied_no, $rplcno); return get_full_name($mno); }
function do_donations() { $amount = mysql_real_escape_string(safe('mc_gross')); $custom = mysql_real_escape_string(safe('custom')); // or 'transaction_subject' $custom = explode('|', $custom); $email = $custom[0]; $gift_aid = $custom[1]; // was item_number but it appears in PayPal customer page $gift_aid = $gift_aid == 'TAXPAYER_YES' ? 1 : 0; //-------------------------------------------------------------- $row = mysql_fetch_assoc(mysql_query("SELECT id, email, title, forename, surname FROM " . TABLE_COMMUNITY . " WHERE email='" . $email . "'")); check_db_error(); // id exists if ($row['email']) { $pid = $row['id']; insert_amount($pid, $amount, $gift_aid); } else { $sql_cmd = "\tINSERT INTO " . TABLE_COMMUNITY . " (dt, mdt, email)\n\t\t\t\t\t\tVALUES(\n\n\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t'" . $email . "',\n\n\t\t\t\t\t\t)"; mysql_query($sql_cmd); check_db_error(); $pid = mysql_insert_id(); insert_amount($pid, $amount, $gift_aid); } insert_value('donor', 1, $pid); //-------------------------------------------------------------- // paypal address fields if (isset($_REQUEST['address_name'])) { $fields = array('first_name', 'last_name', 'payer_email', 'address_name', 'address_street', 'address_city', 'address_state', 'address_zip', 'address_country', 'address_country_code', 'residence_country', 'address_status'); $sql_cmd = ''; $sql_top = ''; foreach ($fields as $name) { $sql_top .= $name . ','; if (isset($_REQUEST[$name])) { $sql_cmd .= '\'' . mysql_real_escape_string(safe($name)) . '\','; } else { $sql_cmd .= '\'\','; } } // remove last , $sql_cmd = substr_replace($sql_cmd, "", -1); $sql_top = substr_replace($sql_top, "", -1); $sql_cmd = "\tINSERT INTO " . TABLE_PAYPAL . "\n\n\t\t\t\t\t\t(dt, pid, " . $sql_top . ")\n\n\t\t\t\t\t\tVALUES(\n\n\t\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t\t" . $pid . ",\n\t\t\t\t\t\t\t" . $sql_cmd . "\n\t\t\t\t\t)"; /* $sql_cmd = ''; foreach ($update_these as $name) $sql_cmd .= $name . ' = \'' .$_REQUEST[$name] . '\','; // remove last , $sql_cmd = substr_replace($sql_cmd ,"",-1); $sql_cmd = (" UPDATE " . TABLE_PAYPAL . " SET mdt = NOW(), " . $sql_cmd . " WHERE id = '". $pid ."' "); */ mysql_query($sql_cmd); check_db_error($sql_cmd); } //-------------------------------------------------------------- //send emails (to donor & IBS) if ($row['title'] && $row['forename'] && $row['surname']) { $name = get_full_name($row); } else { $name = 'Subscriber'; } send_email_auto_donor($name, $amount); send_email_donor($email, $name, $amount); }
/** * Check to see if user has registered * * @access public * @return void */ function check_registration() { global $debug; global $task, $err; global $fields; if (!$_POST['id']) { $task = 'email_new'; } else { $task = 'edit'; } //-------------------------------------------------------------- // check for errors foreach ($fields as $name => $options) { if (isset($_POST[$name]) && !$_POST[$name] && $options['mandatory']) { $err[] = $options['error']; } } //-------------------------------------------------------------- // check passwords if (strlen(trim($_POST['password'])) < 5) { $err[] = 'Your password must be at least 5 characters long'; } if (trim($_POST['password_confirm']) != '' && trim($_POST['password']) != trim($_POST['password_confirm'])) { $err[] = 'Your passwords do not match'; } //-------------------------------------------------------------- // check email in case there's nothing set if (!$_POST['email']) { $err = array(); $err[] = 'There was a problem. Please re-enter your email address'; $task = 'start'; } //-------------------------------------------------------------- if (count($err) > 0) { return; } //-------------------------------------------------------------- // clean all POST vars foreach ($fields as $name => $options) { if (isset($_POST[$name])) { $_POST[$name] = mysql_real_escape_string(trim(echo_value($name))); } } //-------------------------------------------------------------- // checkbox for newsletter if (!isset($_POST['newsletter'])) { $_POST['newsletter'] = 0; } //-------------------------------------------------------------- // check to see if record already exists: by id if already in DB if (intval($_POST['id']) > 0) { $row = db_fetch("SELECT id, email, forename, admin FROM " . TABLE_COMMUNITY . " WHERE id='{$_POST['id']}'"); } //-------------------------------------------------------------- // check to see if email already exists $row_email = db_fetch("SELECT id, email, forename, admin FROM " . TABLE_COMMUNITY . " WHERE email='{$_POST['email']}'"); //-------------------------------------------------------------- // update existing record if (isset($row['id'])) { // avoid duplicate emails if (isset($row_email['email']) && $_POST['email'] != $row['email']) { $err[] = 'Email address is already registered. Please choose another email.'; return; } $task = update_record($fields, $row, 'id'); send_registration_auto_email($fields, FALSE); } else { if (isset($row_email['email'])) { $task = update_record($fields, $row_email, 'email'); } else { $task = insert_record($fields); } // used for emailing $email = $_POST['email']; $name = get_full_name(); $password = $_POST['password']; // send email to registered user send_registration_email($email, $name, $password); send_registration_auto_email($fields, TRUE); } //-------------------------------------------------------------- }