$DB_USERNAME="c1_kayako";
$DB_PASSWORD="kay#11??kay";
$DB_HOST="localhost";
//$DB_USERNAME="root";
//$DB_PASSWORD="";
$DB_DATABASE="c1_kayako";
$MyDB = mysql_connect($DB_HOST,$DB_USERNAME,$DB_PASSWORD) or die (mysql_error());
mysql_select_db($DB_DATABASE,$MyDB) or die (mysql_error());
global $MyDB;
global $MySQL3;
global $datefrom;
global $dateto;
global $dbCore;
$email=$_POST['email'];
if ($_POST['email']){
$MySQL2 = "SELECT email FROM `swuseremails` where email='$email'";
$MyQuery = mysql_query($MySQL2,$MyDB) or die(mysql_error());
$MyNeiCount = mysql_num_rows($MyQuery);
if ($MyNeiCount > 0){
//echo "Your Email is found!";
?>
Fill in the fields below with as much detailed information as possible and send it to our support personnel. Fields marked with * are required
//insert query here
}else{
// Mail does not exist in the system
//echo "Your Email doesnt exist!";
?>
Please fill this form out and one of our support representatives will be in touch with you as soon as possible. After you submit this form for the first time you can email help@servsuite.net to automatically create a ticket in our support system.
';
// mail ("support@servsuite.net", $subject, $message, $headers );
mail ("help@servsuite.net", $subject, $message,$mail['headers']);
echo "a representative will review your submission and get back with you within 24 working hours.";
//turn this into a ticket
if($_POST['email2'] != NULL)
{
//create a ticket mask
$prefix = strtoupper(chr(mt_rand(65,90)) . chr(mt_rand(65,90)) . chr(mt_rand(65,90)));
$ticketmaskid = $prefix . "-" . mt_rand(100000,999999);
$user_email = $_POST['email2'];
$phone = $_POST['phone'];
//contact person who filled out the form
$contact = $_POST['name'];
//Company Name
$pullname = mysql_query("SELECT fullname, phone FROM swusers
LEFT JOIN `swuseremails` as theemail ON swusers.userid = theemail.userid
WHERE theemail.email = '$user_email'") or die(msyql_error());
$usersname = mysql_fetch_array($pullname);
$username = $usersname['fullname'];
$company_phone = $usersname['phone'];
//get todays time in a unix timestamp
$today = time();
//subject
$ticket_subject = $_POST['subject'];
//description goes into the posts table
$message = $_POST['description'];
//get user id
$user_id_select = mysql_query("SELECT userid FROM swusers
WHERE fullname = '$username'") or die(mysql_error());
$pull_user_id = mysql_fetch_array($user_id_select);
$user_id = $pull_user_id['userid'];
//turn this form into a ticket
$inserticket = mysql_query("INSERT INTO swtickets (ticketmaskid, departmentid, priorityid, ticketstatusid, fullname, email, subject, dateline, lastactivity, duetime, phoneno, charset, userid)
VALUES ('$ticketmaskid', '3', '1', '26', '$username', '$user_email', '$ticket_subject', '$today', '$today', '$today', '$phone', 'UTF-8', '$user_id')") or die(mysql_error());
//find the ticket id of the ticket we just created
$spot_id = mysql_insert_id();
//create the message to include contact name, contacts phone (both from form) and company phone number
//no need to have all this info in the tickets, taking it out and just adding what the user wrote
/*$uncleanmessage = $_POST['description']."
Entered from help.theservicepro.net User who entered this ". $contact ." Their phone number ". $phone ." Company Phone ". $company_phone;
$cleanmessage = mysql_real_escape_string($uncleanmessage); */
//regular way to get message
$uncleanmessage = $_POST['description']."
From ". $contact." at number ". $phone;
$message = mysql_real_escape_string($uncleanmessage);
//create the post and link it to the ticket using $spot_id
$insertpost = mysql_query("INSERT INTO swticketposts (ticketid, dateline, fullname, email, contents, userid)
VALUES('$spot_id', '$today', '$username', '$user_email', '$message', '$user_id')") or die(mysql_error());
//let em know it works
echo "Ticket sucesfully added to database";
}
} else{
if ($_POST['email3']){
$mail['headers'] = "X-Sender: ServicePro.Net Staff\n"; // origin info
$mail['headers'] .= "X-Mailer: ServicePro.v1.0\n";
$mail['headers'] .= "X-Priority: 1\n"; // Urgent message!
$mail['headers'] .= "Return-Path: Service Pro.Net Staff\n"; // Return path for
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ServicePro.Net ";
$subject = "Ticket Registration - From: ".$_POST['company_name'];
$message = 'Company Name: '.$_POST['company_name'].' ';
$message .= 'Email: '.$_POST['email3'].' ';
$message .= 'Address: '.$_POST['address'].' ';
$message .= 'City: '.$_POST['city'].' ';
$message .= 'State: '.$_POST['state'].' ';
$message .= 'Zip: '.$_POST['zip'].' ';
$message .= 'Phone Number: '.$_POST['phone_number'].' ';
$message .= 'Contact Name: '.$_POST['contact_name'].' ';
$message .= 'Description: '.$_POST['description'].'
';
//mail ("helpservsuite@gmail.com", $subject, $message, $headers );
mail ("michelle@servsuite.net, supporttickets@servsuite.net", $subject, $message,$mail['headers']);
?>
a representative will review your submission and get back with you within 24 working hours.
}else{
?>
Please enter your email address to submit a ticket to our support staff.
}//End Else $_POST['email3'] if Email is not is found
}//End Else $_POST['email2'] if Email is found
}
?>