</tr>
              <tr>
                <td>Background/Profile<br />
                    <textarea name="contact_profile" cols="60" rows="3" id="contact_profile"><?php 
echo $row_contact['contact_profile'];
?>
</textarea>
<br />


<!--custom fields-->
<?php 
if ($totalRows_fields) {
    do {
        if ($update) {
            record_set('fieldv', "SELECT * FROM fields_assoc WHERE cfield_field = " . $row_fields['field_id'] . " AND cfield_contact = " . $_GET['id'] . "");
        }
        $cvalue = $row_fieldv['cfield_value'];
        ?>
<br />
<?php 
        echo $row_fields['field_title'];
        ?>
<br />

<?php 
        if (!$row_fields['field_content']) {
            ?>
<input name="contact_f_<?php 
            echo $row_fields['field_id'];
            ?>
Ejemplo n.º 2
0
<?php

require_once 'includes/config.php';
include 'includes/sc-includes.php';
$pagetitle = 'Contact';
//restrict if not admin
if (!$user_admin) {
    header('Location: contacts.php');
    die;
}
//
//custom fields
record_set('fields', "SELECT * FROM fields ORDER BY field_title ASC");
//
if ($_POST) {
    foreach ($_POST['field'] as $key => $value) {
        if ($value) {
            $value = addslashes($value);
            mysql_query("UPDATE fields SET \r\n\tfield_title = '" . $value . "',\r\n\tfield_content = '" . addslashes($_POST['field_content_update'][$key]) . "'\r\nWHERE field_id = " . $key . "");
        }
    }
    //add new field
    if ($_POST['field_add']) {
        mysql_query("INSERT INTO fields (field_title, field_content) VALUES \r\n\t(\r\n\t\t'" . insert('field_add') . "',\r\n\t\t'" . insert('field_content') . "'\r\n\t)\r\n");
    }
    redirect('Your changes have been saved.', 'fields.php');
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Ejemplo n.º 3
0
}
$cwhere = "WHERE history_status = 1";
if (isset($_GET['s'])) {
    $cwhere = "WHERE history_status = 1 AND ({$like_where})";
}
$search = 0;
$nwhere = "";
if (isset($_GET['s'])) {
    $search = 1;
    $nwhere = "WHERE note_text LIKE '%" . addslashes($_GET['s']) . "%' ";
}
//get notes
record_set('notes', "SELECT * FROM notes INNER JOIN contacts ON note_contact = contact_id {$nwhere} ORDER BY note_date DESC LIMIT 0, 20");
//get contacts
$climit = !empty($_GET['s']) ? 1000 : 10;
record_set('contactlist', "SELECT * FROM history INNER JOIN contacts ON contact_id = history_contact {$cwhere} ORDER BY history_date DESC LIMIT 0, {$climit}");
if (!$totalRows_contactlist && !isset($_GET['s'])) {
    header('Location: contact.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php 
echo $pagetitle;
?>
</title>
<link href="includes/simplecustomer.css" rel="stylesheet" type="text/css" />
</head>
<?php

require_once 'includes/config.php';
include 'includes/functions.php';
session_start();
if (isset($_SESSION['user'])) {
    header('Location: index.php');
}
mysql_select_db($database_contacts, $contacts);
$pagetitle = Login;
if ($_POST['email'] && $_POST['password']) {
    record_set('logincheck', "SELECT * FROM users WHERE user_email = '" . addslashes($_POST['email']) . "' AND user_password = '******'password']) . "'");
    if ($totalRows_logincheck == 1) {
        $_SESSION['user'] = addslashes($_POST['email']);
        $redirect = 'index.php';
        header(sprintf('Location: %s', $redirect));
        die;
    }
    if ($totalRows_logincheck < 1) {
        redirect('Incorrect Username or Password', "login.php");
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php 
echo $pagetitle;
?>
Ejemplo n.º 5
0
">Users</a><span class="headerright">Logged in as <?php 
echo $row_userinfo['user_email'];
?>
 | <a href="logout.php">Log Out</a> | <a href="profile.php">Update Profile</a> </span><br clear="all" />
  </div>
  </div>

<?php 
if ($totalRows_history) {
    ?>
<div class="historycontainer">Recent: 
    <?php 
    $ih = 1;
    do {
        //GET CONTACT INFO FROM HISTORY
        record_set('histcont', "SELECT * FROM contacts WHERE contact_id = " . $row_history['history_contact'] . "");
        //
        ?>
    <a href="contact-details.php?id=<?php 
        echo $row_histcont['contact_id'];
        ?>
"><?php 
        echo $row_histcont['contact_first'];
        ?>
 <?php 
        echo $row_histcont['contact_last'];
        ?>
</a> <?php 
        if ($totalRows_history != $ih) {
            ?>
 &middot; <?php 
Ejemplo n.º 6
0
    $csv_output_r[5] = $row_contactlist['contact_street'];
    $csv_output_r[6] = $row_contactlist['contact_city'];
    $csv_output_r[7] = $row_contactlist['contact_state'];
    $csv_output_r[8] = $row_contactlist['contact_zip'];
    $csv_output_r[9] = $row_contactlist['contact_country'];
    $csv_output_r[10] = $row_contactlist['contact_email'];
    $csv_output_r[11] = $row_contactlist['contact_phone'];
    $csv_output_r[12] = $row_contactlist['contact_fax'];
    $csv_output_r[13] = $row_contactlist['contact_web'];
    $csv_output_r[14] = $row_contactlist['contact_profile'];
    //get custom fields for this contact
    record_set('lfields', "SELECT * FROM fields ORDER BY field_title ASC");
    $i = 15;
    if ($totalRows_lfields) {
        do {
            record_set('cf', "SELECT * FROM fields_assoc WHERE cfield_contact = " . $row_contactlist['contact_id'] . " AND cfield_field = " . $row_lfields['field_id'] . "");
            $csv_output_r[$i] = $row_cf['cfield_value'];
            $i++;
        } while ($row_lfields = mysql_fetch_assoc($lfields));
    }
    //
    foreach ($csv_output_r as $key => $value) {
        $csv_output .= "\"" . $value . "\",";
    }
    $csv_output .= "\n";
} while ($row_contactlist = mysql_fetch_array($contactlist));
//You cannot have the breaks in the same feed as the content.
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv; filename=contact.csv");
print $csv_output;
exit;
Ejemplo n.º 7
0
<?php

require_once 'includes/config.php';
include 'includes/functions.php';
mysql_select_db($database_contacts, $contacts);
$pagetitle = "Password Request";
session_start();
if ($_POST['email']) {
    record_set('passwordcheck', "SELECT * FROM users WHERE user_email = '" . $_POST['email'] . "'");
    if ($totalRows_passwordcheck == 1) {
        //SEND EMAIL WITH PASSWORD
        $password = $row_passwordcheck['user_password'];
        $emailfrom = $row_passwordcheck['user_email'];
        $name = "Simple Customer";
        $subject = "Your Password";
        $message = "Your password is {$password}.";
        $emailto = $row_passwordcheck['user_email'];
        mail($emailto, $subject, $message, "From: {$name} <{$emailfrom}>\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1") . redirect('Your password has been sent.', "login.php");
        //END SEND EMAIL
    }
    if ($totalRows_passwordcheck < 1) {
        set_msg('That email address was not found in the database.');
        header('Location: password.php');
        die;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
Ejemplo n.º 8
0
//PAGINATION
$limit = "";
$epp = 25;
//entries per page
record_set('results', "SELECT contact_id FROM contacts");
$entries_per_page = $epp;
$page_number = empty($_GET['page']) ? 1 : $_GET['page'];
//current page
$total_pages = ceil($totalRows_results / $entries_per_page);
$offset = ($page_number - 1) * $entries_per_page;
$prev = $page_number - 1;
$next = $page_number + 1;
$limit = "LIMIT {$offset}, {$entries_per_page}";
//
//get contacts
record_set('contactlist', "SELECT * FROM contacts {$sorder} {$limit}");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php 
echo $pagetitle;
?>
s</title>
<script src="includes/lib/prototype.js" type="text/javascript"></script>
<script src="includes/src/effects.js" type="text/javascript"></script>
<script src="includes/validation.js" type="text/javascript"></script>
<script src="includes/src/scriptaculous.js" type="text/javascript"></script>

<link href="includes/style.css" rel="stylesheet" type="text/css" />
Ejemplo n.º 9
0
<?php

require_once 'includes/config.php';
include 'includes/sc-includes.php';
$pagetitle = 'Profile';
//get user information
record_set('profile', "SELECT * FROM users WHERE user_id = " . $userid . "");
if (!$totalRows_profile) {
    die;
}
//UPDATE PROFILE
if (!empty($_POST['email'])) {
    $password = $row_profile['user_password'];
    if ($_POST['password']) {
        $password = addslashes($_POST['password']);
    }
    mysql_query("UPDATE users SET \r\n\t\tuser_email = '" . trim(addslashes($_POST['email'])) . "', \r\n\t\tuser_password = '******', \r\n\t\tuser_home = '" . trim(addslashes($_POST['home'])) . "'\r\n\tWHERE user_id = " . $userid . "\r\n");
    set_msg('Profile Updated');
    $_SESSION['user'] = addslashes($_POST['email']);
    redirect('Your changes have been saved.', 'profile.php');
}
//
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Profile</title>
<script src="includes/lib/prototype.js" type="text/javascript"></script>
<script src="includes/src/effects.js" type="text/javascript"></script>
//
//UPDATE HISTORY
record_set('checkhistory', "SELECT history_contact FROM history WHERE history_contact = " . $_GET['id'] . "");
if ($totalRows_checkhistory > 0) {
    mysql_query("UPDATE history SET history_status = 2 WHERE history_contact = " . $_GET['id'] . "");
}
mysql_query("INSERT INTO history (history_contact, history_date, history_status) VALUES\n(\n\t" . $row_contact['contact_id'] . ",\n\t" . time() . ",\n\t1\n)\n");
//
//can this user edit this contact?
$can_edit = 0;
if ($user_admin || $userid == $row_contact['contact_id']) {
    $can_edit = 1;
}
//
//automatically add custom field data to contacts contact_custom field
record_set('cfields', "SELECT * FROM fields_assoc WHERE cfield_contact = " . $_GET['id'] . "");
do {
    $data .= $row_cfields['cfield_value'] . ", ";
    mysql_query("UPDATE contacts SET contact_custom = '" . $data . "' WHERE contact_id = " . $_GET['id'] . "");
} while ($row_cfields = mysql_fetch_assoc($cfields));
//
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php 
echo $row_contact['contact_first'];
?>
 <?php 
echo $row_contact['contact_last'];
Ejemplo n.º 11
0
</p>
<?php 
    if ($row_contact['contact_profile']) {
        ?>
   
 <hr />
  <strong>Background</strong><br />
  <?php 
        echo $row_contact['contact_profile'];
    }
    ?>


<?php 
    //additional fields
    record_set('additional', "SELECT * FROM fields INNER JOIN fields_assoc ON cfield_field = field_id WHERE cfield_contact = " . $row_contact['contact_id'] . " AND cfield_value IS NOT NULL AND cfield_value != ''");
    if ($totalRows_additional) {
        ?>
<hr />
<strong>Additional Information</strong>
<br />
<?php 
        do {
            echo $row_additional['field_title'] . ": " . $row_additional['cfield_value'];
            ?>
<br />
<?php 
        } while ($row_additional = mysql_fetch_assoc($additional));
        ?>

<?php 
Ejemplo n.º 12
0
include 'includes/sc-includes.php';
$pagetitle = 'Users';
mysql_select_db($database_contacts, $contacts);
//restrict access
if (!$user_admin) {
    header('Location: contacts.php');
    die;
}
//
$update = isset($_GET['id']) ? 1 : 0;
$add = isset($_GET['add']) ? 1 : 0;
if (!$update && !$add) {
    record_set('users', "SELECT * FROM users ORDER BY user_email ASC");
}
if ($update) {
    record_set('userp', "SELECT * FROM users WHERE user_id = " . $_GET['id'] . "");
}
$password = $row_userp['user_password'];
if ($_POST['password']) {
    $password = $_POST['password'];
}
//ADD user
if ($add && $_POST['user_email']) {
    mysql_query("INSERT INTO users (user_level, user_email, user_password, user_home) VALUES\n\n(\n\t'" . $_POST['user_level'] . "',\n\t'" . trim($_POST['user_email']) . "',\n\t'" . $password . "',\n\t'contacts.php'\n)\n\n");
    set_msg('User Added');
    header('Location: users.php');
    die;
}
//
//don't let an admin change their own status to anything but admin
$ulevel = $_POST['user_level'];
Ejemplo n.º 13
0
//
//GET OPTION INFORMATION
function get_option($opt)
{
    $query = mysql_query("SELECT option_value FROM options WHERE option_title = '" . $opt . "'");
    $result = mysql_fetch_array($query);
    return $result['option_value'];
}
//
$contactcount = mysql_query("SELECT * FROM contacts") or die(mysql_error());
$contactcount = mysql_num_rows($contactcount);
//not applicable
$na = '<span style="color:#CCCCCC">N/A</span>';
//
//get tags
record_set('tags', "SELECT * FROM tags INNER JOIN tags_assoc ON itag_tag = tag_id INNER JOIN contacts ON contact_id = itag_contact ORDER BY tag_description ASC");
//
//list of states
$state_list = array('AL' => "Alabama", 'AK' => "Alaska", 'AZ' => "Arizona", 'AR' => "Arkansas", 'CA' => "California", 'CO' => "Colorado", 'CT' => "Connecticut", 'DE' => "Delaware", 'DC' => "District Of Columbia", 'FL' => "Florida", 'GA' => "Georgia", 'HI' => "Hawaii", 'ID' => "Idaho", 'IL' => "Illinois", 'IN' => "Indiana", 'IA' => "Iowa", 'KS' => "Kansas", 'KY' => "Kentucky", 'LA' => "Louisiana", 'ME' => "Maine", 'MD' => "Maryland", 'MA' => "Massachusetts", 'MI' => "Michigan", 'MN' => "Minnesota", 'MS' => "Mississippi", 'MO' => "Missouri", 'MT' => "Montana", 'NE' => "Nebraska", 'NV' => "Nevada", 'NH' => "New Hampshire", 'NJ' => "New Jersey", 'NM' => "New Mexico", 'NY' => "New York", 'NC' => "North Carolina", 'ND' => "North Dakota", 'OH' => "Ohio", 'OK' => "Oklahoma", 'OR' => "Oregon", 'PA' => "Pennsylvania", 'RI' => "Rhode Island", 'SC' => "South Carolina", 'SD' => "South Dakota", 'TN' => "Tennessee", 'TX' => "Texas", 'UT' => "Utah", 'VT' => "Vermont", 'VA' => "Virginia", 'WA' => "Washington", 'WV' => "West Virginia", 'WI' => "Wisconsin", 'WY' => "Wyoming");
//
$state_list_ca = array("BC" => "British Columbia", "ON" => "Ontario", "NF" => "Newfoundland", "NS" => "Nova Scotia", "PE" => "Prince Edward Island", "NB" => "New Brunswick", "QC" => "Quebec", "MB" => "Manitoba", "SK" => "Saskatchewan", "AB" => "Alberta", "NT" => "Northwest Territories", "YT" => "Yukon Territory");
//
$country_list = array('US' => 'United States', 'CA' => 'Canada', 'AF' => 'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua And Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia And Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos (Keeling) Islands', 'CO' => 'Columbia', 'KM' => 'Comoros', 'CG' => 'Congo', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'Cote D\'Ivorie (Ivory Coast)', 'HR' => 'Croatia (Hrvatska)', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'CD' => 'Democratic Republic Of Congo (Zaire)', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'TP' => 'East Timor', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FK' => 'Falkland Islands (Malvinas)', 'FO' => 'Faroe Islands', 'FJ' => 'Fiji', 'FI' => 'Finland', 'FR' => 'France', 'FX' => 'France, Metropolitan', 'GF' => 'French Guinea', 'PF' => 'French Polynesia', 'TF' => 'French Southern Territories', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard And McDonald Islands', 'HN' => 'Honduras', 'HK' => 'Hong Kong', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KW' => 'Kuwait', 'KG' => 'Kyrgyzstan', 'LA' => 'Laos', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macau', 'MK' => 'Macedonia', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar (Burma)', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'NL' => 'Netherlands', 'AN' => 'Netherlands Antilles', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'KP' => 'North Korea', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn', 'PL' => 'Poland', 'PT' => 'Portugal', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russia', 'RW' => 'Rwanda', 'SH' => 'Saint Helena', 'KN' => 'Saint Kitts And Nevis', 'LC' => 'Saint Lucia', 'PM' => 'Saint Pierre And Miquelon', 'VC' => 'Saint Vincent And The Grenadines', 'SM' => 'San Marino', 'ST' => 'Sao Tome And Principe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovak Republic', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', 'GS' => 'South Georgia And South Sandwich Islands', 'KR' => 'South Korea', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard And Jan Mayen', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syria', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad And Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks And Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'UK' => 'United Kingdom', 'UM' => 'United States Minor Outlying Islands', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VA' => 'Vatican City (Holy See)', 'VE' => 'Venezuela', 'VN' => 'Vietnam', 'VG' => 'Virgin Islands (British)', 'VI' => 'Virgin Islands (US)', 'WF' => 'Wallis And Futuna Islands', 'EH' => 'Western Sahara', 'WS' => 'Western Samoa', 'YE' => 'Yemen', 'YU' => 'Yugoslavia', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe');
//search array
$like_where_array = array();
$like_where_array[] = 'contact_first';
$like_where_array[] = 'contact_last';
$like_where_array[] = 'contact_title';
$like_where_array[] = 'contact_street';
$like_where_array[] = 'contact_company';
$like_where_array[] = 'contact_city';
Ejemplo n.º 14
0
                }
            }
        }
        //
        //end add extra fields
        $checkc = mysql_num_rows(mysql_query("SELECT * FROM contacts WHERE contact_id = " . $data[0] . ""));
        if ($checkc > 0) {
            mysql_query("UPDATE contacts SET\r\n\r\n\tcontact_first = '" . addslashes($data[1]) . "',\r\n\tcontact_last = '" . addslashes($data[2]) . "',\r\n\tcontact_title = '" . addslashes($data[3]) . "',\r\n\tcontact_company = '" . addslashes($data[4]) . "',\r\n\tcontact_street = '" . addslashes($data[5]) . "',\r\n\tcontact_city = '" . addslashes($data[6]) . "',\r\n\tcontact_state = '" . addslashes($data[7]) . "',\r\n\tcontact_zip = '" . addslashes($data[8]) . "',\r\n\tcontact_country = '" . addslashes($data[9]) . "',\r\n\tcontact_email = '" . addslashes($data[10]) . "',\r\n\tcontact_phone = '" . addslashes($data[11]) . "',\r\n\tcontact_cell = '" . addslashes($data[12]) . "',\r\n\tcontact_web = '" . addslashes($data[13]) . "',\r\n\tcontact_profile = '" . addslashes($data[14]) . "'\r\n\r\nWHERE contact_id = " . $data['0'] . "\r\n");
        } else {
            if ($row > 1) {
                //INSERT NEW RECORDS
                mysql_query("INSERT INTO contacts (contact_first, contact_last, contact_title, contact_company, contact_street, contact_city, contact_state, contact_zip, contact_country, contact_email, contact_phone, contact_fax, contact_web, contact_profile) VALUES\r\n\r\n(\r\n\t   '" . addslashes($data[1]) . "',\r\n\t   '" . addslashes($data[2]) . "',\r\n\t   '" . addslashes($data[3]) . "',\r\n\t   '" . addslashes($data[4]) . "',\r\n\t   '" . addslashes($data[5]) . "',\r\n\t   '" . addslashes($data[6]) . "',\r\n\t   '" . addslashes($data[7]) . "',\r\n\t   '" . addslashes($data[8]) . "',\r\n\t   '" . addslashes($data[9]) . "',\r\n\t   '" . addslashes($data[10]) . "',\r\n\t   '" . addslashes($data[11]) . "',\r\n\t   '" . addslashes($data[12]) . "',\r\n\t   '" . addslashes($data[13]) . "',\r\n\t   '" . addslashes($data[14]) . "'\r\n)\r\n\r\n");
                $cid = mysql_insert_id();
                //add extra fields
                foreach ($cf as $key => $value) {
                    record_set('fields', "SELECT * FROM fields WHERE field_title = '" . addslashes($value) . "'");
                    if ($totalRows_fields) {
                        mysql_query("INSERT INTO fields_assoc (cfield_field, cfield_contact, cfield_value) VALUES\r\n\t\t\t\r\n\t\t\t(\r\n\t\t\t\t'" . $row_fields['field_id'] . "',\r\n\t\t\t\t'" . $cid . "',\r\n\t\t\t\t'" . addslashes($data[$key]) . "'\r\n\t\t\t)\r\n\t\t\r\n\t\t");
                    }
                }
                //end add extra fields
                mysql_query("INSERT INTO history (history_contact, history_date, history_status) VALUES\r\n(\r\n\t" . $cid . ",\r\n\t" . time() . ",\r\n\t1\r\n)\r\n");
                //
            }
            $row++;
        }
    }
    header('Location: contacts.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">