' . $lang['Security_Code'] . '
'; $count_error++;}
// Check for the empty or incorrect required fields
if (empty($form['realtor_first_name']) || strlen($form['realtor_first_name']) < 2 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_First_Name'] . '
'; $count_error++;}
if (empty($form['realtor_last_name']) || strlen($form['realtor_last_name']) < 2 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_Last_Name'] . '
'; $count_error++;}
if (empty($form['realtor_city']) || strlen($form['realtor_city']) < 2 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['City'] . '
'; $count_error++;}
if (empty($form['realtor_address']) || strlen($form['realtor_address']) < 4 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_Address'] . '
'; $count_error++;}
if (empty($form['realtor_zip_code']) || strlen($form['realtor_zip_code']) < 4 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Zip_Code'] . '
'; $count_error++;}
if (empty($form['realtor_phone']) || strlen($form['realtor_phone']) < 4 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_Phone'] . '
'; $count_error++;}
if (empty($form['realtor_e_mail']) || strlen($form['realtor_e_mail']) < 4 || !valid_email($form['realtor_e_mail']))
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_e_mail'] . '
'; $count_error++;}
if (empty($form['realtor_login']) || strlen($form['realtor_login']) < 4 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_Login'] . '
'; $count_error++;}
if (empty($form['realtor_password']) || strlen($form['realtor_password']) < 4 )
{ echo $lang['Field_Empty'] . ' - ' . $lang['Realtor_Password'] . '
'; $count_error++;}
// Check if login is already exist
$sql = 'SELECT login FROM ' . USERS_TABLE . ' WHERE login = "' . safehtml($login) . '"';
$r = $db->query($sql) or error ('Critical Error', mysql_error () );
if ($db->numrows($r) > 0 )
{ echo $lang['Login_Used'] . '
'; $count_error++;}
// Check if email is banned
$sql = 'SELECT * FROM ' . BANS_TABLE . ' WHERE name = "' . $form['realtor_e_mail'] . '" LIMIT 1';
$r = $db->query($sql) or error ('Critical Error', mysql_error () );
if ($db->numrows($r) > 0 )
{ echo $lang['e_mail_Banned'] . '
'; $count_error++;}
if (!eregi('^[a-z0-9]+$', $login))
{ echo $lang['Login_Incorrect'] . '
'; $count_error++;}
if (!eregi('^[a-z0-9]+$', $password))
{ echo $lang['Password_Incorrect'] . '
'; $count_error++;}
// Check if both passwords are equal
if ($form['realtor_password'] != $form['realtor_password_2'])
{ echo $lang['Passwords_Missmatch'] . '
'; $count_error++;}
if ($count_error > '0')
echo '
' . $lang['Errors_Found'] . ': ' . $count_error . '
';
// If no errors were found during the above checks we continue
if ($count_error == '0')
{
// Add realtor listing into the database
if ($conf['approve_realtors'] == 'ON')
$approved = 0;
else
// if you want all the new accounts to be approved without admin or email
// validation, please, set the following variable $approved to 1
$approved = 0;
// Get the user IP address
$user_ip = $_SERVER['REMOTE_ADDR'];
// If there is more than one IP
// get the first one from the
// comma separated list
if ( strstr($user_ip, ', ') )
{
$ips = explode(', ', $user_ip);
$user_ip = $ips[0];
}
// Generate random number for the email validation link
$number = rand (1000000, 9999999);
// Create a mysql query
$sql = 'INSERT INTO '. USERS_TABLE .
' (approved, first_name, last_name, company_name,
description, location, city, zip, address,
phone, fax, mobile, email, website, rating,
votes, date_added, ip_added, login, password, number) VALUES
(' . $approved . ', "' . $form['realtor_first_name'] . '", "' . $form['realtor_last_name']. '", "' . $form['realtor_company_name'] . '", "'
. $form['realtor_description'] . '", ' . $form['realtor_location'] . ', "' . $form['realtor_city'] . '", "' . $form['realtor_zip_code'] . '", "' . $form['realtor_address'] . '", "'
. $form['realtor_phone'] . '", "' . $form['realtor_fax'] . '", "' . $form['realtor_mobile'] . '", "' . $form['realtor_e_mail'] . '", "' . $form['realtor_website'] . '", 0,
0, "' . date ('Y-m-d') . '", "' . $user_ip . '", "' . $login . '", "' . md5($password) . '", "' . $number . '")';
$db->query($sql) or error ('Critical Error', mysql_error ());
// Fetch the last auto incremented listing id
$id = mysql_insert_id();
if ( $_POST['security'] == $_SESSION['random'] ) $session->varunset('random');
// Output the 'Thank you' message
// depending on the 'approve_realtors'
// configuration setting
if ($conf['approve_realtors'] == 'ON')
{
echo $lang['Realtor_Listing_Submitted_Approve'];
// Mail the administrator
$mailout = new Mailer;
$mailout->from($conf['general_e_mail'], $conf['general_e_mail_name']);
$mailout->add_recipient($conf['general_e_mail']);
$mailout->subject($lang['Admin_Realtor_Notification_Subject']);
// Replacing the variable names
$lang['Admin_Realtor_Notification_Mail'] = str_replace('{first_name}', $form['realtor_first_name'], $lang['Admin_Realtor_Notification_Mail']);
$lang['Admin_Realtor_Notification_Mail'] = str_replace('{last_name}', $form['realtor_last_name'], $lang['Admin_Realtor_Notification_Mail']);
$lang['Admin_Realtor_Notification_Mail'] = str_replace('{company}', $form['realtor_company_name'], $lang['Admin_Realtor_Notification_Mail']);
$lang['Admin_Realtor_Notification_Mail'] = str_replace('{address}', $form['realtor_address'] . ' ' . $form['realtor_city'] . ' ' . $form['realtor_zip_code'] . ' ' . getnamebyid(LOCATIONS_TABLE, $form['realtor_location']), $lang['Admin_Realtor_Notification_Mail']);
$mailout->message($lang['Admin_Realtor_Notification_Mail']);
// Send message
$mailout->send();
}
else
echo $lang['Realtor_Listing_Submitted'];
// Mail the user
$mailout = new Mailer;
$mailout->from($conf['general_e_mail'], $conf['general_e_mail_name']);
$mailout->add_recipient($form['realtor_e_mail']);
$lang['Realtor_Notification_Subject'] = str_replace('{website_name}', $conf['website_name'], $lang['Realtor_Notification_Subject']);
$mailout->subject($lang['Realtor_Notification_Subject']);
// Replacing the variable names
$lang['Realtor_Notification_Mail'] = str_replace('{website_name}', $conf['website_name'], $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{first_name}', $form['realtor_first_name'], $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{last_name}', $form['realtor_last_name'], $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{company}', $form['realtor_company_name'], $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{address}', $form['realtor_address'] . ' ' . $form['realtor_city'] . ' ' . $form['realtor_zip_code'] . ' ' . getnamebyid(LOCATIONS_TABLE, $form['realtor_location']), $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{login}', $login, $lang['Realtor_Notification_Mail']);
$lang['Realtor_Notification_Mail'] = str_replace('{password}', $password, $lang['Realtor_Notification_Mail']);
if ($conf['approve_realtors'] == 'ON')
{
$mailout->message($lang['Realtor_Notification_Mail']);
}
else
{
// Send a validation link if approval by admin is disabled
$mailout->message($lang['Realtor_Notification_Mail'] . '
' . $lang['verify'] . ' ' . URL . '/validate.php?id=' . $number . ' ');
}
// Send message
$mailout->send();
}
echo table_footer ( );
if ($count_error == '0')
{
echo table_header ( $lang['Upgrade_Listing'] );
// Fetch all packages to show the paypal forms
$sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE;
$r_packages = $db->query($sql) or error ('Critical Error', mysql_error () );
while ($f_packages = $db->fetcharray($r_packages))
{
// Do not show package we already have
// if ($f_featured['package'] != $f_packages['id'])
if ($conf['gateway'] == '2')
echo '