Upload resume file upload and send email in opencart

Job_Application Twig file content

{{ header }}
<style>
  input#input_resume{
  border: none;
  border-radius: none;
  outline-style: none;
  box-shadow: none;
  -webkit-box-shadow:none;
  }
    .bgimage{
        /* background-image: url("F:/instaDiet/march/bg.jpg");
        background-color: rgb(255, 255, 255);
        opacity: 50%; */
        position: relative;
        z-index: 5;
    }

    .bgimage::after{
        content: "";
        position: absolute;
        background-image: url("F:/instaDiet/march/bg.jpg");
        opacity: .7;
        z-index: 2;
        left: 0px;
        top: 0px;
        display: block;

    }
          .gen{
    margin-left: -15px;
    margin-right: -15px;
  }
  
            textarea.form-control {
    height: 110px;
}
    h1.bredcrump-head.text-center{
       display: none;
       }
                #landing1 i {
                    position: absolute;
                }
    
    
                #landing1 button.btn.btn-xl {
                    margin: 0px;
                    border-radius: 6px;
                }
    
                #landing .logo-icon li {
                    padding-right: 20px;
                }
    
                #landing .logo-icon li p {
                    font-size: 10px;
                }
    
                #landing1 .f {
                    padding-left: 15px;
                    padding-right: 15px;
                    padding-top: 6px;
                }
    
                #landing1 .f ul li {
                    font-size: 15px;
                    letter-spacing: 2px;
                    padding-bottom: 30px;
                    font-weight: 600;
                    color: #000;
                    max-width: 500px;
                    list-style: none;
                    padding-left: 30px;
                    padding-right: 0px;
                }
    
                #landing1 .f button.btn.btn-default.btn-xl.btn.btn-default.product-btn.bold {
                    margin-top: 6px;
                }
    
                @media only screen and (max-width: 767.98px) {
    
                    #landing1 .f ul li {
                        padding-left: 10px;
                        padding-right: 0px;
                    }
                }
    
                .diet {
    
                    margin-top: 20px;
  					
                   
    
                }
                .formmargin{
              		margin-top: 12px;
              }
  
               {# .diet:hover {
                    transform: scale(1.1); #}
    
                }
    
                .dietcontent {
                    float: right;
                }
    
                p {
                    font-family: 'sf-ui-display-light';
                }
            </style>

