Hello world!
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
SQL query : Delete data of particular time period using
To delete data of some fix date and time use below mention query in your code. DELETE FROM tbl_user WHERE date < DATE_SUB(NOW(), INTERVAL 7 DAY) In above query “INTERVAL 7 DAY” here you can set any number of days like 1, 2, 5 etc…
Get All data in Codeigniter using session
load all data using session in CI Put this code in your controllers file$this-.load->library(‘session’); $username = ‘Harshit Shingala’; $this->session->set_userdata(‘username’,$username); $var = $this->session->userdata; echo $var[‘username’];
Country->state->city using ‘Jquery Ajax’ in codeigniter
Country State City Flow In Codeigniter Using Jquery Ajax My Controller’s Function Code:- //STATE public function state($id) { $this->load->model(‘admin/model’); $where=array(“country_id”=>$id); //print_r ($where); break; $state=$this->model->sel_where(‘state’,$where); echo “-State-“; foreach($state as $row) { echo””.$row[‘state_name’].””; } } //city public function city($id) { $this->load->model(‘admin/model’); $where=array(“state_id”=>$id); //print_r ($where); break; […]
PHP Code for Sending free SMS through your way2sms account…
Sending free SMS through way2sms in PHP <?php function send_sms($userID, $userPWD, $recerverNO, $message){if (!function_exists(‘curl_init’)) {echo “Error : Curl library not installed”;return FALSE;}$message_urlencode = rawurlencode($message);if (strlen($message) > 140) {$message = substr($message, 0, 139);} $cookie_file_path = “./cookie.txt”;$temp_file = “./temporary.txt”;$user_agent = “Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36”; // LOGIN TO WAY2SMS $url = “http://site24.way2sms.com/content/Login1.action”;$parameters = array(“username” => “$userID“,“password” => “$userPWD“,“button” => “Login”); $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, count($parameters));curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);curl_setopt($ch, CURLOPT_HEADER, TRUE);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);curl_setopt($ch, CURLOPT_NOBODY, FALSE);$result = curl_exec($ch);curl_close($ch); // SAVE LOGOUT URL file_put_contents($temp_file, $result);$result = “”;$logout_url = “”;$file = fopen($temp_file, “r”);$line = “”;$cond = TRUE;while ($cond == TRUE) {$line = fgets($file);if ($line === FALSE) { // EOF$cond = FALSE;} else {$pos = strpos($line, ‘ window.location=”‘);if ($pos === FALSE) {$line = “”;} else { // URL FOUND$cond = FALSE;$logout_url = substr($line, –25);$logout_url = substr($logout_url, 0, 21);}}}fclose($file); // SAVE SESSION ID $file = fopen($cookie_file_path, “r”);$line = “”;$cond = TRUE;while ($cond == TRUE) {$line = fgets($file);if ($line === FALSE) { // EOF$cond = FALSE;} else {$pos = strpos($line, “JSESSIONID”);if ($pos === FALSE) {$line = “”;} else { // SESSION ID FOUND$cond = FALSE;$id = substr($line, $pos + 15);}}}fclose($file); // SEND SMS $url = “http://site24.way2sms.com/smstoss.action?Token=” . $id;$parameters = array(“button” => “Send SMS”,“mobile” => “$recerverNO“,“message” => “$message”); $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, count($parameters));curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);curl_setopt($ch, CURLOPT_HEADER, TRUE);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);curl_setopt($ch, CURLOPT_NOBODY, FALSE);$result = curl_exec($ch);curl_close($ch); // LOGOUT WAY2SMS $url = “site24.way2sms.com/” . $logout_url; $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_HEADER, TRUE);curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);curl_setopt($ch, CURLOPT_NOBODY, FALSE);$result = curl_exec($ch);curl_close($ch); // DELETE TEMP FILES unlink($cookie_file_path);unlink($temp_file); […]
Uploads Multiple image using PHP
To upload Multiple file using PHP <?phpif(isset($_FILES[‘files’])){$errors= array(); foreach($_FILES[‘files’][‘tmp_name’] as $key => $tmp_name ){ $file_name = $key.$_FILES[‘files’][‘name’][$key]; $file_size =$_FILES[‘files’][‘size’][$key]; $file_tmp =$_FILES[‘files’][‘tmp_name’][$key]; $file_type=$_FILES[‘files’][‘type’][$key]; if($file_size > 2097152){ $errors[]=’File size must be less than 2 MB’; } $query=”INSERT into upload_data (`USER_ID`,`FILE_NAME`,`FILE_SIZE`,`FILE_TYPE`) VALUES(‘$user_id’,’$file_name’,’$file_size’,’$file_type’); “; $desired_dir=”user_data”; if(empty($errors)==true){ if(is_dir($desired_dir)==false){ mkdir(“$desired_dir”, 0700); // Create directory if it does not exist } […]
Simple Html Slider With BootStrap
Simple Slider In Bootstrap Bootstrap Example https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.jshttp://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js .carousel-inner > .item > img,.carousel-inner > .item > a > img {width: 70%;margin: auto;} Activate Carousel with JavaScript Chania The atmosphere in Chania has a touch of Florence and Venice. Chania The atmosphere in Chania has a touch of Florence and Venice. Flowers Beatiful flowers in Kolymbari, Crete. […]
How to Remove Index.php in CODEIGNITER FRAMEWORK
Steps to remove index.php from url codeigniter :- Config changes :- Go to “application/config/config.php” Find below code:- $config[‘index_page’] = ‘index.php’; Replace with the below code:- $config[‘index_page’] = ”; .htaccess changes :- If you not have any htaccess create new and place it on your root. Go to “application/config/config.php” Find below code $config[‘uri_protocol’] = ‘AUTO’; Replace with the […]
Set pagination in searching data in table [ codeigniter ]
Set Peginaation in Searching in codeigniter Controller Code: <?phpif (!defined(‘BASEPATH’)) exit(‘No direct script access allowed’);class User extends CI_Controller {function __construct() {// Call the Model constructorparent::__construct();$this->load->helper(‘url’);$this->load->model(‘nj_user’);$this->load->library(“session”);$username = $this->session->userdata(‘username’);if (empty($username)) {redirect($this->config->base_url() . ‘login’);}$this->load->library(“pagination”);}public function index() {redirect($this->config->base_url() . ‘user/view’);}//sarchingpublic function searchterm_handler($searchterm) {if ($searchterm) {$this->session->set_userdata(‘searchterm’, $searchterm);return $searchterm;} elseif ($this->session->userdata(‘searchterm’)) {//print_r ($_SESSION[‘searchterm’]);exit;$searchterm = $this->session->userdata(‘searchterm’);return $searchterm;} else {$searchterm = “”;return $searchterm;}}public […]
User "Status" Button in php codeigniter with ajax.
Hot to set user Active and Deactive Button in php Codeigniter with Ajax and Bootstrap. Controller Code: public function change_user_status($par = NULL) { $this->model_name->user_status($par); } Model Code: function user_status($st) { if ($st == “true”) { $this->db ->set(‘status’, “Active”) ->where(‘user_id’, $_POST[‘id’]) ->update(‘model_name’); } else { $this->db ->set(‘status’, “Deactice”) ->where(‘user_id’, $_POST[‘id’]) ->update(‘model_name’); […]