Posts

Showing posts from January, 2019

print SQL statement in codeigniter model

echo $this->db->last_query();

pagination in codeigniter step by step tutorial.

http://techarise.com/codeigniter-pagination-demo/

image upload in codeigniter

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Users extends CI_Controller {     function  __construct() {         parent::__construct();         $this->load->model('user');     }         function add(){         if($this->input->post('userSubmit')){                         //Check whether user upload picture             if(!empty($_FILES['picture']['name'])){                 $config['upload_path'] = 'uploads/images/';                 $config['allowed_types'] = 'jpg|jpeg|png|gif';                 $config['file_name'] = $_FILES['picture']['name'];                     ...

login password verification issue solved in codeinget

<?php if($this->input->post('loginSubmit')){         $this->form_validation->set_rules('email', 'Email', 'required|valid_email');         $this->form_validation->set_rules('password', 'password', 'required');         if ($this->form_validation->run() == true) {             $con['returnType'] = 'single';             $con['conditions'] = array(                 'email'=>$this->input->post('email'),                 'status' => '1'             );             $checkLogin = $this->user->getRows($con); // assumes 'password' field is also returned..             if(password_verify($this->input->post('password'), $checkLogin['password']){   ...

How to generate password salt with codeigniter

// Hash a new password for storing in the database. // The function automatically generates a cryptographically safe salt. $hashToStoreInDb = password_hash ( $password , PASSWORD_BCRYPT ); // Check if the hash of the entered login password, matches the stored hash. // The salt and the cost factor will be extracted from $existingHashFromDb. $isPasswordCorrect = password_verify ( $password , $existingHashFromDb ); Refrence: https://stackoverflow.com/questions/25720721/how-to-generate-password-salt-with-codeigniter

map show by address using php jquery

<?php $address = $row['business_address']; // $url = "http://maps.google.com/maps/api/geocode/json?address=".urlencode($address); $url = "https://maps.googleapis.com/maps/api/geocode/json?address='".urlencode($address)."'&sensor=true&key=AIzaSyCBK8biD4eeBl4E1GoRdh57ndMTHWfYQX4"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);    $responseJson = curl_exec($ch); curl_close($ch); $response = json_decode($responseJson); if ($response->status == 'OK') {     $latitude = $response->results[0]->geometry->location->lat;     $longitude = $response->results[0]->geometry->location->lng;    /* echo 'Latitude: ' . $latitude;     echo '<br />';     echo 'Longitude: ' . $longitude;*/ } else {     echo $response->status;     var_dump($response); }    ?> <script src="https://maps.googleap...