{{ content_top }}
 <section id="landing1" class="content" style="background-color:white;">
        
        <div class="container-fluid ">
            <div class="row">
               
                    <div class="col-md-12 col-xs-12 text-center">
                       
                              <h1 class=""><b>Apply For The Job!</b></h1>
                           
                    </div>

               


            </div>
       
        
            <div class="row">
                
                    <div>
                        <div class="col-md-6 col-md-offset-1 col-sm-12 col-xs-12">
                          <!-- <img src="https://www.instadiet.in/image/detention.jpg" alt="Pineapple" class="diet img-responsive"> -->
                          <p><strong>Job Role:</strong></p>
                          <ul>
                              <li>The Production Engineer (PE) is responsibile or managing, monitoring, and configuring the applications on staging and production systems.</li>
                              <li>should be able modify scripts,worked on python scripting OR Hands on coding experience in python</li>
                              <li>Together with your engineering team, will share an on-call rotation and be an escalation contact for service incidents</li>
                              <li>Debugs and fix hard problems in live production </li>
                              <li>Experience in AWS Infrastructure</li>
                          </ul>
                          <p><strong>Skills and Qualification:</strong></p>
                          <ul>
                              <li>4+ years of industry or open source experience.</li>
                              <li>Worked collaboratively on a software development team</li>
                          </ul>
                          <p><strong>Look forward to::</strong></p>
                          <ul>
                              <li>Working with a world-class team. </li>
                              <li>Fun &amp; work at the same place with an amazing work culture and flexible timings.</li>
                              <li>Get ready to transform yourself into a health junkie</li>
                              
                          </ul>
                          
                            <!-- <h2 class="text-center"><span style="font-size: 16px;">Ms. Mili Sethi, Head of Nutrition and Dietetics</span></h2>
                            <p class="text-light text-center" style="font-size: 12px; ">She holds a Postgraduate Degree in Dietetics and Food Service Management. Has Experience of 20 years in Weight management and Healthcare Industry. She has worked in Hospitals 
                          as a Clinical Nutritionist Planning Therapeutic Diets for patients as well as Balanced Diet for Weight loss.</p> -->
                                                    </div>
                        <div class="col-md-3 col-md-offset-1 col-sm-12 col-xs-12" id="appoint">
                            
                            <form action="{{ action }}" method="post" enctype="multipart/form-data" class="form-horizontal formmargin">
                                <div class="form-group">
                                    <div class="col-md-12 col-sm-12 mb-s">
                                        <!-- <i class="fa fa-user icon"></i> -->
                                        <label for="">
                                            <h6><b>Name*</b></h6>
                                        </label>
                                        <input required="" type="text" name="name" value="" id="input-name" class="form-control border bold">
                                        <p id="namecheck"></p>
                                    </div>
                                </div>
                                 <div class="form-group">
                                    <div class="col-md-12 col-sm-12 mb-s">
                                        <label for="">
                                            <h6><b>Email*</b></h6>
                                        </label>
                                        <!-- <i class="fa fa-envelope icon"></i> -->
                                        <input required="" type="text" name="email" value="" id="input_email" class="form-control border bold">
                                        <p id="emailcheck"></p>
                                    </div>
                                </div>
                                 <div class="form-group">
                                    <div class="col-md-12 col-sm-12 mb-s">
                                        <label for="">
                                            <h6><b>Phone*</b></h6>
                                        </label>
                                        <!-- <i class="fa fa-phone icon"></i> -->
                                        <input required="" type="text" name="telephone" value="" id="input_phone" class="form-control border bold">
                                        <p id="phonecheck"></p>
                                      
                                    </div>
                                </div>
                           <div class="form-group">
                                    <div class="col-md-12 col-sm-12 col-xs-12 mb-s">
                                        <label for="">
                                            <h6><b>Post</b></h6>
                                        </label>
                                        <select required="" type="text" name="post_applied" value="" id="input-job" class="form-control border bold">
                                              <option selected value="">Select Post</option>  
                                              <option value="1">iOS Devoloper</option>
                                              <option value="2">Php Devoloper</option>
                                              <option value="3">Android Devoloper</option>
                                              <option value="4">Software Tester</option>
                                              <option value="5">Web Designer</option>
                                              <option value="6">Head Of Operations</option>
                                              <option value="7">Marketing Manager</option>
                                              <option value="8">Marketing Analyst</option>
                                              <option value="9">Jr. Graphic Designer</option>
                                              <option value="10">UI/UX Designer</option>
                                              <option value="11">IT and Sales Recruiter</option>
                                              </select>
                                              <p id="postcheck"></p>
                                    </div>
                                </div>
                                  <!--<div class="form-group">
                                    <div class="col-md-6 col-sm-6 col-xs-6 mb-s">
                                        <label for="">
                                            <h6><b>Age(Yrs)*</b></h6>
                                        </label>
                                        <input required="" type="number" min="0" name="age" value="" id="input_age" class="form-control border bold">
                                        <p id="agecheck"></p>
                                    </div>
                                </div> -->
                               
                               
                                <div class="form-group">
                                    <div class="col-md-12 col-sm-12 mb-s">
                                        <label for="">
                                            <h6><b>Resume*</b></h6>
                                        </label>
                                        <button type="button" id="button-upload" data-loading-text="Uploading.." class="btn btn-default btn-block"><i class="fa fa-upload"></i> &nbsp; </button>
        <input type="hidden" name="file" value="" id="file"/>
                                        <p id="msgcheck"></p>
                                    </div>
                                </div>
                                <div class="form-group text-center">
                                    <div class="col-md-12 col-sm-12">
                                    <input type="hidden" name="subject" value="Job Application">
                     <input type="hidden" name="redirect" value="job-application" >
                      <input type="hidden" name="enquiry" value="job-application" >
                      {% if success %} 
                 <div class="valid col-sm-12" id="close-btn1"><div class="success_inline alert alert-success">{{ success }}<button type="button" class="close" data-dismiss="alert">×</button></div></div>
                     {% endif %}
                                        <button type="submit" id="scrollbtn" class="btn btn-xl btn btn-default bold " value="Submit">Submit</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--end of both section -->
            
            </div>
        </div>
    </section>
    <script>
        $(document).ready(function () {
      
                  $('#namecheck').hide();
                  $('#emailcheck').hide();
                  $('#phonecheck').hide();
                 // $('#msgcheck').hide();
                 // $('#agecheck').hide();
                  $('#postcheck').hide();
      
                  var user_err = true;
                  var email_err = true;
                  var phone_err = true;
                  //var msg_err = true;
                  //var age_err = true;
                  var job_err = true;
                $('#scrollbtn').click(function () {
      
                       var user_err = true;
                       var email_err = true;
                       var phone_err = true;
                       //var msg_err = true;
                      // var age_err = true;
                       var job_err = true;
      
                      name_check();
                       email_check();
                       telephone_check();
                      // msg_check();
                       //age_check();
                       job_check();
      
                  function name_check() {
                      var user_val = $('#input-name').val();
                      if (user_val.length == '') {
                          $('#namecheck').show();
                          $('#namecheck').html("*Please Enter Your Name");
                          $('#namecheck').focus();
                          $('#namecheck').css({"color":"red" , "font-size": "10px"});
                          user_err = false;
                          return false;
                      }
                      else if ((user_val.length < 3) || (user_val.length > 32 )){
                            $('#namecheck').show();
                          $('#namecheck').html("*Name must be between 3 and 32 characters!");
                          $('#namecheck').focus();
                          $('#namecheck').css({"color":"red", "font-size": "10px"});
                          user_err = false;
                          return false;
                      }
                      else {
                          $('#namecheck').hide();
                      }
                  }
      
                   function email_check() {
                      
                      var email_val = $('#input_email').val();
                      var regex =  /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
                      if (regex.test(email_val)) {
                          $('#emailcheck').hide();
                          email_err = true;
                          return true;
                      }
      
                      else if (email_val.length == ''){
                          
                          
                          $('#emailcheck').show();
                          $('#emailcheck').html("*Please enter email address!");
                          $('#emailcheck').focus();
                          $('#emailcheck').css({"color":"red", "font-size": "10px"});
                          email_err = false;
                          return false;
                      }
                      else {
                         
                          $('#emailcheck').show();
                          $('#emailcheck').html("*Please enter valid email characters!");
                          $('#emailcheck').focus();
                          $('#emailcheck').css({"color":"red", "font-size": "10px"});
                          email_err = false;
                          return false;
                         
                      }
                  }
      
                   function telephone_check (){
                      var phone_val = $('#input_phone').val();
                      var phoneno = /[0-9]{10}/;
                      if (phoneno.test(phone_val)){
                          $('#phonecheck').hide();
                          phone_err = true;
                          return true;
                      }
                      else if(phone_val.length == " ") {
                          $('#phonecheck').show();
                          $('#phonecheck').html("*Phone no must be valid!");
                          $('#phonecheck').focus();
                          $('#phonecheck').css({"color":"red", "font-size": "10px"});
                          phone_err = false;
                          return false;
                      }
                      else {
                          $('#phonecheck').show();
                          $('#phonecheck').html("*Please enter valid phone number!");
                          $('#phonecheck').focus();
                          $('#phonecheck').css({"color":"red", "font-size": "10px"});
                          phone_err = false;
                          return false;
                      }
      
                  }
                  

                  function job_check() {
                      var job_val = $('#input-job').val();
                      //    alert(email_val);
      
                      if (job_val.length == '') {
                          $('#postcheck').show();
                          $('#postcheck').html("*Required ");
                          $('#postcheck').focus();
                          $('#postcheck').css({"color":"red", "font-size": "10px"});
                          job_err = false;
                          return false;
                      }
                    // else if ((gender_val.length < 10) || (msg_val.length > 3000)) {
                    //       $('#gendercheck').show();
                    //       $('#gendercheck').html("*Enquiry must be between 10 and 3000 characters!");
                    //       $('#gendercheck').focus();
                    //       $('#gendercheck').css({"color":"red"});
                    //       gender_err = false;
                    //       return false;
                    //   }
                      else {
                          $('#postcheck').hide();
                      }
                  }
                 

      
                      if ((user_err == true) && (email_err == true) && (phone_err == true) && (job_err == true)) {
                          return true;
                      } else {
                          return false;
                      }
                      
                  });
      
              });
      </script>
<script>
    $('button[id^=\'button-upload\']').on('click', function() {
        var node = this;

        $('#form-upload').remove();

        $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

        $('#form-upload input[name=\'file\']').trigger('click');

        timer = setInterval(function() {
            if ($('#form-upload input[name=\'file\']').val() != '') {
                clearInterval(timer);

                $.ajax({
                    url: 'index.php?route=tool/upload',
                    type: 'post',
                    dataType: 'json',
                    data: new FormData($('#form-upload')[0]),
                    cache: false,
                    contentType: false,
                    processData: false,
                    beforeSend: function() {
                        $(node).button('loading');
                    },
                    complete: function() {
                        $(node).button('reset');
                    },
                    success: function(json) {
                        $('.text-danger').remove();

                        if (json['error']) {
                            $(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
                        }

                        if (json['success']) {
                            alert(json['success']);

                            $(node).parent().find('input').attr('value', json['code']);
                        }
                    },
                    error: function(xhr, ajaxOptions, thrownError) {
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
                    }
                });
            }
        }, 500);
    });
</script>
{{ footer }}

Job_Application Controller file content

<?php
class ControllerInformationJobApplication extends Controller {
	public function index() {
		//$this->load->language('information/tracking');

		$this->document->setTitle("Job Application");
		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);
		if(empty($this->session->data['success'])){
$data['success']='0';
		}else{
			$data['success']=$this->session->data['success'];	
		}
		$details=$this->load->controller('common/location');
		$data['countryCode']=$details->countryCode;
		$data['region']=$details->region;
		$data['city']=$details->city;
		$data['action'] = $this->url->link('information/contact', '', true);
		$data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer1');
		$data['header'] =$this->load->controller('common/header1');

		$this->response->setOutput($this->load->view('information/job_application', $data));
	}
	
	
}

