%@ page language="java" import="java.sql.*" %>
<%!
// ------------------------------------------------------------
// PAGE CONSTANTS
// ------------------------------------------------------------
// Production
String sDatabaseDriver = "org.gjt.mm.mysql.Driver";
String sDatabaseURL = "jdbc:mysql://tig02.com/tig_db";
String sDatabaseUser = "tigadmin";
String sDatabasePassword = "swoosh23";
String sCookieDomain = ".san-diego-breast-augmentation.com"; // It's important that the domain begin with "."
int nCookieAge = 2592000; // 60sec * 60min * 24hrs * 30day = 2592000sec
// ------------------------------------------------------------
// PAGE METHODS
// ------------------------------------------------------------
// METHOD: isValidCID()
// --------------------
boolean isValidCID(String cid) {
boolean bReturnVal = false;
if (cid != null && !cid.equals("")) {
try {
Integer i = Integer.valueOf(cid);
bReturnVal = true;
} catch (Exception e) {
// Do Nothing
}
} else {
// Do Nothing
}
return bReturnVal;
}
// METHOD: writeCookie()
// ---------------------
void writeCookie(HttpServletResponse resp, String name, String value, String domain, int age) {
if (name != null && !name.equals("")) {
Cookie c = new Cookie(name, value);
if (domain != null) {
c.setDomain(domain);
}
c.setMaxAge(age);
resp.addCookie(c);
}
}
// METHOD: insertTrackingInfo()
// ----------------------------
String insertTrackingInfo(HttpServletRequest req, HttpServletResponse resp, String cid) {
String sFailure = "";
String sReturnVal = sFailure;
try {
int nCampaignId, nResult;
nCampaignId = Integer.parseInt(cid);
Class.forName(sDatabaseDriver);
Connection conn = DriverManager.getConnection(sDatabaseURL, sDatabaseUser, sDatabasePassword);
String sSQL = "insert into tracking " +
"(campaign_id, tracking_date, request_url, referrer_url, remote_addr, remote_host, browser, query_string) " +
"values (?, now(), ?, ?, ?, ?, ?, ?)";
PreparedStatement pstmt = conn.prepareStatement(sSQL);
pstmt.setInt(1, nCampaignId);
pstmt.setString(2, req.getServerName() + req.getRequestURI());
pstmt.setString(3, req.getHeader("REFERER"));
pstmt.setString(4, req.getRemoteAddr());
pstmt.setString(5, req.getRemoteHost());
pstmt.setString(6, req.getHeader("USER-AGENT"));
pstmt.setString(7, req.getQueryString());
nResult = pstmt.executeUpdate();
if (nResult > 0) {
sSQL = "select tracking_id from tracking where tracking_id = LAST_INSERT_ID()";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sSQL);
rs.next();
nResult = rs.getInt(1);
rs.close();
stmt.close();
conn.close();
sReturnVal = String.valueOf(nResult);
} else {
pstmt.close();
conn.close();
//sReturnVal = sFailure;
}
} catch (Exception e) {
//sReturnVal = sFailure;
}
return sReturnVal;
}
//name is the name of the parameter we are searching the query for
//only works for a parameter with one value
String getPar(String name, String query)
{
String value="";
name = name.toLowerCase();
query = query.toLowerCase();
query = query.trim();
//find the first char after the equal sign
//should be the first letter of the query plus the lenght of name plus the equal sign
if ((query.indexOf(name))==-1)
value="";
else
{
int findBeg = (name.length() + query.indexOf(name) + 1);
value = query.substring(findBeg);//parse down the string
int findEnd = (value.indexOf("&")); //where to end to pull
if (findEnd == -1)//there is not another parameter aka &
findEnd = value.length(); //
value=value.substring(0,findEnd);
}
return value;
}
boolean getCookie(Cookie[] c)
{
boolean value=false;
for (int x=0; x < c.length; x++)
{
if (c[x].getName().equals("cid"))
{
//test += c[x].getName();
value=true;
}
}
return value;
}
%>
<%
// No matter what, we cannot let this page fail
try {
String cid="";
if (request.getQueryString() == null)
cid="86";
else
cid = getPar("cid",request.getQueryString());
if (isValidCID(cid)) {
if (getCookie(request.getCookies()) == false)//if cookies are not found.
{
writeCookie(response, "cid", cid, sCookieDomain, nCookieAge);
String tid = insertTrackingInfo(request, response, cid);
if (tid != null && !tid.equals("")) {
writeCookie(response, "tid", tid, sCookieDomain, nCookieAge);
}
}
}//isValid
} catch (Exception e) {
// Do nothing
}
%>
San Diego Breast Augmentation
San Diego plastic surgeon - Dr.Stuart Kincaid
Dr.Stuart Kincaid
8929 University Center Lane
Suite 201
San Diego, CA 92122
40963 Winchester Road
Temecula, California 92591
Stuart B. Kincaid, M.D., F.A.C.S. is recognized as one of the premier
cosmetic plastic surgeons in the United States. He was certified
by the American Board of plastic and reconstructive surgery in San
Diego since 1988. He is pleased to announce the recent opening of
his second office in Riverside County located in Temecula. Dr. Kincaid
is a fellow of the American College of Surgeons and is an active
member of the American Society of Plastic Surgeons and the American
Society for Aesthetic Plastic Surgery.
Dr. Kincaid is noted for his artistic, caring and skilled approach
and for delivering exceptional, natural appearing surgical results
of the face, breast and body for both men and women. He genuinely
wants to help each patient attain his or her BEST IMAGE!
Over his many years in practice, Dr. Kincaid has been actively
involved in teaching plastic surgery residents at Stanford University
and the University of California at San Diego. He has participated
in numerous volunteer medical service programs both at home and
internationally.
Dr. Kincaid has a strong commitment to family having two sons and
a daughter. He has resided in north San Diego County since 1988.
In his spare time, Dr. Kincaid pursues many other interests including
photography, golf and chess; and he enjoys traveling with his family
both in the U.S. and abroad.
If you would like to schedule a consultation with Dr. Kincaid
or one of our board certified plastic surgeons click
here or call (800) 505-3627.