$error = array();
function error($arg){
global $error;
$error[] = $arg;
return $error;
}
function display_errors(){
global $error;
if(count(@$error)>0){
?>
for($i=0;$i';
}
?>
}
}
?>
define("ADMINISTRATOR_EMAIL", "jeff@carperfect.com");
define("ADMINISTRATOR_REPLY_TO","do_not_reply@carperfect.com");
define("ADMINISTRATOR_PHONE","407-766-0246");
define('MAX_IMAGE_SIZE', 500000);
define('UPLOAD_DIRECTORY', './images/uploadedImg/');
define('IMAGE_NAME', 'image_file');
define('IMAGE_SUFFIX', '.jpg');
?>
// tracking functions.php
function track($arg){
global $linkid, $PHP_SELF;
// take the $arg, check for another entry that matches and if there is,
// update that record
$query= "select * from tracking where page='$PHP_SELF' and search='$arg'";
$result = mysql_query($query, $linkid);
if(@mysql_num_rows($result)==0){
// this entry does not exist. add it
$last_updated= date('Y-m-d H:i:s');
$query= "insert into tracking (page, search, num_times, last_updated)values('$PHP_SELF', '$arg', '1', '$last_updated')";
mysql_query($query, $linkid);
}else{
// this entry does exist, update it
while($row = mysql_fetch_object($result)){
$id2update = $row->uniqueID;
$num_times = $row->num_times + 1;
}
$last_updated= date('Y-m-d H:i:s');
$query= "update tracking set num_times = '$num_times', last_updated = '$last_updated' where uniqueID='$id2update'";
mysql_query($query, $linkid);
}
}
/**
* @return array
* @param string $order, date(m) $month, date(Y) $year
* @desc This will select all the results from the database and return them in an array.
*/
function get_tracking_results($order, $month, $year){
global $linkid;
$query = "select * from tracking order by $order";
$result = mysql_query($query, $linkid);
$return_val = false;
if(mysql_num_rows($result) != 0){
$return_val = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$m = explode('-',$row['last_updated'],3);
if($m[1] == $month && $m[0] == $year) $return_val[] = $row;
}
if(count($return_val)==0) $return_val = false;
}
return $return_val;
}
/**
* @return array
* @desc This will select all the months and years from the tracking table as a unique array.
*/
function get_tracking_months(){
global $linkid;
$query = "select last_updated from tracking order by last_updated";
$result = mysql_query($query, $linkid);
$return_val = false;
if(mysql_num_rows($result)!=0){
$return_val = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$m = explode('-',$row['last_updated'],3);
if($m[1] != $return_val[count($return_val)-1]['month']){
$return_val[] = array('month' => $m[1], 'year' => $m[0]);
}
}
if(count($return_val)==0) $return_val = false;
}
return $return_val;
}
?>
// find if action is logout
@$action = $_REQUEST['action'];
//
switch(@$action){
case 'logout':
session_unregister("loggedin");
session_unregister("adminlevel");
session_unregister("username");
session_unregister("userid");
session_unregister("returnValue");
//
$_SESSION['loggedin'] = false;
header("Location:".$PHP_SELF);
break;
case 'process_login':
// query for the username and find if they are allowed
@$postPass = base64_encode($_REQUEST['pass']);
@$postEmail = $_REQUEST['email'];
if(!$postPass) error("*Error: The Password field is Required");
if(!$postEmail) error("*Error: The E-mail field is Required");
//
if(count(@$error)==0){
$query = "SELECT * FROM users WHERE email = '$postEmail' AND pword = '$postPass'";
$result = mysql_query($query, $linkid);
if(@mysql_num_rows($result)==0) error("*Error: Login Not Accepted. Please try again");
//
while($row = mysql_fetch_object($result)){
// this user exists
$_SESSION["loggedin"] = true;
$_SESSION["adminlevel"] = $row->adminlevel;
$_SESSION["username"] = $row->email;
$_SESSION["userid"] = $row->id;
// check where to go
if(@$_SESSION["returnValue"]){
header("Location:http://www.carperfect.com/".$_SESSION["returnValue"]);
}else{
if($_SESSION["adminlevel"] == "admin"){
header("Location:http://www.carperfect.com/admin.php");
?>
}else if($_SESSION["adminlevel"] == "user"){
if($postPass == "welcome"){
header("Location:http://www.carperfect.com/changepass.php");
?>
}else{
header("Location:http://www.carperfect.com/user.php");
?>
}
}else if($_SESSION['adminlevel'] == 'data_entry'){
header('Location:Http://www.carperfect.com/data_entry.php');
}
}
}
}
break;
}
//
function displayLogin($thispage){
if(@$_SESSION["loggedin"] != true){
?>
}
}
?>
// search include
function displaySearch(){
$info = '
';
return $info;
}
?>
function displayLeftColumn(){
?>
Business Owners Carperfect.com has developed a risk-free method to convert slow days into busy ones. By harnessing the incredible efficiencies and reach of the Internet, our programs serve to drive dirty cars to participating establishments, creating additional revenues, and repeat visits.