Update information/contact controller

<?php
class ControllerInformationContact extends Controller {
	private $error = array();
	private $post_applied=array("1"=>"iOS Devoloper","2"=>"Php Devoloper","3"=>"Android Devoloper","4"=>"Software Tester","5"=>"Web Designer","6"=>"Head Of Operations","7"=>"Marketing Manager","8"=>"Marketing Analyst","9"=>"Jr. Graphic Designer","10"=>"UI/UX Designer","11"=>"IT and Sales Recruiter");
	public function index() {
		$this->load->language('information/contact');

		$this->document->setTitle($this->language->get('heading_title'));

		if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
			$mail = new Mail($this->config->get('config_mail_engine'));
			$mail->parameter = $this->config->get('config_mail_parameter');
			$mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname');
			$mail->smtp_username = $this->config->get('config_mail_smtp_username');
			$mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8');
			$mail->smtp_port = $this->config->get('config_mail_smtp_port');
			$mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout');

			//$mail->setTo($this->config->get('config_email'));
			$mail->setTo('ankit@instadiet.in');
			$mail->setFrom($this->config->get('config_email'));
			$mail->setReplyTo($this->request->post['email']);
			$mail->setSender(html_entity_decode($this->request->post['name'], ENT_QUOTES, 'UTF-8'));
			$mail->setSubject(html_entity_decode(sprintf($this->request->post['subject'], $this->request->post['name']), ENT_QUOTES, 'UTF-8'));//$this->language->get('email_subject')
			$telephone='';
			if(isset($this->request->post['telephone'])){
				$telephone="Telephone: ".$this->request->post['telephone']."\n";
			}
			if(isset($this->request->post['post_applied'])){
				$telephone.="Post Applied: ".$this->post_applied[$this->request->post['post_applied']]."\n";
			}
			$mail->setText($telephone.$this->request->post['enquiry']);
			
			if(isset($this->request->post['file']) && $this->request->post['file']){
				$this->load->model('tool/upload');
				$upload_info = $this->model_tool_upload->getUploadByCode($this->request->post['file']);
				$phyname = DIR_UPLOAD.$upload_info['filename'];
				$temp_name = DIR_UPLOAD.$upload_info['name'];
				copy($phyname,$temp_name);
				$mail->AddAttachment($temp_name);
				
			  }
		  
			  $mail->send();
			  if(isset($temp_name)){
			   unlink( $temp_name );
			  }
			//$mail->send();
if(isset($this->request->post['redirect']))
{
	$redirect=$this->request->post['redirect'];
	$this->session->data['success']="Your query has been successfully submitted. one of our InstaDiet executive will contact you shortly.";
	//$this->response->redirect($this->url->link($redirect));
	$this->response->redirect($redirect);
}else{$this->response->redirect($this->url->link('information/contact/success'));}
			
		}

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('information/contact')
		);

		if (isset($this->error['name'])) {
			$data['error_name'] = $this->error['name'];
		} else {
			$data['error_name'] = '';
		}

		if (isset($this->error['email'])) {
			$data['error_email'] = $this->error['email'];
		} else {
			$data['error_email'] = '';
		}

		if (isset($this->error['enquiry'])) {
			$data['error_enquiry'] = $this->error['enquiry'];
		} else {
			$data['error_enquiry'] = '';
		}

		$data['button_submit'] = $this->language->get('button_submit');

		$data['action'] = $this->url->link('information/contact', '', true);

		$this->load->model('tool/image');

		if ($this->config->get('config_image')) {
			$data['image'] = $this->model_tool_image->resize($this->config->get('config_image'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_height'));
		} else {
			$data['image'] = false;
		}

		$data['store'] = $this->config->get('config_name');
		$data['address'] = nl2br($this->config->get('config_address'));
		$data['geocode'] = $this->config->get('config_geocode');
		$data['geocode_hl'] = $this->config->get('config_language');
		$data['telephone'] = $this->config->get('config_telephone');
		$data['fax'] = $this->config->get('config_fax');
		$data['open'] = nl2br($this->config->get('config_open'));
		$data['comment'] = $this->config->get('config_comment');

		$data['locations'] = array();

		$this->load->model('localisation/location');

		foreach((array)$this->config->get('config_location') as $location_id) {
			$location_info = $this->model_localisation_location->getLocation($location_id);

			if ($location_info) {
				if ($location_info['image']) {
					$image = $this->model_tool_image->resize($location_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_location_height'));
				} else {
					$image = false;
				}

				$data['locations'][] = array(
					'location_id' => $location_info['location_id'],
					'name'        => $location_info['name'],
					'address'     => nl2br($location_info['address']),
					'geocode'     => $location_info['geocode'],
					'telephone'   => $location_info['telephone'],
					'fax'         => $location_info['fax'],
					'image'       => $image,
					'open'        => nl2br($location_info['open']),
					'comment'     => $location_info['comment']
				);
			}
		}

		if (isset($this->request->post['name'])) {
			$data['name'] = $this->request->post['name'];
		} else {
			$data['name'] = $this->customer->getFirstName();
		}

		if (isset($this->request->post['email'])) {
			$data['email'] = $this->request->post['email'];
		} else {
			$data['email'] = $this->customer->getEmail();
		}

		if (isset($this->request->post['enquiry'])) {
			$data['enquiry'] = $this->request->post['enquiry'];
		} else {
			$data['enquiry'] = '';
		}
		if(!isset($this->request->post['telephone'])){
		// Captcha
		if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
			$data['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'), $this->error);
		} else {
			$data['captcha'] = '';
		}
	}

		$data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer1');
		$data['header'] = $this->load->controller('common/header1');

		$this->response->setOutput($this->load->view('information/contact', $data));
	}

	protected function validate() {
		if ((utf8_strlen($this->request->post['name']) < 3) || (utf8_strlen($this->request->post['name']) > 32)) {
			$this->error['name'] = $this->language->get('error_name');
		}
		if (isset($this->request->post['telephone']) && ((utf8_strlen($this->request->post['telephone']) < 10) || (utf8_strlen($this->request->post['telephone']) > 13))) {
			$json['error']['telephone'] = "Valid mobile required";
		}
		if (!filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) {
			$this->error['email'] = $this->language->get('error_email');
		}

		if ((utf8_strlen($this->request->post['enquiry']) < 10) || (utf8_strlen($this->request->post['enquiry']) > 3000)) {
			$this->error['enquiry'] = $this->language->get('error_enquiry');
		}
		if(!isset($this->request->post['telephone'])){
				// Captcha
		if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
			$captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate');

			if ($captcha) {
				$this->error['captcha'] = $captcha;
			}
		}
		}
	

		return !$this->error;
	}

	public function success() {
		$this->load->language('information/contact');

		$this->document->setTitle($this->language->get('heading_title'));

		$data['breadcrumbs'] = array();

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('text_home'),
			'href' => $this->url->link('common/home')
		);

		$data['breadcrumbs'][] = array(
			'text' => $this->language->get('heading_title'),
			'href' => $this->url->link('information/contact')
		);
		$data['heading_title']="Enquiry Submitted";
		$data['text_message']=$this->language->get('text_success');
		$data['continue'] = $this->url->link('common/home');

		$data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = "";//$this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer1');
		$data['header'] = $this->load->controller('common/header1');

		$this->response->setOutput($this->load->view('common/success', $data));
	}
}

