<<<<Restricted Area>>>>" . "
Sorry, you must Log In to view this Page

"); exit(); } $usrn = $_GET['usrn']; if($usrn == ""){ $usrn = $_POST['usrn']; } if($usrn == ""){ echo("

<<<<Restricted Area>>>>" . "
Problem with your username. Please Log In again.

"); exit(); } $air=array(); $usrnamesplit=explode(" ",$usrn); $usrnf=$usrnamesplit[0]; $usrnl=$usrnamesplit[1]; $first_Name = stripslashes($_POST['first_Name']); $Name = stripslashes($_POST['Name']); $Title = stripslashes($_POST['Title']); $Company = stripslashes($_POST['Company']); $mailCompany = $Company; $Company = htmlspecialchars($Company, ENT_QUOTES, 'utf-8'); $first_Name = htmlspecialchars($first_Name, ENT_QUOTES, 'utf-8'); $Name = htmlspecialchars($Name, ENT_QUOTES, 'utf-8'); $Title = htmlspecialchars($Title, ENT_QUOTES, 'utf-8'); $Company = htmlspecialchars($Company, ENT_QUOTES, 'utf-8'); $biztype = $_POST['biztype']; $Phone = $_POST['Phone']; $Address = stripslashes($_POST['Address']); $Address = htmlspecialchars($Address, ENT_QUOTES, 'utf-8'); $FAX = $_POST['FAX']; $City = stripslashes($_POST['City']); $City = htmlspecialchars($City, ENT_QUOTES, 'utf-8'); $email = $_POST['email']; $price_level = $_POST['price_level']; $referred_by = $_POST['referred_by'];//string rf or rp:RID:name explode:4info $referee = explode(':', $referred_by); $referrer = $referee[1]; $ref_name = $referee[2]; $mkt = $_POST['mkt']; $State = $_POST['State']; $Country = $_POST['Country']; $ZipCode = $_POST['ZipCode']; $alt_con = $_POST['alt_con']; $alt_title = $_POST['alt_title']; $alt_email = $_POST['alt_email']; $Link = $_POST['Link']; $act_month = $_POST['act_month']; $act_day = $_POST['act_day']; $act_year = $_POST['act_year']; $contact_type = $_POST['contact_type']; $act_respond = $_POST['act_respond']; $RID = $_POST['RID']; $react_month = $_POST['react_month']; $react_day = $_POST['react_day']; $react_year = $_POST['react_year']; $Notes = stripslashes($_POST['Notes']); $mailNotes = $Notes; $Notes = htmlspecialchars($Notes, ENT_QUOTES, 'utf-8'); $ID = $_POST['ID']; $usremail = $_POST['usremail']; $repname = $_POST['repname']; $today = date("F j, Y"); $dtnum = date(Ymd); $alert_changes=array(); ?>
Contacts Eco-$mart, Inc.  On-line Administration
Contact for    ~ ~
Could not update Contact Information. Error: ".mysql_error()."

"); }//not ok if($act_month != ""){ $alert_changes[]="Activity"; $ok2 = @mysql_query("INSERT INTO con_activity SET CID='$ID',act_year='$act_year',act_month='$act_month',act_day='$act_day',contact_type='$contact_type',act_respond='$act_respond',usrn='$usrn',dtnum='$dtnum'"); if ($ok2) { echo("

Successful Update to Activity Report

"); }else{ echo("

Could not update Activity Report. Error: ".mysql_error()."

"); }//not ok 2 }//act month is changed if($react_month != ""){ $alert_changes[]="Re-Contact"; $ok2b = @mysql_query("DELETE FROM con_reactivity WHERE CID='$ID' LIMIT 1"); if (!$ok2b) { echo("

Problem with Re-contact

"); }//not ok2b $ok2c = @mysql_query("INSERT INTO con_reactivity SET CID='$ID',react_year='$react_year',react_month='$react_month',react_day='$react_day',usrn='$usrn',dtnum='$dtnum'"); if ($ok2c) { echo("

Successful Re-contact Set

"); }else{ echo("

Could not set Re-contact. Error: ".mysql_error()."

