$str[$i] ";
}
}
function view_edit_records($table_name,$unique_table_id,$edit_id){
$sql=mysqli_query($link,"select * from ".$table_name ." where " .$unique_table_id." = ".$edit_id."") or die(mysqli_error());
$rec = mysqli_fetch_array($sql);
return $rec;
}
function fileread_curl( $url )
{
$filename = $url;
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, $filename);
// don't give me the headers just the content
curl_setopt($ch, CURLOPT_HEADER, 0);
// return the value instead of printing the response to browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// use a user agent to mimic a browser
// curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
$content = curl_exec($ch);
// remember to always close the session and free all resources
curl_close($ch);
return $content;
}
function getValueById($table,$field,$id_name,$id)
{
$return = '';
$sql_temp = "SELECT ".$field." from ".$table." where ".$id_name."='".$id."'";
$rs_temp = mysqli_query($link,$sql_temp);
$cnt_temp = mysqli_num_rows($rs_temp);
if($cnt_temp!=0)
{
$row_temp = mysqli_fetch_row($rs_temp);
$return = $row_temp[0];
}
return $return;
}
//Function to make thumnail of the image
function thumbnail($imagepath,$Img_Upload_Path)
{
$save = $Img_Upload_Path."thm_" . $imagepath; //This is the new file you saving
$file = $Img_Upload_Path . $imagepath; //This is the original file
list($width, $height,$type) = getimagesize($file) ;
$modwidth = 150;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
switch($type)
{
case 1:
$image = imagecreatefromgif($file) ;
break;
case 2:
$image = imagecreatefromjpeg($file) ;
break;
case 3:
$image = imagecreatefrompng($file) ;
break;
default:
return false;
}
@imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
@imagejpeg($tn, $save, 100);
@chmod($Img_Upload_Path.$imagepath,0777);
@chmod($Img_Upload_Path.'thm_'.$imagepath,0777);
return $Img_Upload_Path.'thm_'.$imagepath;
}
function fn_create_thumbnail_image($name,$folder_name)
{
$save = $folder_name."/thumb_".$name; //This is the new file you saving
$file = $folder_name."/".$name; //This is the original file
list($width, $height,$type) = getimagesize($file) ;
if($width>=$height){
$modwidth = 120;
$diff = $width / $modwidth;
$modheight = $height / $diff;
}
else
{
$modheight = 90;
$diff = $height / $modheight;
$modwidth = $width / $diff;
}
$tn = imagecreatetruecolor($modwidth, $modheight) ;
switch($type)
{
case 1:
$image = imagecreatefromgif($file) ;
break;
case 2:
$image = imagecreatefromjpeg($file) ;
break;
case 3:
$image = imagecreatefrompng($file) ;
break;
default:
return false;
}
@imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
@imagejpeg($tn, $save, 100);
return "thumb_".$name;
}
function fn_return_email_templates($code)
{
$sql_temp = "select * from ".EMAIL_TEMPLATE." where code LIKE '".mysqli_escape_string($code)."' LIMIT 1";
$rs_temp = mysqli_query($link,$sql_temp);
$count_temp = mysqli_num_rows($rs_temp);
if($count_temp)
{
$row_temp = mysqli_fetch_assoc($rs_temp);
$returnValue[0] = true;
$returnValue[1] = $row_temp['email_from'];
$returnValue[2] = $row_temp['subject'];
$returnValue[3] = $row_temp['body'];
}
else{
$returnValue[0] = false;
$returnValue[1] = '';
$returnValue[2] = '';
$returnValue[3] = '';
}
return $returnValue;
}
function br2nl($text)
{
return preg_replace('/
/i', '', $text);
}
function WordLimiter($text,$limit)
{
$explode = explode(' ',$text);
$string = '';
$dots = '...';
if(count($explode) <= $limit)
{
$dots = '';
for($i=0;$i0)
{
while($sql_rows=mysqli_fetch_array($sql_query))
{
?>
0)
{
$row_seller_type=mysqli_fetch_array($qry_seller_type);
if($row_seller_type['role']=='Dealer')
{
$sql_dealer_name="SELECT * FROM ".REGISTER." where id=".$row_seller_type['dealer_member'];
$qry_dealer_name=mysqli_query($link,$sql_dealer_name);
$row_dealer_name=mysqli_fetch_array($qry_dealer_name);
$seller_type=$row_dealer_name['username'];
}
else
{
$seller_type='Private Seller';
}
}
return $seller_type;
}
function get_user_fromemail($email)
{
global $link;
$sql_user_id="SELECT id FROM ".REGISTER." where email=".$email;
$qry_user_id=mysqli_query($link,$sql_user_id);
$row_user_id=mysqli_fetch_array($qry_user_id);
return $row_user_id['id'];
}
function get_department_name($id)
{
global $link;
$sql="SELECT department_name FROM ".DEPARTMENT." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['department_name'];
}
function get_specialism_name($id)
{
global $link;
$sql="SELECT specialism_name FROM ".SPECIALISM." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['specialism_name'];
}
function specialism_cv($id)
{
global $link;
$sql="SELECT specialism_name FROM ".SPECIALISM_CV." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['specialism_name'];
}
function contract_type($id)
{
global $link;
$sql="SELECT * FROM ".CONTRACT_TYPE." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['contract_type'];
}
function job_title($id)
{
global $link;
$sql="SELECT * FROM ".JOB_DETAILS." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['job_title'];
}
function total_apply($id)
{
global $link;
$sql="SELECT * FROM ".APPLYCV." where job_id='".$id."'";
$qry=mysqli_query($link,$sql);
$num=mysqli_num_rows($qry);
return $num;
}
function job_Conract($id)
{
global $link;
$sql="SELECT * FROM ".CONTRACT_TYPE." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['contract_type'];
}
function job_sector($id)
{
global $link;
$sql="SELECT * FROM ".BUSINESS_SECTOR." where id='".$id."'";
$qry=mysqli_query($link,$sql);
$row=mysqli_fetch_array($qry);
return $row['business_sector'];
}
function dateDiffInDays($date2)
{
$date1 = date("d-m-Y");
$date2 = $date2;
// Calulating the difference in timestamps
$diff = strtotime($date2) - strtotime($date1);
// 1 day = 24 hours
// 24 * 60 * 60 = 86400 seconds
$dateDiff= abs(round($diff / 86400));
return "Posted: ". $dateDiff . " Days ago";
}
?>