Friday, 17 April 2020

Calling vibrate effect css

Demo2 :  https://bootsnipp.com/snippets/Vg6bN

<style type="text/css">

body {
  background: #71AFFF;
  padding: 100px;
}
.call-animation {
    background: #fff;
    width: 135px;
    height: 135px;
    position: relative;
    margin: 0 auto;
    border-radius: 100%;
    border: solid 5px #fff;
    animation: play 2s ease infinite;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;

}
 img {
        width: 135px;
        height: 135px;
        border-radius: 100%;
        position: absolute;
        left: 0px;
        top: 0px;
    }
@keyframes play {

    0% {
        transform: scale(1);
    }
    15% {
        box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.4);
    }
    25% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.4), 0 0 0 20px rgba(255, 255, 255, 0.2);
    }
    25% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0.4), 0 0 0 30px rgba(255, 255, 255, 0.2);
    }

}

</style>



<div class="call-animation">
<img class="img-circle" src="https://placeimg.com/400/400/people" alt="" width="135"/>
</div>

Tuesday, 24 March 2020

Date & Time different different format

Table for Date Formats

<?php
date_default_timezone_set("Asia/Calcutta");   //India time (GMT+5:30)
echo date('d-m-Y H:i:s');
?>

<?php
echo "Current Date : ".date("d/m/y")."<br />"; 
echo "Current Time : ".date("H:i:sa")."<br />";
echo "Current Day : ".date("l")."<br />";
echo "Current Month : ".date("M")."<br />";  
?>


Output :
Current Date : 19/02/17
Current Time : 15:54:08pm
Current Day : Sunday
Current Month : Feb

FormatDescriptionExample
a'am' या 'pm' lowercaseam
A'AM' या 'PM' uppercaseAM
dशुरुआत में 0 के साथ 2 digits के month का day 01 से 31 तक15
D3 letters week का dayMon
Fmonth का full nameMarch
gशुरुआत से 0 के बिना hour के लिए 12hour का format 1 से 12 तक5
Gशुरुआत से 0 के बिना hour के लिए 24hour का format 0 से 23 तक3
hशुरुआत से 0 के साथ 12hour के format में hour 01 से 12 तक 05
Hशुरुआत से 0 के साथ 24hour के format में hour 00 से 24 तक 00
iशुरुआत से 0 के साथ minutes 00 से 59 तक58
Iअगर Daylight Savings Time है तो 1 नहीं तो 0 1
jशुरुआत से 0 के बिना month का day 1 से 31 तक27
lWeek का day full nameFriday
LLeap year है तो 1 नहीं तो 00
mशुरुआत से 0 के साथ year का month 01 से 12 तक02
M3 letters year का monthJun
nशुरुआत से 0 के बिना year का month 1 से 12 तक10
rRFC 822 formatted date Sun, 19 Feb 2017 19:07:40 +0100
sseconds 00 से 59 तक58
tcheck month के days 28 से 31 तक31
Utimestamp1487527863
y2 digits year17
Y4 digits year2017
zyear का day 0 से 365 तक106
Ztimezone offset seconds में 3600

Monday, 23 March 2020

url routing in codeigniter

Url Routing in Codeigniter : 


$title = "Here's a string!";
$url_title = url_title($title);


$route['default_controller'] = 'web';

$route['logout']='web/logout';

$route['videos'] = 'web/videos';

$route['videos'] = 'web/videos';

$route['news'] = 'Web/newsAll/';

$route['news-list/(:num)'] = 'Web/news/9'; // news List 

$route['news/(:any)/(:num)'] = 'web/newsDetail/$1/$2';  // new detail 

$route['(:any)/(:num)'] = 'web/page/$1/$2';  //page


Saturday, 7 March 2020

time function after 5 second open div

<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  <script>
      $(document).ready(function () {
          // Hide the div
          $("#myModal").hide();
          // Show the div after 5s
          $("#myModal").delay(5000).fadeIn(100); 
      });   
  </script>

<div id="myModal">  test div </div>

Thursday, 5 March 2020

