Pages

Wednesday, February 22, 2017

Showing the calendar in jquery with month and year

Practice with Showing the calendar in jquery and showing the month select and year select.

 

$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy',
yearRange: "1990:2050",
            changeMonth: true,
            changeYear: true
        });

Tuesday, February 21, 2017

How to Encode and Decode Strings with Base64 in JavaScript

How to Encode and Decode Strings with Base64 in JavaScript

Internet Explorer 10 and above



// Define the string var string = 'Hello World!'; // Encode the String var encodedString = btoa(string); console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh" // Decode the String var decodedString = atob(encodedString); console.log(decodedString); // Outputs: "Hello World!"

Friday, February 3, 2017

Remove Index.php from URL in codeigniter

How to Remove Index.php from URL in codeigniter

Just Copy and paste this data in your .htaccess on root folder of your project file then run your project.

RewriteEngine On

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

#When your application folder isn't in the system folder

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Thursday, February 2, 2017

Upload file from url in PHP via Curl




 $ch = curl_init();
            $source = 
'http://website.com/filename.jpg';
            $path_parts = pathinfo('http://website.com/filename.jpg');
            curl_setopt($ch, CURLOPT_URL, $source);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $data = curl_exec ($ch);
            curl_close ($ch);

           // Your File Path and Filename here

            echo $destination = "./fileuplods/".$path_parts['filename'].'.'.$path_parts['extension'];
            $file = fopen($destination, "w+");
            fputs($file, $data);
            fclose($file);