//Website URL
define("SITE_URL","http://cyberthinkinfotech.com/");
//Database connection settings - Online:
define("DB_CONNECT","localhost"); //database server name
define("DB_DATABASE","cyberthink"); //database name
define("DB_USER","cyberthink"); //database user name
define("DB_PASSWORD","cTHINK123"); //database user password
//SMTP Authentication
define("SITE_SMTP_HOST", "");
define("SITE_SMTP_AUTH", false);
define("SITE_SMTP_USER", "");
define("SITE_SMTP_PASSWORD", "");
//Admin Paging settings
define("ADMIN_SITE_PAGE_LIMIT","10");
define("ADMIN_SITE_RECORD_PER_PAGE","25");
//Front Paging settings
define("FRONT_SITE_PAGE_LIMIT","10");
define("FRONT_SITE_RECORD_PER_PAGE","10");
//Admin Folder name
define("ADMIN_FOLDER_NAME","admin/");
//site folder path
define("CLS_FOLDER", "classes/");
define("DYNEMIC_IMAGES","uploaded/");
define("MAIN_CATEGORY",DYNEMIC_IMAGES."maincategory/");
define("NO_IMAGE_JPG",DYNEMIC_IMAGES."noimage.jpg");
define("SERVICES_IMAGE",DYNEMIC_IMAGES."services/");
define("QUESTION_DOC",DYNEMIC_IMAGES."quedoc/");
define("BID_DOC",DYNEMIC_IMAGES."biddoc/");
//Whyworry's Admin's Email id
//define("ADMIN_EMAIL_ID","info@cyberthinkinfotech.com"); // Admin from Email ID define("ADMIN_EMAIL_ID","cyberthinkinfotech@gmail.com"); // Admin from Email ID
define("ADMIN_SEND_RESUME_EMAIL_ID","jobs@cyberThinkinfotech.com"); // Send resume Email ID Jobs
//define("ADMIN_REQUEST_QUOTE_EMAIL_ID","info@cyberthinkinfotech.com"); // Request a Quote Email ID info
//define("ADMIN_REQUEST_QUOTE_EMAIL_ID","cyberthinkinfotech@gmail.com"); // Request a Quote Email ID info
define("ADMIN_REQUEST_QUOTE_EMAIL_ID","Quote@cyberThinkinfotech.com"); // Request a Quote Email ID info
define("ADMIN_REQUEST_QUOTE_EMAIL_CC_ID","quote.cipl@gmail.com"); // Request a Quote Email ID info
//define("ADMIN_REQUEST_QUOTE_EMAIL_CC_ID","nilesh@cyberthinkinfotech.com"); // Request a Quote Email ID info
//admin folder path
define("ADMIN_CSS_FOLDER", "css/");
define("CSS_FILENAME", ADMIN_CSS_FOLDER."stylesheet.css");
//Bottom line settings: @Copyright notes
define("ADMIN_BOTTOM_LINE","© 2006 cyberthinkinfotech.com All rights reserved.");
?>
//Author: Mukesh Variya
//Date: 26/1/2006
//Note: Please do not modify this class
/*
File Name: clsdbconnect.php
Purpose: This file is used for connection of database in admin and front end module. It contains the fuction the add, update, delete, inserted id and to get total rows according to select query.
*/
class DBConnect
{
var $links;
var $db;
var $result;
//connect to mysql database
function DBConnect()
{
/*
These are the connection variables set in the config.inc.php
DB_CONNECT,DB_USER, DB_PASSWORD, DB_DATABASE
*/
$this->links = mysql_connect(DB_CONNECT, DB_USER, DB_PASSWORD);
if(!$this->links)
die("Invalid Connection: ".mysql_error());
$this->db = mysql_select_db(DB_DATABASE,$this->links);
if(!$this->db)
die("Invalid Database Selection: ".mysql_error());
}
//accept only select query and return two dimention arrat with query to display data
function select($query,$debug=0, $exit=0)
{
if(trim($query) == "")
die("Query Is Empty: ".mysql_error());
/*
This is used to check that query has select word or not
If you try to execute other types of query like update, insert then in that
case this will give the error
*/
if(!preg_match("/^select/i",$query))
{
if(trim($query) == "")
die("Query Is Empty: ".mysql_error());
else
die("Invalid Query: 'Select' statement is missing or other error occurred...".mysql_error());
}
$this->result = mysql_query($query,$this->links);
if(!$this->result)
die(" Result Erorr: ".mysql_error()."".$query." ");
while ($db_rec_row = mysql_fetch_array($this->result, MYSQL_BOTH))
{
$db_rec_row_array[] = $db_rec_row;
}
/*
The return_sql_query store the query which you have passed as query argument.
It is return with database record array.
It is used to pass in the paging class.
*/
$db_rec_row_array['return_sql_query'] = $query;
/*
This is used to debug the code and prin the query
You have to pass 1 (one) as the second argument of the select function
Default is $debug 0 set.
The Third argument is used to exit and not browse the page.
*/
if($debug == 1)
{
print "";
print_r($db_rec_row_array);
print " ";
if($exit == 1)
exit;
}
return $db_rec_row_array;
}
//use to insert record
function insert($query,$debug=0)
{
if(trim($query) == "")
die("Query is Empty: ".mysql_error());
/*
This is used to check that query has insert word or not
If you try to execute other types of query in that case this will give the error
*/
if(!preg_match("/^insert/i",$query))
die(" Invalid Query: ".$query." ");
$this->result = mysql_query($query,$this->links);
if(!$this->result)
die(" Result Erorr: ".mysql_error()."".$query." ");
/*
This is used to debug the code and print the query
You have to pass 1 (one) as the second argument of the edit function
Default is $debug 0 set.
*/
if($debug == 1)
{
print "";
print_r("Result ID: ".$this->result." ".$query." ");
print " ";
exit;
}
return $this->result;
}
//use to update record
function update($query,$debug=0)
{
if(trim($query) == "")
die("Query is Empty: ".mysql_error());
/*
This is used to check that query has update word or not
If you try to execute other types of query in that case this will give the error
*/
if(!preg_match("/^update/i",$query))
die(" Invalid Query: ".$query." ");
$this->result = mysql_query($query,$this->links);
if(!$this->result)
die(" Result Erorr: ".mysql_error()."".$query." ");
/*
This is used to debug the code and print the query
You have to pass 1 (one) as the second argument of the edit function
Default is $debug 0 set.
*/
if($debug == 1)
{
print "";
print_r("Result ID: ".$this->result." ".$query." ");
print " ";
exit;
}
return $this->result;
}
//use to insert, update, replace and delete record
function delete($query,$debug=0)
{
if(trim($query) == "")
die("Query is Empty: ".mysql_error());
/*
This is used to check that query has delete word or not
If you try to execute other types of query in that case this will give the error
*/
if(!preg_match("/^delete/i",$query))
die(" Invalid Query: ".$query." ");
$this->result = mysql_query($query,$this->links);
if(!$this->result)
die(" Result Erorr: ".mysql_error()."".$query." ");
/*
This is used to debug the code and print the query
You have to pass 1 (one) as the second argument of the edit function
Default is $debug 0 set.
*/
if($debug == 1)
{
print "";
print_r("Result ID: ".$this->result." ".$query." ");
print " ";
exit;
}
return $this->result;
}
//get the total rows depend on query
function totalrows()
{
if(!$this->result)
die(" Result Erorr: ".mysql_error()."".$query." ");
return mysql_num_rows($this->result);
}
//get the affacted rows
function affectedrows()
{
if(!$this->result)
die(" Affacted Rows Erorr: ".mysql_error()."".$query." ");
return mysql_affected_rows($this->result);
}
//get last inserted record id
function insertid()
{
return mysql_insert_id();
}
}
?>
/*
File Name: clscommon.php
Purpose: This file is used for common functions which are used anywhere in the other classes or using direct this class.
*/
class clscommon extends DBConnect
{
//constructor of the clscommon class
function clsCommon()
{
parent::DBConnect();
}
function adminSecutiry()
{
//redirect to ADMIN_REDIRECT_FILE
}
function frontSecutiry()
{
//redirect to FRONT_REDIRECT_FILE
}
function getDateBefore($day, $date_array = 0)
{
$day_before = $day;
$current_day = date("d");
$current_mon = date("m");
$current_year = date("Y");
$current_date = $current_day."-".$current_mon."-".$current_year;
if($current_day >= $day_before)
{
$your_day = $current_day - $day_before;
$your_month = $current_mon;
$your_year = $current_year;
}
elseif($current_day < $day_before)
{
$previous_day = $day_before - $current_day;
$your_day = date("t",mktime(0,0,0,$current_mon));
if($your_month == 12)
$your_month = 11;
if($current_mon == 1)
{
$your_month = 12;
$your_day = date("t",mktime(0,0,0,$your_month))-$previous_day;
$your_year = $current_year-1;
}
else
{
$your_month = $current_mon-1;
$your_day = date("t",mktime(0,0,0,$your_month))-$previous_day;
$your_year = $current_year;
}
}
//set the date to return
$return_date = $your_day."-".$your_month."-".$your_year;
if($date_array == 1)
{
$current_mon."======".$your_day."-".$your_month."-".$current_year;
$j=0;
for($i=0;$i<$day;$i++)
{
if($current_day-$i >= 1)
$date_arr[] = $current_day-$i."-".$current_mon."-".$current_year;
else
{
$mm = $current_mon-1;
$yy = $current_year;
if($mm <=0)
{
$mm = 12;
$yy = $current_year -1;
}
$date_arr[] = date("t",mktime(0,0,0,$your_month))-$j++."-".($mm)."-".$yy;
}
}
return $return_date = $date_arr;
}
else
return $return_date;
}
function checkSublavelStatus($tbl_name, $delete_id)
{
//get the $tbl_name's relative table
$tables = parent::select("select * from `tbl_table_relation` where table_name = '".$tbl_name."'");
$cnt_tables = count($tables);
if($cnt_tables > 1)
{
//explode the sub tables name, fields and messages
$tables_level_2 = explode(",",$tables[0]['table_related_tables']);
$tables_level_2_fields = explode(",",$tables[0]['table_fields']);
$table_message = explode(",",$tables[0]['table_message']);
$cnt_tables_level_2 = count($tables_level_2);
if($cnt_tables_level_2 >= 1)
{
//check for each table with delete id
//weather records exists or not and return the appropriate message
for($i=0;$i<$cnt_tables_level_2;$i++)
{
$exists = parent::select("select ".$tables_level_2_fields[$i]." from ".$tables_level_2[$i]." where ".$tables_level_2_fields[$i]." = '".$delete_id."'");
if(count($exists) > 1)
{
$flag[] = $table_message[$i];
return rawurlencode($flag[$i]);
}
else
$flag[] = "nodelete";
}
return "delete";
/*
if(count($flag))
{
/*
for($f=0;$f '".$_REQUEST['subcat_id']."' order by ".$printcol,1);
for($i=0;$i".$listarray[$i][1]."";
else
$cbo .= "".$listarray[$i][1]." ";
}
return $cbo;
}
function getOptions($tblname, $valuecol, $printcol, $sel="", $orderby="")
{
if($orderby == "")
$listarray = parent::select("select ".$valuecol.", ".$printcol." from `".$tblname."` order by ".$printcol);
else
$listarray = parent::select("select ".$valuecol.", ".$printcol." from `".$tblname."` order by ".$orderby);
for($i=0;$igetField($listarray[$i][0])."' selected>".$this->getField($listarray[$i][1])."";
else
$cbo .= "".$this->getField($listarray[$i][1])." ";
}
return $cbo;
}
//set the value to store in database
function setField($val)
{
return addslashes(trim($val));
}
//get the value to display in original format
function getField($val)
{
return str_replace("