image resize function in php


Photo Resize in one line :

<img src="<?php echo MEDIA_URL.'resizer.php?file=news/'.$result->path; ?>&width=20&height=20&action=resize&quality=100"   class="img-responsive" alt="">

Codeigniter : 
<meta property="og:image" itemprop="image" content="<?php echo base_url('upload/resizer.php?file=news/'); ?><?php echo $result->path; ?>&width=200&height=200&action=resize&quality=100">


Note : ye file media folder me set kar de is name se : resizer.php


<?php
if(isset($_GET['file']) && !empty($_GET['file']))
{
/**
 * Image processing class
 *
 * @package framework.components
 * @since 1.0.0
 */
class pjImage
{
/**
 * RGB color
 *
 * @var array
 * @access private
 *///242, 217, 230
private $color = array(242, 242, 242);
/**
 * Font path
 *
 * @var string
 * @access private
 */
private $font;
/**
 * Font size
 *
 * @var int
 * @access private
 */
private $fontSize;
/**
 * Image resource identifier
 *
 * @var resource
 * @access private
 */
private $image;
/**
 * One of the IMAGETYPE_* constants indicating the type of the image.
 *
 * @var int
 * @access private
 */
private $imageType;
/**
 * Image width
 *
 * @var int
 * @access private
 */
private $width;
/**
 * Image height
 *
 * @var int
 * @access private
 */
private $height;


private $file;
/**
 * Constructor - automatically called when you create a new instance of a class with new
 *
 * @access public
 * @return self
 */
public function __construct()
{
if (!extension_loaded('gd') || !function_exists('gd_info'))
{
$this->error = "GD extension is not loaded";
$this->errorCode = 200;
}
}
/**
 * Get color
 *
 * @access public
 * @return array
 */
public function getColor()
{
return $this->color;
}
/**
 * Get font
 *
 * @access public
 * @return string
 */
public function getFont()
{
return $this->font;
}
/**
 * Get font size
 *
 * @access public
 * @return number
 */
public function getFontSize()
{
return $this->fontSize;
}
/**
 * Get image height
 *
 * @access public
 * @return int|false Return the height of the image or FALSE on errors.
 */
public function getHeight()
{
return imagesy($this->getImage());
}
/**
 * Get image resource
 *
 * @access public
 * @return resource
 */
public function getImage()
{
return $this->image;
}
/**
 * Get the size of an image
 *
 * @access public
 * @return Returns an array with 7 elements.
 */
public function getImageSize()
    {
    return getimagesize($this->file['tmp_name']);
    }
/**
 * Get the type of image resource
 *
 * @access public
 * @return number
 */
    public function getImageType()
    {
    return $this->imageType;
    }
/**
 * Get image width
 *
 * @access public
 * @return int|false Return the width of the image or FALSE on errors.
 */
public function getWidth()
{
return imagesx($this->getImage());
}
/**
 * Check if system memory is enough for image processing
 *
 * @access public
 * @return array
 */
public function isConvertPossible()
{
$status = true;
if (function_exists('memory_get_usage') && ini_get('memory_limit'))
{
$info = $this->getImageSize();
$MB = 1024 * 1024;
$K64 = 64 * 1024;
$tweak_factor = 1.6;
$channels = isset($info['channels']) ? $info['channels'] : 3;
$memory_needed = round(($info[0] * $info[1] * $info['bits'] * $channels / 8 + $K64) * $tweak_factor);
$memory_needed = memory_get_usage() + $memory_needed;
$memory_limit = ini_get('memory_limit');
if ($memory_limit != '')
{
$memory_limit = substr($memory_limit, 0, -1) * $MB;
}
if ($memory_needed > $memory_limit)
{
$status = false;
}
}
return compact('status', 'memory_needed', 'memory_limit');
}
/**
 * Load locale image file for later processing
 *
 * @param string $path The path to image
 * @access public
 * @return self
 */
public function loadImage($path=NULL)
{
if (!is_null($path))
{
$this->file = array(
'tmp_name' => $path,
'name' => basename($path)
);
}
$info = $this->getImageSize();

$this->width = $info[0];
$this->height = $info[1];
$this->setImageType($info[2]);
$file = $path;

switch ($this->imageType)
{
case IMAGETYPE_JPEG:
$this->setImage(@imagecreatefromjpeg($file));
break;
case IMAGETYPE_GIF:
$this->setImage(@imagecreatefromgif($file));
break;
case IMAGETYPE_PNG:
$this->setImage(@imagecreatefrompng($file));
break;
}
return $this;
}

/**
 * Write text to the image
 *
 * @param string $text The text string in UTF-8 encoding.
 * @param string $position Accept: 'tl', 'tr', 'tc', 'bl', 'br', 'bc', 'cl', 'cr', 'cc'. <b>t</b> stands for Top, <b>b</b> stands for Bottom, <b>l</b> stands for Left, <b>r</b> stands for Right, <b>c</b> stands for Center.
 * @access public
 * @return self
 */
public function setWatermark($text, $position)
{
$rgb = $this->getColor();

$color = imagecolorallocate($this->getImage(), $rgb[0], $rgb[1], $rgb[2]);

$tb = imagettfbbox($this->getFontSize(), 0, $this->getFont(), $text);

switch ($position)
{
case 'tl':
$x = $tb[0];
$y = $this->getFontSize();
break;
case 'tr':
$x = floor($this->getWidth() - $tb[2]);
$y = $this->getFontSize();
break;
case 'tc':
$x = ceil(($this->getWidth() - $tb[2]) / 2);
$y = $this->getFontSize();
break;
case 'bl':
$x = $tb[0];
$y = floor($this->getHeight() - $this->getFontSize());
break;
case 'br':
$x = floor($this->getWidth() - $tb[2]);
$y = floor($this->getHeight() - $this->getFontSize());
break;
case 'bc':
$x = ceil(($this->getWidth() - $tb[2]) / 2);
$y = floor($this->getHeight() - $this->getFontSize());
break;
case 'cl':
$x = $tb[0];
$y = ceil($this->getHeight() / 2);
break;
case 'cr':
$x = floor($this->getWidth() - $tb[2]);
$y = ceil($this->getHeight() / 2);
break;
case 'cc':
default:
$x = ceil(($this->getWidth() - $tb[2]) / 2);
$y = ceil($this->getHeight() / 2);
break;
}

imagettftext($this->getImage(), $this->getFontSize(), 0, $x, $y, $color, $this->getFont(), $text);
return $this;
}
/**
 * Set font path
 *
 * @param string $path The path to font file
 * @access public
 * @return self
 */
public function setFont($path)
{
$this->font = $path;
return $this;
}
/**
 * Set font size
 *
 * @param int $size
 * @access public
 * @return self
 */
public function setFontSize($size)
{
$this->fontSize = $size;
return $this;
}
/**
 * Set RGB color
 *
 * @param array $color Expect numeric array, eg. array(255, 255, 255)
 * @access public
 * @return self
 */
public function setColor($color)
{
if (is_array($color) && count($color) === 3)
{
$this->color = $color;
}
return $this;
}
/**
 * Set image resource
 *
 * @param resource $resource
 * @access public
 * @return self
 */
public function setImage($resource)
{
if (is_resource($resource))
{
$this->image = $resource;
}
return $this;
}
/**
 * Set the type of image resource
 *
 * @param int $value
 * @return self
 */
public function setImageType($value)
{
if (is_int($value))
{
$this->imageType = $value;
}
return $this;
}
/**
 * Outputs image without saving
 *
 * @param string $image_type
 * @param number $compression
 */
public function output($compression=100)
{
switch ($this->imageType)
{
case IMAGETYPE_JPEG:
header("Content-Type: image/jpeg");
imageinterlace($this->getImage(), true);
imagejpeg($this->getImage(), NULL, $compression);
imagedestroy($this->getImage());
break;
case IMAGETYPE_GIF:
header("Content-Type: image/gif");
imagegif($this->getImage());
imagedestroy($this->getImage());
break;
case IMAGETYPE_PNG:
header("Content-Type: image/png");
imagepng($this->getImage());
imagedestroy($this->getImage());
break;
}

exit;
}
/**
* Image resize to fixed size
*
* @param int $width
* @param int $height
* @access public
* @return self
*/
public function resize($width, $height)
{
$new_image = imagecreatetruecolor($width, $height);
switch ($this->imageType)
{
case IMAGETYPE_PNG:
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
$transparent = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
imagefilledrectangle($new_image, 0, 0, $width, $height, $transparent);
break;
case IMAGETYPE_JPEG:
case IMAGETYPE_GIF:
$transparent_index = imagecolortransparent($this->getImage());
if ($transparent_index >= 0)
{
$transparent_color = imagecolorsforindex($this->getImage(), $transparent_index);
$transparent_index = imagecolorallocate($new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
imagefill($new_image, 0, 0, $transparent_index);
imagecolortransparent($new_image, $transparent_index);
}
break;
}
imagecopyresampled($new_image, $this->getImage(), 0, 0, 0, 0, $width, $height, $this->width, $this->height);
$this->width = $width;
$this->height = $height;
$this->setImage($new_image);

return $this;
}

public function crop($src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $dst_x = 0, $dst_y = 0)
{
$new_image = imagecreatetruecolor($dst_w, $dst_h);

switch ($this->imageType)
{
case IMAGETYPE_PNG:
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
$transparent = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
imagefilledrectangle($new_image, 0, 0, $dst_w, $dst_h, $transparent);
break;
case IMAGETYPE_JPEG:
case IMAGETYPE_GIF:
$transparent_index = imagecolortransparent($this->getImage());
if ($transparent_index >= 0)
{
$transparent_color = imagecolorsforindex($this->getImage(), $transparent_index);
$transparent_index = imagecolorallocate($new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
imagefill($new_image, 0, 0, $transparent_index);
imagecolortransparent($new_image, $transparent_index);
}
break;
}

imagecopyresampled($new_image, $this->getImage(), $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);

$this->width = $dst_w;
$this->height = $dst_h;
$this->setImage($new_image);
return $this;
}
}

$image_path = $_GET['file'];

if(file_exists($image_path))
{
$Image = new pjImage();

$size = @getimagesize($image_path);
$src_width = $size[0];
$src_height = $size[1];

if(isset($_GET['action']) && $_GET['action'] == 'resize')
{
if(isset($_GET['width']) && (int) $_GET['width'] > 0 && isset($_GET['height']) && (int) $_GET['height'] > 0)
{
$Image->loadImage($image_path);
$resp = $Image->isConvertPossible();
if ($resp['status'] === true)
{
$Image->resize($_GET['width'], $_GET['height']);
}
}
}else if(isset($_GET['action']) && $_GET['action'] == 'crop'){

if(isset($_GET['width']) && (int) $_GET['width'] > 0 & (int) $_GET['width'] < $src_width && isset($_GET['height']) && (int) $_GET['height'] > 0 && (int) $_GET['height'] < $src_height)
{
if(isset($_GET['crop_pos']) && !empty($_GET['crop_pos']))
{
$crop_position = $_GET['crop_pos'];
$x = 0;
$y = 0;
$w = (int) $_GET['width'];
$h  = (int) $_GET['height'];
switch ($crop_position) {
case 'center':
$x = round($src_width / 2) - round((int) $_GET['width'] / 2);
$y = round($src_height / 2) - round((int) $_GET['height'] / 2);
;
break;

case 'top':
$x = round($src_width / 2) - round((int) $_GET['width'] / 2);
;
break;
case 'bottom':
$x = round($src_width / 2) - round((int) $_GET['width'] / 2);
$y = $src_height - (int) $_GET['height'];
;
break;
case 'left':
$y = round($src_height / 2) - round((int) $_GET['height'] / 2);
;
break;
case 'right':
$x = $src_width - (int) $_GET['width'];
$y = round($src_height / 2) - round((int) $_GET['height'] / 2);
;
break;
}
$Image->loadImage($image_path);
$Image->crop($x, $y, $w, $h, $w, $h);
}
}
}
if(isset($_GET['watermark']) && !empty($_GET['watermark']))
{
$watermarkPosition = isset($_GET['watermark_pos']) ? $_GET['watermark_pos'] : 'cc';

if(isset($_GET['color']))
{
$color_arr = explode(",", $_GET['color']);
$valid_color = true;
if(count($color_arr) == 3)
{
if((int)$color_arr[0] < 0 || (int)$color_arr[0] > 255 || (int)$color_arr[1] < 0 || (int)$color_arr[1] > 255 || (int)$color_arr[2] < 0 || (int)$color_arr[2] > 255)
{
$valid_color = false;
}
}else{
$valid_color = false;
}
if($valid_color == true)
{
$Image->setColor($color_arr);
}
}

$Image->setFontSize(20)->setFont('fonts/arialbd.ttf');
$Image->setWatermark($_GET['watermark'], $watermarkPosition);
}
$quality = 100;
if(isset($_GET['quality']) && (int) $_GET['quality'] > 0 && (int) $_GET['quality'] <= 100)
{
$quality = $_GET['quality'];
}

$Image->output($quality);
}
}
?>

Tuesday, 3 March 2020

random step data in codeigniter

Random step data in codeigniter

View : 

<?php 
if($c%10==0){
if(!empty($AdsRandomStep)){ 
$total_array = count($AdsRandomStep);
$random_keys=rand(0,$total_array-1); 
echo '<div class="col-sm-12"><img src="'.base_url('upload/advertisement/').$AdsRandomStep[$random_keys]->path.'" class="adsStep" width="100%" /></div>';


 }} $c++; } } ?>