Notes on Increment

Notes on Increment

  1. Types of Posts:

There are 3 types of posts

  • Permanent Post
  • Temporary Post
  • Tenure Post
  • Permanent Post: The post which carries a definite scale of pay and sanctioned without limit of time is called Permanent Post(FR 9(22)).  Whenever a person is appointed against a permanent post he is said to be appointed in a substantive capacity and the pay that is allowed on account of such substantive appointment is known as substantive pay.

No person can be paid anything less than substantive pay at any time as a result of fixation of pay in a new scale. If it has to be fixed at a stage less than substantive pay such a drop has to be protected by grant of personal pay.

Exceptions: 1. Reversion on own request 2. Reversion on punishment.

  • Temporary Post: The post which carries definite scale of pay and sanctioned for a limited period is called Temporary Post(FR ((30)).

 A Govt. servant is said to officiate in a post on which another Govt. servant holds a lien.  The pay allowed in such a post is known as officiating pay.

  • Tenure Post: This also a permanent post but a person appointed against that post can hold office only for a limited period (FR 9(30-A)).  Ex: Governor, CAG etc.,
  • Provisions under FR:

The general rules relating to pay fixation are contained in FRs 19 to 35.

FR 19: Next – below Rule

FR 20: Pay of candidates undergoing training

FR 22: When the appointment to another post is in a substantive capacity

FR 24 to 26: Increments (State & Subordinate Service Rules Rule10(g), 13,17(c)

FR 27: Pre-mature increments

FR 28,29: Reduction of Pay as Penalty

FR 30,31: When the appointments are made in officiating capacity FR 35: Pay of officiating Govt. at an amount less than that admissible.

  • Increment:
    • Authority:  FR 24,25,26,27 and FR 31A and Rule 10D, 13 of State & Subordinate Service Rules.
    • FR 24: 
      • An increment shall ordinarily be drawn as a matter of course unless it is withheld.   
      • An increment may be withheld from a Govt. servant by the State Govt. or by any authority to whom the State Govt. may delegate this power if his conduct has not been good, or his work has not been satisfactory.   
      • In ordering the withholding of an increment the withholding authority shall state the period for which it is withheld, and whether the postponement shall have the effect of postponing future increments.  

(iii) The Service which counts for increments:

  1. All duty in a post on a time scale (FR 26(a))
    1. Service in another post, other than a post carrying less pay, whether in a substantive or officiating capacity, service on deputation out of India, and leave other than extraordinary leave shall count for increments in the time scale applicable to the post on which the Govt. servant holds a lien (FR

26(b)(i)).

  • All leave other than EOL and the period of deputation out of India shall count for increment in the time scale applicable to a post in which a Govt. Servant was officiating at the time he proceeded (FR 26(b)(ii))
    • The period of EOL taken on account of illness or for any other cause beyond the Govt. servant’s control or for prosecuting higher scientific or technical studies with an undertaking to serve the Govt. on return from leave for a period of atleast 5 years, sanctioned by the Govt.   (FR 26(b)(ii) Proviso)

HODs are empowered to count the EOL upto 6 months vide

G.O.Ms.No.43, F&P, Dt.05.02.76 and G.O.Ms.No.261, F&P, Dt.23.-6.76)

5) Service in another post of Govt. of another state in India or the Central

                                        Govt.     in     officiating    capacity         (Note    under     FR     26(b)    vide

G.O.Ms.No.294,Fin., Dt.14.09.64 and G.O.Ms.No.183, Fin., Dt.19.07.65)

  • The period of officiating service in the higher post counts for increment in the lower post (FR 26(c)).
    • Foreign Service counts for increments in the post he would hold a lien (FR

26 (e)).

  • Joining time counts for increments in the post he would hold a lien (FR 26

(f)).

  • The EOL granted on the request of the individual for regularization of the dismissal / deemed suspension / suspension period, after exhausting all the available leave may also be counted for the purpose of notional increments and pension (Note 2 under the proviso to FR 26(b)(ii) vide

G.O.Ms.No.307, Fin.(FR.II) Dept., Dt.03.12.2012)

