ਤਾਜ਼ਾ ਖਬਰਾਂ
db = new MysqliDb (HOST, USERNAME, PWD, DB); include_once(CLASSES.'password.php'); } public function makePhoto($photo_name, $img) { //echo'hii';die;makeSlider( //echo $img; die; $thumbnail_width = 64; $thumbnail_height = 64; $arr_image_details = getimagesize($img); // pass id to thumb name //var_dump($arr_image_details); die; $original_width = $arr_image_details[0]; $original_height = $arr_image_details[1]; if ($original_width < 64) { $new_width = $original_width; $new_height = $original_height; } else if ($original_width > $original_height) { //$new_height = $thumbnail_height; $new_width = $thumbnail_width; $new_height = intval($original_height * $new_width / $original_width); } else { /*$new_height = $thumbnail_height; $new_width = intval($original_width * $new_height / $original_height);*/ $new_height = $thumbnail_height; $new_width = intval($original_width * $new_height / $original_height); } //echo $new_width.'='.$new_height; $dest_x = intval(($thumbnail_width - $new_width) / 2); $dest_y = intval(($thumbnail_height - $new_height) / 2); if ($arr_image_details[2] == 1) { $imgt = "ImageGIF"; $imgcreatefrom = "ImageCreateFromGIF"; } if ($arr_image_details[2] == 2) { $imgt = "ImageJPEG"; $imgcreatefrom = "ImageCreateFromJPEG"; } if ($arr_image_details[2] == 3) { $imgt = "ImagePNG"; $imgcreatefrom = "ImageCreateFromPNG"; } if($imgt){ $old_image = $imgcreatefrom($_FILES['photo']['tmp_name']); //echo $photo_name;var_dump($old_image); $new_image = imagecreatetruecolor($thumbnail_width, $thumbnail_height); $tr=imagecopyresized($new_image, $old_image, $dest_x, $dest_y, 0, 0, $new_width, $new_height, $original_width, $original_height); //var_dump(file_exists("upload/user/image/".$photo_name)); die; if(file_exists('upload/user/image/'.$photo_name) == true){ //echo'1';die; // Rename the file if another one already exists in folder $remove_php_name = preg_replace("/(.+)\.php$/", "$1", $photo_name); $new_file_name = uniqid(rand(), true)."_".$remove_php_name; $old_file = "upload/user/image/".$photo_name; $new_file = "upload/user/image/".$new_file_name; rename($old_file, $new_file); $photo_name = $new_file_name; } else { //echo'2';die; $remove_php_name = preg_replace("/(.+)\.php$/", "$1", $photo_name); move_uploaded_file($file_tmp, $upload_dir."/".$remove_php_name); $imgt($new_image, "upload/user/image/".$photo_name); $photo_name = $photo_name; } } } public function adduser($arr) { //echo 'add user'; $password = trim($arr['password']); $password = strip_tags($password); $pwd_hash = password_hash($password, PASSWORD_BCRYPT, array("cost" => 10)); // echo $pwd_hash; if(isset($arr['subscribe']) && $arr['subscribe']=='1'){ $newsletter = '1'; } else { $newsletter = '0'; } if($_FILES['photo']['error'] != UPLOAD_ERR_NO_FILE){ // echo 'photo'; die; $file = 'photo'; $errors = array(); $extension = array("jpeg","JPEG","jpg","JPG","png","PNG","gif","GIF"); $photo_name = $_FILES[$file]['name']; $file_size = $_FILES[$file]['size']; $file_tmp = $_FILES[$file]['tmp_name']; $file_type = $_FILES[$file]['type']; $ext = pathinfo($photo_name, PATHINFO_EXTENSION); if(!in_array($ext, $extension)){ echo""; $errors[] = "Please upload a valid image. (.jpg, .png or .gif) !"; } else if($file_size > 175000){ echo""; $errors[] = "Your file exceeds max image size 175 kb !"; } else { // resize photo $this->makePhoto($photo_name, $file_tmp); $user_photo = $photo_name; } } else { $user_photo = ''; } $data2 = Array ( 'first_name' => $this->db->escape($arr['first_name']), 'last_name' => $this->db->escape($arr['last_name']), 'email' => $this->db->escape($arr['email']), 'phone_no' => $this->db->escape($arr['phone_no']), 'mobile_no' => $this->db->escape($arr['mobile_no']), 'country' => $this->db->escape($arr['country']), 'state' => $this->db->escape($arr['state']), 'city' => $this->db->escape($arr['city']), 'username' => $this->db->escape($arr['username']), 'password' => $pwd_hash, 'photo' => $user_photo, 'newsletter' => $newsletter, 'created_on' => date('Y-m-d'), 'status' => 1 ); // echo '4'; //var_dump($data2); die; $insert1 = $this->db->insert('site_user', $data2); //var_dump($insert1);die; if($insert1){ echo''; } else { echo''; } } public function subscribeuser() { $newsletter = $_POST['terms_policy']; $data2 = Array ( 'newsletter' => $newsletter ); $update1 = $this->db->where('id', $id)->update('site_user', $data2); if($update1==true){ echo''; } else { echo''; } } /*public function unsubscribe_newsalert() { $id = $_SESSION['site_user_id']; //echo $id;die; $data2 = Array ( 'newsletter' => 0 ); $update1 = $this->db->where('id', $id)->update('site_user', $data2); if($update1==true){ echo''; } else { echo''; } }*/ public function unsubscribe_newsalert() { $email_user = $_POST['email']; //$to = array("rakeshk@hambzik.com", "info.babushahi@gmail.com", "arvindk@hambzik.com"); $to = "rakeshk@hambzik.com"; $subject = "Unsubscribe Babushahi Newsletter"; $this->sendEmail($to, $email_user, $subject); } function sendEmail($to, $email_user, $subject){ //echo $link; //$to = array("rakeshk@hambzik.com"); $to = "rakeshk@hambzik.com"; // $to = $emails; //print_r($to); //die; //date_default_timezone_set('America/Toronto'); //include("classes/PHPMailer/PHPMailerAutoload.php"); $mail = new PHPMailer(true); try { $mail->CharSet = 'UTF-8'; // 1 = errors and messages //$mail->SMTPSecure = "ssl"; // 2 = messages only //$mail->SMTPSecure = 'ssl'; $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPKeepAlive = true; $mail->Host = "mail.babushahi.net"; // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "newsletter@babushahi.net"; // SMTP account username $mail->Password = "Darshan@chd"; // SMTP account password $mail->SetFrom( "no-reply@babushahi.com","Unsubscribe Babushahi Newsletter "); $mail->Subject = $subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $timm = time(); $body = " Message
  Hello Admin,
$email_user has just submitted the request to UnSubscribe Babushahi Newsletter and News Alert.
 
Babushahi.com
"; // $address = $v; $mail->MsgHTML($body); $mail->IsHTML(true); //$to=array("rksoftslogics@gmail.com","rakeshk@hambzik.com"); //foreach($to as $v){ //$address = $v['email']; $address = $to; $mail->AddAddress($address); $mail->AddBCC("rksoftslogics@gmail.com"); $mail->Send(); $mail->ClearAddresses(); $mail->ClearAllRecipients(); // } if(!$mail->Send()) { //echo "Error sending: " . $mail->ErrorInfo; //header('Location: add-news.php'); echo ''; exit(); } else { //echo "mail is sent"; echo ''; exit(); } // clear all } catch(phpmailerException $e) { //echo $e->errorMessage(); echo ''; exit(); } catch(Exception $e) { //echo $e->getMessage(); echo ''; exit(); } } public function subscribe_newsalert() { $email_newsletter = $_POST['email']; //$to="info.babushahi@gmail.com "; //$to = "rakeshk@hambzik.com"; $to = $email_newsletter; // send email to subscriber $mail = new PHPMailer(true); $mail->CharSet = 'UTF-8'; // $mail->SMTPSecure = "ssl"; // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPKeepAlive = true; $mail->Host = "mail.babushahi.net"; // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "newsletter@babushahi.net"; // SMTP account username $mail->Password = "Darshan@chd"; // SMTP account password $mail->SetFrom( "no-reply@babushahi.com","Babushahi Newsletter Confirmation "); $mail->Subject = 'Babushahi Newsletter Confirmation'; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $timm = time(); $body = " Message
 
        Thank you for subscribing to email alerts and newsletter from babushahi.com and babushahi.in. A confirmation email has been sent to $email_newsletter. If you have not received the confirmation email, please check the spam / junk email folder and mark the email as NOT Junk.
 
Kind Regards,
 
Tirchhi Nazar Media
 
===============================
"; $mail->MsgHTML($body); $mail->IsHTML(true); $address = $to; $mail->AddAddress($address); //$mail->AddBCC("rakeshk@hambzik.com"); //$mail->ClearAddresses(); //$mail->ClearAllRecipients(); $mail->Send(); //$this->send_newsletter_confirmation_to_admin($adminemail); /* if($mail->Send()){ //echo 'Mailer error: ' . $mail->ErrorInfo; echo""; exit(); } else { //echo "Error sending: " . $mail->ErrorInfo; echo""; exit(); }*/ } public function send_newsletter_confirmation_to_admin($arr) { //var_dump($arr); die; //$to=$adminemail; $to="info.babushahi@gmail.com"; // $to="rakeshk@hambzik.com"; // send email to admin $name=$arr['name']; $email=$arr['email']; $country=$arr['country']; $city=$arr['city']; $mail1 = new PHPMailer(true); $mail1->CharSet = 'UTF-8'; // $mail->SMTPSecure = "ssl"; // 2 = messages only $mail1->SMTPAuth = true; // enable SMTP authentication $mail1->SMTPKeepAlive = true; $mail1->Host = "mail.babushahi.net"; // sets the SMTP server $mail1->Port = 25; // set the SMTP port for the GMAIL server $mail1->Username = "newsletter@babushahi.net"; // SMTP account username $mail1->Password = "Darshan@chd"; // SMTP account password $mail1->SetFrom( "no-reply@babushahi.com","Babushahi Newsletter Request"); $mail1->Subject = "Babushahi Newsletter Request"; $mail1->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $timm = time(); $body = " Message
  Hello Admin,
        $email has just sent request for subscribing to email alerts and newsletter from babushahi.com and babushahi.in. A confirmation email has also been sent to $email_newsletter.
Name  $name
Email  $email
Country   $country
City   $city
 
Kind Regards,
Tirchhi Nazar Media
 
===============================
"; $mail1->MsgHTML($body); $mail1->IsHTML(true); //$address = $to; $mail1->AddAddress($to); //$mail->AddCC("rahul143angel@gmail.com"); // $mail1->ClearAddresses(); //$mail1->ClearAllRecipients(); $mail1->Send(); } }?>