Thursday, 13 February 2020

Sesssion Message display in codeigniter

<div class="clearfix"></div>

<?php echo ($this->session->flashdata('msg')?$this->session->flashdata('msg'):'')?>


Alert Message HTML  :  https://getbootstrap.com/docs/4.0/components/alerts/
<div class="alert alert-primary" role="alert">
  This is a primary alert—check it out!
</div>
<div class="alert alert-secondary" role="alert">
  This is a secondary alert—check it out!
</div>
<div class="alert alert-success" role="alert">
  This is a success alert—check it out!
</div>
<div class="alert alert-danger" role="alert">
  This is a danger alert—check it out!
</div>
<div class="alert alert-warning" role="alert">
  This is a warning alert—check it out!
</div>
<div class="alert alert-info" role="alert">
  This is a info alert—check it out!
</div>
<div class="alert alert-light" role="alert">
  This is a light alert—check it out!
</div>
<div class="alert alert-dark" role="alert">
  This is a dark alert—check it out!
</div>

Form tag in codeigniter

<?php echo form_open('administration/Home/addSettingCode',array("id"=>"myform","class"=>"form-horizontal form-label-left","enctype"=>"multipart/form-data"));?>
 <input type="hidden" name="id" value="<?php echo (isset($settingData->id) && $settingData->id!=''?$settingData->id:'')?>">
 <input type="hidden" name="old_path" value="<?php echo (isset($settingData->logo) && $settingData->logo!=''?$settingData->logo:'')?>">