(iv)  Service which does not count for increment:

  1. The period of Willful absence from duty which is treated as Dies-non (FR

18).

  • The period of Suspension treated as not duty (FR 54-B(1)(b).
    • The period of Suspension and period of service preceding the suspension, if the Suspension is made for misconduct (Note 5(a) under FR 24).
    • EOL sanctioned for private affairs (or) for regularizing the period of suspension ( FR 26(b)(ii) and Memo No. 11302/FR.II/64-4, Fin.,

Dt.16.06.64).

  • The period of EOL taken on account of illness or for any other cause beyond the Govt. servant’s control or for prosecuting higher scientific or technical studies with an undertaking to serve the Govt. on return from leave for a period of atleast 5 years, not sanctioned by the Govt.   (FR 26(b)(ii) Proviso)
    • Over-stayal of leave not regularized (Ruling 2 under FR 26(b)).
    • Officiating service in a lower time scale without specific sanction of Govt. will not count for increments in the substantive post on a higher scale (Ruling 9 under FR 26(b)).
    • The service rendered in temporary capacity without having prescribed minimum qualifications for the post (Memo No.2329/64-1, GA (Ser.A), Dt.08.12.64).

(V) Sanction of Notional Increment:

  1. The pay of a Govt. servant whose date of seniority/promotion has been revised and fixed from an earlier date, pay may be refixed on the basis of notional duty in the post from time to time.  Monetary benefit shall be payable only for the period he actually discharged the duties of the post.  Pensionery benefits shall also be revised on the basis of notional pay in case of retirement/death.  (FR 26(aa) and Note 1,2,3,4 under FR 26(aa) vide G.O.Ms.No.163, F&P, Dt.30.06.78 and G.O.Ms.No.286, F&P, Dt.10.11.78).
    1. If Increment falls due on the day following retirement, he may be given the benefit of increment notionally purely for the purpose of pensionary benefits (G.O.Ms.No.235, F&P (FW.FR.II) Dept., Dt.27.10.98).

(VI) Stoppage of Increment:

  1. Without Cumulative Effect: The officer’s pay is restored to what it would have been, had his increment not been withheld from the next natural date from which he would have drawn an increment.(Ruling 1 under FR 24).
    1. With Cumulative Effect: It will have effect on the postponement of the future increments .
    1. In case of stoppage of increments, the increments falling due immediately after the date of issue of the order should be withheld.  The employee shall not be recommended for promotion during the period for which the increments were ordered to withheld with effect from the date of the issue of the order (G.O.Ms.No.342, GA (Ser.V) Dept., Dt.04.08.97 and Circular memo No. 34663/Ser.C/99, GA (Ser.C) Dept., Dt.04.11.99).
    1. The authority withholding an increment of an officer should expressly state in the order that the period for which the increment has been stopped will be exclusive of any interval spent on leave before the period is completed (Instruction under FR 24).
    1. When an increment of an officer is withheld with cumulative effect, it is not the intension that the instruction under FR 24 should be applied. (Ruling 2(b) under FR 24).
    1. The authority withholding the increment in an officer’s pay as a punishment should make it clear in the order whether it will affect the officer’s pension and if so to what extent (Ruling 4 under FR 24).  If the punishment is withholding the increment with cumulative effect, it wiil have effect on the Officer’s Pension also (G.O.Ms.No.252, Fin.(FR.I) Dept.,Dt.29.08.06).
  2. Stagnation Increments: 
    1. RPS 93: All the employees falling under Grade I To XXXII are entitled for 3 stagnation increments beyond the time scale and they shall count for the purpose of pension and pensionery benefits (G.O.(P).No.18, F&P (FW.PC.I) Dept., Dt.19.01.94).
    1. The stagnation increments beyond the time scale in RPS 93 be reckoned as pay for purpose of fixation of pay on promotion on to the higher posts/AAS. (G.O.Ms.No.173, F&P (FW.PC.II) Dept.,

Dt.07.10.97).

  • The stagnation increments be sanctioned at the higher rate as admissible to the Pay. (Memo No.5763/59/PC-1/99-1, F&P

(FW.PC.I) Dept., Dt.27.02.99).

  • RPS 99: 3 stagnation increments sanctioned beyond the time scale and they shall be treated as regular increments for all purposes such as fixation of pay on promotion/AAS. (G.O.Ms.No.152, F&P (FW.PC.I) Dept., Dt.04.11.2000).
    • The pay in RPS shall be fixed at the next stage over the aggregate by adding Stagnation Increments to the maximum of the Scale.  If the aggregate is more than the elongated scale even after allowing 3 stagnation increments, then the difference will be treated as Personal Pay to be absorbed in future increases of pay. (Clarification issued vide Memo No.40577/581/PC.I/2000, F&P (FW.PC.I) Dept, Dt.23.11.2000).
    • RPS 2005: All the employees falling under Grade I – Grade XXXII are entitled for 5 stagnation increments beyond the time scale and they shall be treated as increments for all purposes such as fixation of pay on promotion/AAS, Pension etc., (G.O.(P).No.180, Fin.(PC.I) Dept., Dt.29.06.06).
    • Stagnation increments are allowed at the higher rate beyond the time scale of pay in the revised pay scales 2005, since the Master

Pay Scales is elongated one. (Memo No.21445/367/A1/PC.I/2007, Fin. (PC.I) Dept., Dt.25.04.08).

  • RPS 2010: Govt. have sanctioned 3 stagnation increments falling under Grade I to XXXII, to be allowed beyond the time scale and these shall be treated as increments for all purposes such as fixation of pay on promotion/AAS, Pension etc., (G.O.Ms.No.52, Fin.(PC.I) Dept., Dt.25.02.10).
    • RPS 2015: Govt. have sanctioned 5 stagnation increments to Grade I – XXXII beyond the time scale and these shall be treated as increments for all purposes such as fixation of pay on promotion/AAS, Pension etc., (G.O.Ms.No.25, Fin.(HR-V-PC)

Dept., Dt.30.04.15).

  • Drawl of Increment:
  • Increment will be drawn from first day of the month in which it is due.  The first increment in the case of initial appointment or promotion will be drawn a few days in advance of the completion of 12 months (G.O.Ms.No.133, F&P, Dt.13.-5.74 and G.O.Ms.No.192, F&P, Dt.01.08.74).
  • In arriving at the date of next increment, the periods which do not count for increment will be added to the normal date of increment and if that date falls in the middle of the month, increment will be drawn from the first day of that month.
  • If the employee is on leave on the first day of that month in which it is due, it will be drawn from the date of joining duty after leave.
  • Increments withheld as a penalty without cumulative effect will be drawn from the date following the date of expiry of penalty.  (Memo no.49463A/21111/FR.II/74.1, F&P, Dt.06.10.74).

(IX) Sanction of Increments:

  1. No increment should be given unless an increment certificate in APTC Form 49 is enclosed by the drawing officer.  If increments are granted on the assumption of satisfactory completion of probation without an order of a competent authority, the drawing officer should append a certificate in the increment certificate as prescribed therein (Ruling 5(b) under FR 24).
  2. An increment watch register has been prescribed in G.O.Ms.No.104, Fin. & Plg. (FW.A&L) Dept., Dt.08.03.76.
  3. To ensure prompt drawl of increments the drawing officer should verify the Service Books of all his subordinates in the month of December of every year and maintain a register showing the names of all persons for whom increments are due in each month of succeeding year in the APTC Form 106 and if persons are transferred to his office, their names should be entered in the relevant pages with reference to their rates of increments. (Note 3 under SR 13, TR 16 of APTC Vol.I).
  4. Passing of an Examination or test confers on a Govt. servant the title to any right, benefit or concession, such should be deemed to have accrued on the day following the last day of the examination or test which he passed. (Ruling 2 under FR 26(b).
  5. When the period of probation is two years and when increment is annual, the probationer is entitled to draw the first increment after commencement of probation; his second increment will have to be drawn only w.e.f. the date following the date of declaration of probation but the period of service from the date of the first increment shall count for subsequent increments. (FR 31-A(2)(i)(a)).
  6. Increment Sanctioning Authority: The drawing Officer in each department is authorized to release and to sign the increment certificate of the Govt. employees in each Department.  In cases where the Drawing Officer and the officer who maintain the service records of the employees is different, a certificate of service particulars eligible for earning increment shall be given by the authority who maintain the service registers to the Drawing Officer, release of the increment. (Memo No.16965/677/A&L/5, F&P (FW.A&L) Dept., Dt.13.02.87).

(X ) Some other Important FR Provisions:

  1. FR 25 Sanction of Efficiency Bar Increment: Where an efficiency bar is prescribed in a time scale the next increment after such bar should not be given without the specific sanction of authority competent to withhold increments.
  2. FR 27 Sanction of Premature Increments: 
    1. An authority may grant a premature increment to a Govt. service on a time scale of pay if that authority has power to create a post in the same cadre on the same scale of pay.
    1. Govt. is the competent authority to create or abolish a post on a time scale of pay.
    1. The Administrative Depts. of the Secretariat have to obtain the prior approval of Finance Dept. to grant advance/premature increments.

Convert Date Format to dd/mm/yyyy in Excel

Microsoft Excel is a software that allows you to create efficient spreadsheets for the business of personal use. They permit you to stay organized while managing large amounts of data, which can be organized in a range of ways. One popular way to organize this data is by date. Excel comes with a default date format, mm/dd/yyyy, but you can always choose to change the date format, to dd/mm/yyyy, for example.

Change Excel Date Format from mm/dd/yyyy to dd/mm/yyyy

To change the date display in Excel follow these steps:

  • Go to Format Cells > Custom
  • Enter dd/mm/yyyy in the available space.

The dates listed in your spreadsheet should be converted to the new format.

We detected event code but the pixel has not activated for this event, so no information was sent to Facebook.

We detected event code but the pixel has not activated for this event, so no information was sent to Facebook. This could be due to an error in the code, but could also occur if the pixel fires on a dynamic event such as a button click

Overview

The Pixel Helper is a Chrome Browser extension that runs in the background to automatically review websites for Facebook Pixel code. When the extension is installed a </> icon, the Pixel Helper icon, will appear in the upper right corner of the browser next to the address bar. When a website has a Facebook Pixel installed the Pixel Helper icon turns blue and a small badge will appear indicating the number of pixels found on the webpage. If the icon does not turn blue, no Facebook pixels are installed on this webpage. Click the Pixel Helper icon and a small popup appears with information you can use to verify, troubleshoot, and improve our pixel.

Install Pixel Helper

Requirements

To use the Facebook Pixel Helper you must:

Verify Pixel Implementation

Navigate to your website in the Chrome browser, and click on the Pixel Helper icon. The popup will tell what pixels were found on the webpage, and whether they have loaded successfully.

Troubleshooting

The Facebook Pixel Helper reports errors and suggestions to improve performance.

Data Processing Parameters Sent

This section shows if data processing parameters are being sent with the Limited Data Use flag. DPOST and DPOCO will show 1, 1000 if it is sent with California/USA data.

source:https://developers.facebook.com/docs/facebook-pixel/support/pixel-helper#did-not-load

How to Troubleshoot Your Facebook Pixel – Pixel Helper Explained

Pixel Helper Chrome Extension can show a number of messages, some of them being real errors, some of them simple warnings or false errors. We try to cover them all in this article.

Keep in mind that Facebook is in constant change, and some of the errors messages on this page might be replaced by others or simply out of use. We do our best to keep the list here up to date and useful.

What is Facebook Pixel Helper Chrome Extension?

Pixel Helper is an official Facebook pixel testing tools. It’s connected to Facebook itself, so the results it gives are usually pretty accurate.

Facebook Pixel Helper functions in the background in order to automatically review the websites you are browsing. It reviews the websites for code similar to a Facebook pixel. Whenever a website features an installed pixel, the extension icon will take the blue color, making a small badge appear. This badge will indicate how many events were found on that page. If you click the extension button after it has turned blue, useful information on the Facebook pixels will appear.

In case the pixel is placed where it’s supposed to be and is also being loaded the correctly, the site indicator will take the color green. In case something is not right, the indicator will take the color red. When the indicator is red, you also receive a short explanation about what needs to be fixed, and how to fix it.

IMPORTANT: The pixel itself won’t send any data if you use an ad-blocking software. Sometimes the extension will show the pixel with a message saying that no data was sent, sometimes it won’t show anything. It’s important to turn your ad-blocker OFF when you test the pixel.

How to Install Facebook Pixel Helper

If you want to use the Facebook Pixel Helper, you’ll have to first make sure that the web browser Chrome is installed on your computer. After that, check with the Chrome Store and get the Pixel Helper. Follow the instructions the Chrome Store has and install the extension in your browser. As soon as the Facebook Pixel Helper is installed, an icon </> will appear next to your address bar.

Click Here to Install Pixel Helper Chrome Extension

How to Verify Pixel Implementation

Navigate through the website with your Chrome browser. Click the Pixel Helper icon. A small window with pixel related info will appear. It will tell you what pixels was found on the page, and if these pixels have successfully loaded. In case your pixels have loaded successfully, you can start to run ads with them.

You will also see each pixel event that was fired. Click on the event to see its parameters, what type of Advanced Matching info was sent, URL called, load time and pixel location:

Troubleshooting Pixel Errors

Facebook Pixel Helper reports common errors that indicate something needs to be fixed in order for the product to be used properly.

pixel-helper-test

  • Pixel Did Not Load: Sometimes can be ignored

When this error appears it means that the Facebook Pixel Helper has managed to find what looks like Facebook pixel code on the website, but the actual HTTP call hasn’t been made. This usually happens because of an error in the code, but it can also occur when the pixel fires on a dynamic event, for example, a click button. In this case, the error will disappear if you click the button.

  • Resembles a Standard Event: Sometimes can be ignored

This error means that the Facebook Pixel Helper discovered a custom event that seems similar to a Facebook Standard Event. Let’s take an example: instead of AddToCart, it is AddtCart. It is recommendable that standard events are used whenever possible. If you actually intend to use that custom event with that particular name, you can ignore this warning.

  • Encoded Characters: Sometimes Take Action

When this appears, it means that the Facebook Pixel Helper came across something that seems to be double-encoded characters. This could happen because of a tag or a CSM system that encodes information that has already been encoded. For example, encoding &amp; into &amp;amp;. Please confirm and make sure that characters are not being encoded two times, for example, change &amp; to &. Sometimes this is not a real warning, if, for example, you use a & symbol in your title.

  • The Facebook pixel activated 2 times on this web page: Sometimes can be ignored

This is usually an error since an event should load only once on a page. There are some situations when this can be safely ignored. For example, when you have a dynamic event triggered on click that is activated multiple times. 

Facebook can show this message in relation to a single event, and not to the pixel. This means that the pixel code itself wasn’t activated twice, but just one event.

  • Invalid Pixel ID: Take Action

This is an error that means the sent ID for the pixel did not match a known pixel ID in the system. If you’re using the PixelYouSite plugin, double check the ID you enter and make the necessary correction.

Troubleshooting Suggestions

Some of the warnings you can see in the Pixel Helper are not exactly errors on your side, but purely improvement suggestions that the software thinks you can take into consideration.

Dynamic Ads & Product Catalog Related Errors:

Those are all messages that Pixel Helper gives (or used to give at some point) related to Facebook Dynamic Ads (Promote a product catalog option)

  • Facebook Pixel can’t match products
  • The Pixel is not paired with any product catalog
  • No products found for given content
  • Unable to Find Product Catalog
  • Pixel Doesn’t Have a Product Catalog Pair

They mean that the product ID sent by the pixel is not found in a Product Catalog, or that no Product Catalog exists.

If you are not using Facebook Dynamic Ads (Promote a product catalog option) or if the content is not a product, you can ignore this message.

If you do Dynamic Ads you must check the product feed and make sure that it has all the products you want it to have.

If you do Dynamic ads and you have a Product Catalog that is supposed to contain that specific product ID do the following:

  • make sure that the pixel and the Product Catalog ID and the pixel content_ids parameter are using the same logic (product ID or product SKU)
  • check if the product ID exits in your Product Catalog
  • check if the catalog is connected to the same pixel ID you are using on the site. You can control this from the Catalog Settings, Event Source.

Other warnings you might have:

  • Pixel Took too Long to Load: Sometimes can be ignored

This error indicates that it took too much time before the pixel was activated. This may happen because of the location of the pixel on the page. If someone who visited your web page closes it, clicks on a link, or simply just navigates away before the pixel event gets to be activated, the action is not going to be tracked. Because of this, an important percentage of actions and conversions can be lost. That’s why it is recommended for the pixel code to be placed early in the web page. Some prefer to put it, in HTML, just before the closing </head> tag. If you are using PixelYourSite the code is inserted on top of your page, so it will load fast.

  • Pixel is Not the Only Conversion: Sometimes can be ignored

It is not recommended to load multiple conversion events on one page. This will make the optimization inefficient, together with the tracking of those conversion events. You could use one conversion pixel across all ads optimizing or tracking for the event. If a secondary conversion event takes place when a person interacts with the web page (for example, when it does a button click), the warning can be ignored.

  • Content_type is missing, should be either ‘product’ or ‘product_group’: Sometimes can be ignored

This usually means that the content_type parameter is not “product” or “product_group”. If the event is not used for Facebook Dynamic Ads you can ignore it. It looks like Facebook decided to drop this message lately.

  • You Have Opted Out of Tracking: Take action

This is related to your Facebook Privacy settings and means that you have opted out of tracking from Facebook. Because of this, Facebook Pixel Helper extension will not work, leaving potential pixel problems undetected. To fix it, temporarily modify your ads settings: https://www.facebook.com/settings?tab=ads

How to Uninstall Facebook Pixel Helper

In order to uninstall the Facebook Pixel Helper, just type chrome://extensions/ into the address bar of your Chrome browser. After that, click the trash icon close to the Facebook Pixel Helper extension.

source:pixelyoursite

Testing Webhooks Locally for Amazon SNS

Testing Tools

To test the code I wrote for the blog post, I used PHP’s built-in web server (available in PHP 5.4 and later) to serve the code locally. I used another tool called ngrok to expose the locally running PHP server to the public internet. Ngrok does this by creating a tunnel to a specified port on your local machine.

You can use PHP’s built-in web server and ngrok on Windows, Linux, and Mac OS X. If you have PHP 5.4+ installed, then the built-in server is ready to use. To install ngrok, use the simple instructions on the ngrok website. I work primarily in OS X, so you may need to modify the commands I use in the rest of this post if you are using another platform.

Setting Up the PHP Code

First, you’ll need the PHP code that will handle the incoming messages. My post about receiving SNS messages provides a complete code example for doing this.

Let’s create a new folder in your home directly to use for this test. We’ll also install Composer, the AWS SDK for PHP, create a directory for the webroot, and create files for the PHP code and a log.

mkdir ~/sns-message-test && cd ~/sns-message-test
curl -sS https://getcomposer.org/installer | php
php composer.phar require aws/aws-sdk-php:~2.6.0
touch messages.log
mkdir web && touch web/index.php

Now take the PHP code from the other blog post and put it in index.php. Here is that same code, but with the require statement needed to load the SDK with our current file structure. I am also going to update the code to log the incoming messages to a file so we can easily see that the messages are being handled correctly.

<?php

require __DIR__ . '/../vendor/autoload.php';

use AwsSnsMessageValidatorMessage;
use AwsSnsMessageValidatorMessageValidator;
use GuzzleHttpClient;

// Make sure the request is POST
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    die;
}

try {
    // Create a message from the post data and validate its signature
    $message = Message::fromRawPostData();
    $validator = new MessageValidator();
    $validator->validate($message);
} catch (Exception $e) {
    // Pretend we're not here if the message is invalid
    http_response_code(404);
    die;
}

if ($message->get('Type') === 'SubscriptionConfirmation') {
    // Send a request to the SubscribeURL to complete subscription
    (new Client)->get($message->get('SubscribeURL'))->send();
}

// Log the message
$file = new SplFileObject(__DIR__ . '/../messages.log', 'a');
$file->fwrite($message->get('Type') . ': ' . $message->get('Message') . "n");

Creating an Amazon SNS Topic

Before you can perform any tests, you must set up an Amazon SNS topic. You can do this easily in the AWS Management Console by following the Getting Started with Amazon Simple Notification Service guide. This guide also shows how to subscribe to a topic and publish a message, which you will also need to do in a moment.

Setting Up the Server

OK, we have an Amazon SNS topic ready and all of the files we need in place. Now we need to start up the server and make it accessible to Amazon SNS. To do this, create 3 separate terminal windows or tabs, which we will use for 3 separate long-running processes: the server, ngrok, and tailing the messages log.

Launching the PHP Built-in Server

In the first terminal window, use the following command to start up the PHP built-in web server to serve our little test webhook. (Note: you can use a different port number, just make sure you use the same one with ngrok.)

php -S 127.0.0.1:8000 -t web/

This will create some output that looks something like the following:

PHP 5.4.24 Development Server started at Mon Mar 31 11:02:14 2014
Listening on http://127.0.0.1:8000
Document root is /Users/your-user/sns-message-test/web
Press Ctrl-C to quit.

If you access http://127.0.0.1:8000 from your web browser, you will likely see a blank page, but that request will show up in this terminal window. Since our code is set up to respond only to POST requests, we will see the expected behavior of a 405 HTTP code in the response.

[Mon Mar 31 11:02:44 2014] 127.0.0.1:61409 [405]: /

Creating a Tunnel with ngrok

In the second terminal window, use the following command to create an ngrok tunnel to the PHP server. Use the same port as you did in the previous section.

ngrok 8000

That was easy! The output of this command will contain a publicly accessible URL that forwards to your localhost.

Tunnel Status                 online
Version                       1.6/1.5
Forwarding                    http://58565ed9.ngrok.com -> 127.0.0.1:8000
Forwarding                    https://58565ed9.ngrok.com -> 127.0.0.1:8000
Web Interface                 127.0.0.1:4040
# Conn                        1
Avg Conn Time                 36.06ms

ngrok also provides a small web app running on localhost:4040 that displays all of the incoming requests through the tunnel. It also allows you to click a button to replay a request, which is really helpful for testing and debugging your webhooks.

Tailing the Message Logs

Let’s use the third terminal window to tail the log file that our PHP code writes the incoming messages to.

tail -f messages.log

This won’t show anything yet, but once we start publishing Amazon SNS messages to our topic, they should be printed out in this window.

Testing the Incoming SNS Messages

Now that everything is running and wired up, head back to the Amazon SNS console and subscribe the URL provided by ngrok as an HTTP endpoint for your SNS topic.

If all goes well, you should see output similar to the following on each of the 3 terminal windows.

PHP Server:

[Tue Apr  1 08:51:13 2014] 127.0.0.1:50190 [200]: /

ngrok:

POST /                        200 OK

Log:

SubscriptionConfirmation: You have chosen to subscribe to the topic arn:aws:sns:us-west-2:01234567890:sdk-test. To confirm the subscription, visit the SubscribeURL included in this message.

Back in the SNS console, you should see that the subscription has been confirmed. Next, publish a message to the topic to test that normal messages are processed correctly. The output should be similar:

PHP Server:

[Tue Apr  1 10:08:14 2014] 127.0.0.1:51235 [200]: /

ngrok:

POST /                        200 OK

Log:

Notification: THIS IS MY TEST MESSAGE!

Nice work!

As well as Amazon Web Services and many more.

Display country, region, city using ip address in php

	$ipaddress = $_SERVER['REMOTE_ADDR'];
		//$ipaddress='203.115.97.180';
		//$json       = file_get_contents("http://ip-api.com/json");
	//$json       = file_get_contents("http://ipinfo.io/{$ipaddress}");
	//$json       = file_get_contents("http://ipinfo.io/{$ipaddress}");
		$json       = file_get_contents("http://ip-api.com/json/".$ipaddress);
		$details    = json_decode($json);
		$data['countryCode']=$details->countryCode;
		$data['region']=$details->region;
		$data['city']=$details->city;

how to run opencart admin url using curl command without token

Path admin/controller two files contain variable $ignore in the master branch in both login.php and permission.php

<?php
class ControllerStartupLogin extends Controller {
	public function index() {
		$route = isset($this->request->get['route']) ? $this->request->get['route'] : '';

		$ignore = array(
			'common/login',
			'common/forgotten',
			'common/reset',
			'aditya/product_low_quantity'
		);

		// User
		$this->registry->set('user', new Cart\User($this->registry));

		if (!$this->user->isLogged() && !in_array($route, $ignore)) {
			return new Action('common/login');
		}

		if (isset($this->request->get['route'])) {
			$ignore = array(
				'common/login',
				'common/logout',
				'common/forgotten',
				'common/reset',
				'error/not_found',
				'error/permission',
				'aditya/product_low_quantity'
			);

			if (!in_array($route, $ignore) && (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token']))) {
				return new Action('common/login');
			}
		} else {
			if (!isset($this->request->get['user_token']) || !isset($this->session->data['user_token']) || ($this->request->get['user_token'] != $this->session->data['user_token'])) {
				return new Action('common/login');
			}
		}
	}
}
<?php
class ControllerStartupPermission extends Controller {
	public function index() {
		if (isset($this->request->get['route'])) {
			$route = '';

			$part = explode('/', $this->request->get['route']);

			if (isset($part[0])) {
				$route .= $part[0];
			}

			if (isset($part[1])) {
				$route .= '/' . $part[1];
			}

			// If a 3rd part is found we need to check if its under one of the extension folders.
			$extension = array(
				'extension/advertise',
				'extension/dashboard',
				'extension/analytics',
				'extension/captcha',
				'extension/extension',
				'extension/feed',
				'extension/fraud',
				'extension/module',
				'extension/payment',
				'extension/shipping',
				'extension/theme',
				'extension/total',
				'extension/report',
                'extension/openbay'
			);

			if (isset($part[2]) && in_array($route, $extension)) {
				$route .= '/' . $part[2];
			}

			// We want to ingore some pages from having its permission checked.
			$ignore = array(
				'common/dashboard',
				'common/login',
				'common/logout',
				'common/forgotten',
				'common/reset',
				'error/not_found',
				'error/permission',
				'aditya/product_low_quantity'
			);

			if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $route)) {
				return new Action('error/permission');
			}
		}
	}
}