"); }//not ok2c }//react month is changed if($Notes != ""){ $alert_changes[]="Notes"; $ok3 = @mysql_query("INSERT INTO con_notes SET CID='$ID',Notes='$Notes',usrn='$usrn',dtnum='$dtnum'"); if ($ok3) { echo("

Successful Update to Contact Notes

"); }else{ echo("

Could not update Contact Notes. Error: ".mysql_error()."

"); }//not ok3 }//notes are not blank if(!empty($alert_changes)){ mysql_select_db('ecosmar_website', $dbcnx); $rg_check=mysql_query("SELECT region,director FROM repcon WHERE name_1='$usrnf' and name_2='$usrnl'"); if(!$rg_check){ $air[]="Could not get Representative Region. Error: ".mysql_error(); }else{ $rgrow=mysql_fetch_array($rg_check); $region=$rgrow[0]; $director=$rgrow[1]; if($director!="a"){//usrn is not a director $rg_get_dir=mysql_query("SELECT name_1,name_2 FROM repcon WHERE region='$region' and director='a'"); if(!$rg_get_dir){ $air[]="Could not get Director Info. Error: ".mysql_error(); }else{//selected director name $drow=mysql_fetch_array($rg_get_dir); if($drow[0]!=""){ $dir_usrn=$drow[0]." ".$drow[1]; $rg_dir_em=mysql_query("SELECT email FROM psw WHERE usrn='$dir_usrn'"); if(!$rg_dir_em){ $air[]="Could not get Director email. Error: ".mysql_error(); }else{ $mrow=mysql_fetch_array($rg_dir_em); if($mrow[0]!=""){ $recipients[]="mross@eco-smart.com"; $recipients[]="kwgrubbs@kwgrubbs.com"; $recipients[]=$mrow[0]; $dire="Notification Copied to: ".$mrow[0]; }else{ $recipients[]="mross@eco-smart.com"; $recipients[]="kwgrubbs@kwgrubbs.com"; $dire="No Regional Director Email."; }//no director email }//selected director email }//director name not blank else{ $recipients[]="mross@eco-smart.com"; $recipients[]="kwgrubbs@kwgrubbs.com"; $dire="No Regional Director."; }//director name is blank }//selected director name }//usrn is not a director else{ $recipients[]="mross@eco-smart.com"; $recipients[]="kwgrubbs@kwgrubbs.com"; $dire="Sole Recipient"; }//usrn is director }//got rg check $changes="CHANGES TO "; foreach($alert_changes as $value){ $changes=$changes." - ".$value." - "; }//4each foreach($recipients as $value){ $subject = "Eco-\$mart Contact Edited"; $message = "EDITED BY: $usrn" . "\n" . "EMAIL: $usremail" . "\n" . "$changes" . "\n" . "$dire" . "\n" . "-------------------------------" . "\n" . "Contact:" . "\n" . "$first_Name $Name" . "\n" . "$mailCompany" . "\n" . "$Address" . "\n" . "$City $State $ZipCode" . "\n" . "PHONE: $Phone" . "\n" . "EMAIL: $email" . "\n" . "BUSINESS TYPE: $biztype" . "\n" . "\n" . "NOTE: $mailNotes" . "\n" . "-------------------------------" . "\n" . "\n" . "View or Edit this Contact in Eco-\$mart Contacts On-line:" . "\n" . "Go to http://www.ecosmartinc.com/ecos/ecologin.htm" . "\n" . "\n"; $headers = 'From: info@ecosmartinc.com' . "\r\n" . 'Reply-To: info@ecosmartinc.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(@mail($value, $subject, $message, $headers)) { echo("

Notification Sent

"); }else{ echo("

Error Sending Notice of New Contact!

"); }//notmailed }//4each recipient }//there are change alerts if($nuffdone=="yes"){ echo("

Successful Update to Eco-\$mart Contacts
" . "Return to Contact Page

"); }//nuff done ?>
 Your Contacts   New Contact  Search Your Contacts
Get CSV Help  Return to Your Page 
Eco-$mart Products
©2012 - Data Base Interface - Custom Built at:  kwgrubbs.com
$value"); } }//air is not empty ?>