<div class="col-md-12">
                                                <div class="position-relative form-group">
                                                  <label for="examplePassword" class=""><span class="text-danger">*</span> About Us </label>
 <script src="//cdn.ckeditor.com/4.4.7/full/ckeditor.js"></script>
                                                                  <textarea rows="5" name="s8" id="s8" class="form-control" placeholder="Enter About Us" required><?php echo (isset($settingData->s8) && $settingData->s8!=''?$settingData->s8:'')?></textarea>
                                             <script>
                                                CKEDITOR.replace('s8', {
                                                  // Define the toolbar groups as it is a more accessible solution.
                                                  toolbarGroups: [{
                                                      "name": "basicstyles",
                                                      "groups": ["basicstyles"]
                                                    },
                                                    {
                                                      "name": "links",
                                                      "groups": ["links"]
                                                    },
                                                    {
                                                      "name": "paragraph",
                                                      "groups": ["list", "blocks"]
                                                    },
                                                    {
                                                      "name": "styles",
                                                      "groups": ["styles"]
                                                    }
                                                 
                                                  ],
                                                  // Remove the redundant buttons from toolbar groups defined above.
                                                  removeButtons: 'Underline,Strike,Subscript,Superscript,Anchor,Styles,Specialchar'
                                                });
                                              </script>

                                                </div>
                                            </div>



  <?php echo form_close();?>