After that run command

curl “https://yourdomain.in/administer/?route=aditya/myurl”

if curl not installed, please install

$ sudo apt update
$ sudo apt install curl
$ curl

php upgrade to 7.4 apache

Add PPA for PHP 7.4

Add the ondrej/php which has PHP 7.4 package and other required PHP extensions.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Once you have added the PPA you can install PHP 7.4.

Install PHP 7.4 for Apache

Execute the following command to install PHP 7.4

sudo apt install php7.4

Install PHP 7.4 Extensions

Installing PHP extensions are simple with the following syntax.

sudo apt install php7.4-extension_name

Now, install some commonly used php-extensions with the following command.

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

After the installation has completed, you can confirm the installation using the following command

php -v

Enable PHP 7.4 for Apache

Now you need to tell Apache to use the installed version of PHP 7.4 by disabling the old PHP module (below I have mentioned php7.0, you need to use your current php version used by Apache) and enabling the new PHP module using the following command.

sudo a2dismod php7.0
sudo a2enmod php7.4

Restart Apache for the changes to take effect.

sudo service apache2 restart

change default auto login user in ubuntu

sudo leafpad /etc/lxdm/default.conf
sudo leafpad /etc/lightdm/fileexample.conf

In the fist few line, you will see something like autologin=username change it to the original state of # autologin=dgod. Save the file, and then reboot your machine.

autologin-user=username
autologin-user-timeout=0

Using privileged admin account open up terminal or your favorite text file editor and edit the /etc/gdm3/custom.conf configuration file. Change from:

[daemon]
# Uncoment the line below to force the login screen to use Xorg
#WaylandEnable=false

# Enabling automatic login
#  AutomaticLoginEnable = true
#  AutomaticLogin = user1