Example #1
0
/**
 * @param string $email The email hash
 * @param string $s Size in pixels, defaults to 80px [ 1 - 512 ]
 * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
 * @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
 * for more info : http://gravatar.com/site/implement/images/php/ 
 */
	function get_gravatar( $email, $s = 20, $d = 'identicon', $r = 'g') {
		
		$obj = new myclass();
		$sql = "SELECT members.*,member_photos.photo, member_photos.Approve FROM members LEFT JOIN member_photos ON members.id = member_photos.member_id WHERE md5(members.email_id)='".$email."'";
		$sql_res=$obj->select($sql);
				
		$path = "upload/".$sql_res[0]['photo'];
		
		if(!empty($sql_res[0]['photo']) && $sql_res[0]['Approve']==1)
		{
			if (file_exists($path)) 
			{
				$avatarSrc=$path;
			}
			else
			{
				if($sql_res[0]['gender']=='M')
				{
					$avatarSrc='images/male-user1.png';
				}
				else
				{
					$avatarSrc='images/female-user1.png';
				}
			}
		}
		else
		{
			if($sql_res[0]['gender']=='M')
			{
				$avatarSrc='images/male-user1.png';
			}
			else
			{
				$avatarSrc='images/female-user1.png';
			}
		}
		
		//$url = 'gravatar.com/avatar/';
	    //$url .= "$email?s=$s&d=$d&r=$r";
	    //return $url;
		return $avatarSrc;
	}
Example #2
0
function quotations_total($id = '')
{
    $obj = new myclass();
    $select_quotations_product = "select * from tbl_quotations_product where Qid='" . $id . "'";
    $db_quotations_product = $obj->select($select_quotations_product);
    $total = 0;
    for ($i = 0; $i < count($db_quotations_product); $i++) {
        $total = $total + $db_quotations_product[$i]['Total'];
    }
    return $total;
}