Tuesday, 11 February 2020

Export Mysql Data to CSV File in Codeigniter

Controllers :

public function exportCSV(){
     
        $myData = $this->Home_model->getexportCSV();

        // file name
        $filename = 'User_Data'.date('Ymd').'.csv';
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename=$filename");
        header("Content-Type: application/csv; ");

        // file creation
        $file = fopen('php://output', 'w');

        $header = array("Mobile","Name");
        fputcsv($file, $header);

        foreach ($myData as $line){
            fputcsv($file,array($line->mobile,$line->name));
        }

        fclose($file);
        exit;
    }




Model :


public function getexportCSV(){
$sql=$this->db->query(" SELECT * FROM  `user`   ");
return $sql->result();

}

Saturday, 8 February 2020

date format jquery datepicker

<!------ date picker ]  -------->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
var jq = jQuery.noConflict();

jq(function() {

jq(".datepic").datepicker({

dateFormat: "yy-mm-dd",

yearRange: '1950:2050',

changeMonth: true,

changeYear: true
});

});
</script>
<!------ date picker ]  -------->

sms api set in codeigniter

CONSTANTS.PHP

/* custom development */
define('SMS_URL','http://sms.xxxxxxx.in/submitsms.jsp?');
define('SMS_USER','xxxxxxxxx');
define('SMS_KEY','xxxxxxx');
define('SMS_SENDER_ID','xxxxxxx');
define('SMS_SUPPORT_NO','1234567891');

