jitendra help

0
246

function mail_attachment ($from ,$from_email, $to, $subject, $message, $attachment){
$fileatt = $attachment; // Path to the file
$fileatt_type = “application/octet-stream”; // File Type
$start=strrpos($attachment, ‘/’) == -1 ? strrpos($attachment, ‘//’) : strrpos($attachment, ‘/’)+1;
$fileatt_name = substr($attachment, $start, strlen($attachment)); // Filename that will be used for the file as the attachment

$email_from = $from_email; // Who the email is from
$email_subject = $subject; // The Subject of the email
$email_txt = $message; // Message that the email has in it

$email_to = $to; // Who the email is to

$headers = “From: $from”;;

$file = fopen($fileatt,’rb’);
$data = fread($file,filesize($fileatt));
fclose($file);
$msg_txt=”nnMail created using free code from 4word systems : http://4wordsystems.com”;

$semi_rand = md5(time());
$mime_boundary = “==Multipart_Boundary_x{$semi_rand}x”;

$headers .= “nMIME-Version: 1.0n” .
“Content-Type: multipart/mixed;n” .
” boundary=”{$mime_boundary}””;

#$email_txt .= $msg_txt;

$email_message .= “This is a multi-part message in MIME format.nn” .
“–{$mime_boundary}n” .
“Content-Type:text/html; charset=”iso-8859-1″n” .
“Content-Transfer-Encoding: 7bitnn” .
$email_txt . “nn”;

$data = chunk_split(base64_encode($data));

$email_message .= “–{$mime_boundary}n” .
“Content-Type: {$fileatt_type};n” .
” name=”{$fileatt_name}”n” .
//”Content-Disposition: attachment;n” .
//” filename=”{$fileatt_name}”n” .
“Content-Transfer-Encoding: base64nn” .
$data . “nn” .
“–{$mime_boundary}–n”;

$ok = mail($email_to, $email_subject, $email_message, $headers);

if($ok) {
} else {
die(“Sorry but the email could not be sent. Please go back and try again!”);
}
}

///////////////

$pop_countries = array(“United Kingdom”, “United States”,”Jitendra”,”Kumar”,”Subash”);
ksort($pop_countries);

$rest_countries = array(“Afghanistan”, “Aland Islands”, “Albania”, “Algeria”, “American Samoa”, “Andorra”, “Angola”, “Anguilla”, “Antarctica”, “Antigua”, “Argentina”, “Armenia”, “Aruba”, “Australia”, “Austria”, “Azerbaijan”, “Bahamas”, “Bahrain”, “Bangladesh”, “Barbados”, “Barbuda”, “Belarus”, “Belgium”, “Belize”, “Benin”, “Bermuda”, “Bhutan”, “Bolivia”, “Bosnia”, “Botswana”, “Bouvet Island”, “Brazil”, “British Indian Ocean Trty.”, “Brunei Darussalam”, “Bulgaria”, “Burkina Faso”, “Burundi”, “Caicos Islands”, “Cambodia”, “Cameroon”, “Canada”, “Cape Verde”, “Cayman Islands”, “Central African Republic”, “Chad”, “Chile”, “China”, “Christmas Island”, “Cocos (Keeling) Islands”, “Colombia”, “Comoros”, “Congo”, “Congo, Democratic Republic of the”, “Cook Islands”, “Costa Rica”, “Cote d’Ivoire”, “Croatia”, “Cuba”, “Cyprus”, “Czech Republic”, “Denmark”, “Djibouti”, “Dominica”, “Dominican Republic”, “Ecuador”, “Egypt”, “El Salvador”, “Equatorial Guinea”, “Eritrea”, “Estonia”, “Ethiopia”, “Falkland Islands (Malvinas)”, “Faroe Islands”, “Fiji”, “Finland”, “France”, “French Guiana”, “French Polynesia”, “French Southern Territories”, “Futuna Islands”, “Gabon”, “Gambia”, “Georgia”, “Germany”, “Ghana”, “Gibraltar”, “Greece”, “Greenland”, “Grenada”, “Guadeloupe”, “Guam”, “Guatemala”, “Guernsey”, “Guinea”, “Guinea-Bissau”, “Guyana”, “Haiti”, “Heard”, “Herzegovina”, “Holy See”, “Honduras”, “Hong Kong”, “Hungary”, “Iceland”, “India”, “Indonesia”, “Iran (Islamic Republic of)”, “Iraq”, “Ireland”, “Isle of Man”, “Israel”, “Italy”, “Jamaica”, “Jan Mayen Islands”, “Japan”, “Jersey”, “Jordan”, “Kazakhstan”, “Kenya”, “Kiribati”, “Korea”, “Korea (Democratic)”, “Kuwait”, “Kyrgyzstan”, “Lao”, “Latvia”, “Lebanon”, “Lesotho”, “Liberia”, “Libyan Arab Jamahiriya”, “Liechtenstein”, “Lithuania”, “Luxembourg”, “Macao”, “Macedonia”, “Madagascar”, “Malawi”, “Malaysia”, “Maldives”, “Mali”, “Malta”, “Marshall Islands”, “Martinique”, “Mauritania”, “Mauritius”, “Mayotte”, “McDonald Islands”, “Mexico”, “Micronesia”, “Miquelon”, “Moldova”, “Monaco”, “Mongolia”, “Montenegro”, “Montserrat”, “Morocco”, “Mozambique”, “Myanmar”, “Namibia”, “Nauru”, “Nepal”, “Netherlands”, “Netherlands Antilles”, “Nevis”, “New Caledonia”, “New Zealand”, “Nicaragua”, “Niger”, “Nigeria”, “Niue”, “Norfolk Island”, “Northern Mariana Islands”, “Norway”, “Oman”, “Pakistan”, “Palau”, “Palestinian Territory, Occupied”, “Panama”, “Papua New Guinea”, “Paraguay”, “Peru”, “Philippines”, “Pitcairn”, “Poland”, “Portugal”, “Principe”, “Puerto Rico”, “Qatar”, “Reunion”, “Romania”, “Russian Federation”, “Rwanda”, “Saint Barthelemy”, “Saint Helena”, “Saint Kitts”, “Saint Lucia”, “Saint Martin (French part)”, “Saint Pierre”, “Saint Vincent”, “Samoa”, “San Marino”, “Sao Tome”, “Saudi Arabia”, “Senegal”, “Serbia”, “Seychelles”, “Sierra Leone”, “Singapore”, “Slovakia”, “Slovenia”, “Solomon Islands”, “Somalia”, “South Africa”, “South Georgia”, “South Sandwich Islands”, “Spain”, “Sri Lanka”, “Sudan”, “Suriname”, “Svalbard”, “Swaziland”, “Sweden”, “Switzerland”, “Syrian Arab Republic”, “Taiwan”, “Tajikistan”, “Tanzania”, “Thailand”, “The Grenadines”, “Timor-Leste”, “Tobago”, “Togo”, “Tokelau”, “Tonga”, “Trinidad”, “Tunisia”, “Turkey”, “Turkmenistan”, “Turks Islands”, “Tuvalu”, “Uganda”, “Ukraine”, “United Arab Emirates”, “Uruguay”, “US Minor Outlying Islands”, “Uzbekistan”, “Vanuatu”, “Vatican City State”, “Venezuela”, “Vietnam”, “Virgin Islands (British)”, “Virgin Islands (US)”, “Wallis”, “Western Sahara”, “Yemen”, “Zambia”, “Zimbabwe”);
ksort($rest_countries);

$selId = array(“United States”,”Albania”,”Aruba”,”Peru”);

?>

$value) {
$sel=(in_array($value,$selId) ) ? “selected=’selected'” : “”;
?>
<option value="” style=”color:#ff0000;” title=””>

$value) {

$sel1=( in_array($value,$selId) ) ? “selected=’selected'” : “”;
?>
<option value="” style=”color:#ff0000;” title=””>

///////////////////////////////////////////////////////////
$condtionc = array(‘tbl’=>”wl_cities”,’field’=>”id,title,state_id”,’where’=>”status =’1’ $conds “,’orderby’=>”title ASC”);
$res_city = make_options($condtionc);
Jitendra Prasad 1:59 PM
if ( ! function_exists(‘make_options’))
{
function make_options($array)
{
if( is_array($array) && !empty($array))
{
$tbl = @$array[‘tbl’];
$field = @$array[‘field’];
$where = @$array[‘where’];
$orderby = @$array[‘orderby’];
$ci = CI();
$ci->db->select($field,FALSE);
$ci->db->from($tbl);
$ci->db->where($where);
$ci->db->order_by($orderby);
$res=$ci->db->get()->result_array();
return $res;

}
}
}
Jitendra Prasad 2:01 PM
$rwdatac=custom_result_set(“select * from wl_product_attributes where status=’1′ AND product_id='”.$res[‘products_id’].”‘ ORDER BY attribute_id asc”);
Jitendra Prasad 2:16 PM
foreach($res_array as $v)
{
$v[‘documents’]=”;

$exdate = get_db_single_row(‘wl_person_document’,’DATEDIFF(expiry_date, CURDATE()) AS days_till_expiry’,” AND id='”.$v[‘id’].”‘ “);
$v[‘count_total_days’] = (int) $totalDays;
$res1_array[] = $v;
Jitendra Prasad 2:17 PM
}
// trace($res1_array);die;
$data[‘res’] = $res1_array;

/////////////////////////////////////////////////////////////////////////////////

|unique[tbl_states.title='” . $this->db->escape_str($this->input->post(‘title’)) . “‘ AND tbl_states.status!=’2’ AND tbl_states.country_id='” . $this->db->escape_str($this->input->post(‘country_id’)) . “‘] Jitendra Prasad 3:57 PM
$posted_friendly_url = $this->input->post(‘friendly_url’);
$cbk_friendly_url = seo_url_title($posted_friendly_url);
Jitendra Prasad 4:08 PM
public function checkurl(){
$city_id=(int)$this->input->post(‘city_id’);
if($city_id!=”){
$cont=’and entity_id !=’.$city_id;
}else{
$cont=”;
}

$posted_friendly_url = $this->input->post(‘friendly_url’);
$cbk_friendly_url = seo_url_title($posted_friendly_url);

$posted_friendly_url = $this->input->post(‘friendly_url’);
$this->cbk_friendly_url = seo_url_title($posted_friendly_url);
$url = $this->cbk_friendly_url;
//echo “select * from wl_meta_tags where page_url='”.$url.”‘”.$cont.””;die;
$urlcount=$this->db->query(“select * from wl_meta_tags where page_url='”.$url.”‘”.$cont.””)->num_rows();

if($urlcount>0)
{
$this->form_validation->set_message(‘checkurl’, ‘URL already exists.’);
return FALSE;
}else
{
return TRUE;
}

}
Jitendra Prasad 4:49 PM
$this->form_validation->set_rules(‘product_code’,’Product Code’,”trim|required|max_length[65]|unique[wl_products.product_code='”.$this->db->escape_str($this->input->post(‘product_code’)).”‘ AND status!=’3’ AND products_id != ‘”.$productId.”‘]”);
Jitendra Prasad 4:52 PM
entity_id
Jitendra Prasad 4:56 PM
public function unique($str, $field) //unique used in for add record

{

list($table, $wherecond) = explode(‘.’, $field, 2);

$extcond =($wherecond!=”) ? $wherecond : “”;

//$str = $this->CI->db->escape_str($str);

$this->CI->form_validation->set_message(‘unique’,’The %s already exists.’);

$query = $this->CI->db->query(“SELECT COUNT

AS dupe

FROM $table

WHERE $extcond ”

);

$row = $query->row();

//echo $this->CI->db->last_query(); exit;

return ($row->dupe > 0) ? FALSE : TRUE;

}

////////////////////////////////////////////////////////////
$ordmaster =custom_result_set(“SELECT order_id,customers_id, total_amount,shipping_amount, cod_amount, vat_amount,coupon_discount_amount,currency_code,order_received_date,payment_method,payment_status FROM wl_order WHERE $condition “);

$ordmaster =custom_result_set(“SELECT products_id,brand_id,category_links FROM wl_products WHERE status=’1′ AND FIND_IN_SET( ’52’,wlp.category_links ) group by brand_id “);
trace($ordmaster);

//////////////////////////////////////////