diff --git a/contact.php b/contact.php
index c6b5706..3a1bd34 100644
--- a/contact.php
+++ b/contact.php
@@ -23,6 +23,8 @@
require("common.inc.php");
send_header("Contact Us",null,"communication");
+ include "account.inc.php";
+ include "user.inc.php";
function cleanify($in) {
$in=ereg_replace("\r","\n",$in);
@@ -34,10 +36,11 @@
if($_POST['to'] && $_POST['subject'] && $_POST['message'] && $_POST['from'] && $_POST['fromemail']) {
if(isEmailAddress($_POST['fromemail'])) {
list($id,$md5email)=explode(":",$_POST['to']);
- $q=mysql_query("SELECT * FROM users WHERE uid='$id' ORDER BY year DESC LIMIT 1");
- $r=mysql_fetch_object($q);
+ $a=account_load($id);
+ $u=user_load_by_accounts_id($id);
+
//if a valid selection is made from the list, then this will always match.
- if($md5email == md5($r->email)) {
+ if($md5email == md5($a['email'])) {
$from=cleanify($_POST['from'])." <".cleanify($_POST['fromemail']).">";
$extra="Return-Path: $from\r\nFrom: $from\r\nReply-To: $from\r\n";
@@ -47,7 +50,7 @@
//and strip the slashes from the message
$message=stripslashes($_POST['message']);
- mail("$r->firstname $r->lastname <$r->email>",$subject,$message,$extra);
+ mail("{$u['firstname']} {$u['lastname']} <{$a['email']}>",$subject,$message,$extra);
echo happy(i18n("Contact email successfully sent"));
}
else {
@@ -62,15 +65,6 @@
echo error(i18n("All fields are required"));
}
-?>
-
-
-
echo i18n("Choose who you would like to contact from the list below, type your subject and message, and click the 'Send' button");
echo "
";
echo "
";
@@ -78,23 +72,37 @@ function tochange() {
echo "\n";
echo "
";
echo "".i18n("To").": | ";
- echo " |
";
echo "".i18n("Your Name").": | |
";