/* custom development */


controller 

if($insertCheck=='1'){
$this->session->set_flashdata('msg', '<p class="alert alert-success">Your request has been sent successfully.</p>');

/* sms */
$mobile = SMS_SUPPORT_NO;
$message = "New Suggestion/Problem Received\n
Name : ".$this->input->post('name')."
Mobile : ".$this->input->post('mobile')."
Ward No :  ".$this->input->post('ward')."
\n\n:: Apna Roopangarh ::";
$this->Home_model->SendUnicodeSms($mobile,$message);

$mobile_user = $this->input->post('mobile');
$message_user = "आपकी शिकायत / सुझाव हमें प्राप्त हो गए हैं
\nजल्द ही हम आपसे संपर्क करेंगे
\nग्राम पंचायत रुपनगढ़";
$this->Home_model->SendUnicodeSms($mobile_user,$message_user);
/* sms */

}

Models

public function SendSms($mobiles,$message){

 
$key=SMS_KEY;  //   
$user=SMS_USER;    //
$senderid = SMS_SENDER_ID;

/*  sms */
$ch = curl_init();                    // initiate curl
$url = SMS_URL; // where you want to post data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&key=$key&mobile=$mobiles&message=$message&senderid=$senderid&accusage=1"); // NTFSMS , INFOSM, ROZGAR,define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
//curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Accept-Language: hi;q=0.5"));
$output = curl_exec ($ch); // execute
//echo $status = curl_getinfo($ch);
//print_r($output);
curl_close ($ch); // close curl handle
//var_dump($output); // show output
/*   sms  */


             
}


public function SendUnicodeSms($mobiles,$message){

 
$key=SMS_KEY;  //   
$user=SMS_USER;    //
$senderid = SMS_SENDER_ID;


$ch = curl_init();  // initiate curl
$url = SMS_URL; // where you want to post data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);  // tell curl you want to post something
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&key=$key&mobile=$mobiles&message=$message&senderid=$senderid&accusage=1&unicode=1"); // NTFSMS , INFOSM, ROZGAR,define what you want to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the output in string format
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
//curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Accept-Language: hi;q=0.5"));
$output = curl_exec ($ch); // execute
//echo $status = curl_getinfo($ch);
//print_r($output);
curl_close ($ch); // close curl handle
//var_dump($output); // show output



             
}

Thursday, 6 February 2020

Email Format php



         $to = $_POST['admin_email'];  // jaha email jayega
         $subject = $_POST['admin_name']." : Contact";  // email subject

  $message = "<h1>".$_POST['admin_name']." : Contact </h1>";
  $message .= "<b>Name : ".$_POST['name']."</b><br/>";
  $message .= "<b>Mobile : ".$_POST['mobile']."</b><br/>";
  $message .= "<b>Email : ".$_POST['email']."</b><br/>";
  $message .= "<b>Message : </b><br/>";
  $message .= "".$_POST['message']."";

 
       
         $header = "From: ".$_POST['admin_email']." \r\n";  // jaha se email jayega
         $header .= "Cc:domin.help24@gmail.com \r\n";   // cc copy email
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";
       
         $retval = mail ($to,$subject,$message,$header);
       
         if( $retval == true ) {
            $msg =  "Message sent successfully...";
             
         }else {
           $msg =  "Message could not be sent...";
             
         }
 //echo $msg;

Sunday, 2 February 2020

Email Format Codeigniter


public function addContactCode(){

$from_email = "sunilkalla2011@gmail.com";  // jaha se email send hoga
        $to_email = $this->input->post('email');  // jisko email jana h
       
        $subject = "Alakhpurajharod : Enquiry";

$message = "<h1>Alakhpurajharod : Enquiry</h1>";
$message .= "<b>Name : ".$this->input->post('name')."</b><br/>";
$message .= "<b>Phone: ".$this->input->post('mobile')."</b><br/>";
$message .= "<b>Description : </b><br/>";
$message .= "".$this->input->post('message')."";

$header = "From:".$this->input->post('email')." \r\n";
$header1 = "MIME-Version: 1.0\r\n";
$header2 = "Content-type: text/html\r\n";

        //Load email library
        $this->load->library('email');
        $this->email->from($from_email, 'Identification');
        $this->email->to($to_email);
        $this->email->cc('sunilkalla2011@gmail.com');  // copy email id
        $this->email->cc('in.mukeshsaini@gmail.com');  // copy email id

        $this->email->subject($subject);
        $this->email->message($message);
     

        $this->email->set_header('MIME-Version', '1.0; charset=utf-8');
        $this->email->set_header('Content-type', 'text/html');


        //Send mail
        if($this->email->send()){
            $this->session->set_flashdata("email_sent","<p class='flashmessage'>Email Sent Successfully.</p>");
        }
        else{
            $this->session->set_flashdata("email_sent","<p class='flashmessage'>You have encountered an error</p>");
        }

redirect("home/index/#mail");
     

}



2 ----------------------------------------------------------------

if($data['result']) {
                $_SESSION['CartItem'] = '';
                $this->load->library('email');
                $fromemail="digicardindia2020@gmail.com";
                $toemail = $_POST['email'].",in.mukeshsaini@gmail.com,digicardindia2020@gmail.com";
                $subject = "Digi Card India : ".$_POST['bussiness'];
                $mesg = $this->load->view('front/order_confirm',$data,true);
                $_SESSION['CartItem'] = $mesg;
                $config=array(
                'charset'=>'utf-8',
                'mailtype' => 'html'
                );
                $this->email->initialize($config);
                $this->email->to($toemail);
                $this->email->from($fromemail, "Order Confirmation");
                $this->email->subject($subject);
                $this->email->message($mesg);
                $mail = $this->email->send();
                if($mail) {
                    $this->session->set_flashdata('msg', '<p class="alert alert-success">Thanks for your order.</p>');
                } else {
                   // echo 'not send';exit();
                }
           }