Posts

Showing posts from 2016

Jquery Validation Demo

Please click here for jquery validation demo.

Laravel framework installation in linux(ubuntu)

->First, update the package manager cache by running:     sudo apt-get update -> Download Composer and php5-cli for installing and running for project dependencies as well as curl. it can be installed with the following command:     sudo apt-get install curl php5-cli git -> Install Composer First     cd ~     curl -sS https://getcomposer.org/installer | sudo php         //Composer successfully installed to: /home/sandeep/composer.phar -> Installer Composer Globally     sudo mv composer.phar /usr/local/bin/composer ->Install Laravel     cd /var/www/html     composer create-project laravel/laravel your-project --prefer-dist -> Set up your Apache virtual host     # Copy default Apache conf     sudo cp /etc/apache2/sites-available/000-default /etc/apache2/sites-available/laravel.conf         //if you need to change root then use otherwise its ok     # Edit laravel.conf and change DocumentRoot to /var/www/laravel/public     sudo nano /etc/apache2/sites-available/laravel.c

Yii 1.0 installation in Linux (Ubuntu)

- Copy yii and paste to var/www/html - Open Terminal write command: cd /var/www/html - write command: "php yii_framework/framework/yiic webapp mysite" Now it will work Test: http://localhost/mysite/index.php

Yii 1.0 installation in Window

- Set environment Variable Path php/bin from wamp - Copy yii and paste to wamp/www - make your project folder - Run yiic on the command line as follows:     % YiiRoot/framework/yiic webapp WebRoot/testdrive     YiiRoot:         Put proper path of yii folder path     WebRoot/testdrive:      Give path of project folder     Note: When running yiic on Mac OS, Linux or Unix, you may need to change       the permission of the yiic file so that it is executable. Alternatively,       you may run the tool as follows,         % cd WebRoot         % php YiiRoot/framework/yiic.php webapp testdrive Test:     http://localhost/testdrive/index.php

UniversePay Payment Gateway Integration

/**** Just Create call.php  and put following code ****/ <script   src="https://code.jquery.com/jquery-1.11.0.min.js"   integrity="sha256-spTpc4lvj4dOkKjrGokIrHkJgNA0xMS98Pw9N7ir9oI="   crossorigin="anonymous"></script> <script src="https://api.universepay.eu/static_common/v1/checkout/oplata.js"></script> <script>     var button = $ipsp.get('button');        button.setMerchantId(1396339);        button.setAmount('100', 'USD');     button.setHost('api.universepay.eu');     button.setResponseUrl("http://localhost/universepay/universe_return.php");            location.href=button.getUrl() </script>     <button onclick="location.href=button.getUrl()">Pay</button> /**** **************************************** ****/ /**** Just Create universe_return.php  and put following code ****/   <?php      echo 'Success Part';     ec

How to set start and End date to bootstrap datepicker?

<script>        /*** For the start date***/     var FromStartDate = new Date();     $('#datepicker').datepicker({         startDate: FromStartDate,         autoclose: true     });     /*** For the end date***/     var FromEndDate = new Date();         $('#datepicker').datepicker({         endDate: FromEndDate,         autoclose: true     });     </script>

How to do set order in bootstrap data-table?

/*** Just put this code line where your data are loading ***/     "aaSorting": [[ 0, "desc" ]],

How to get current protocol of current site?

    $isSecure = false;     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {         $isSecure = true;     }elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVE['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {         $isSecure = true;     }     $protocol = $isSecure ? 'https://' : 'http://';     echo $protocol;     /*** Mostly its used setting base url. Like codeigniter's config file for base url         For Ex.: $config['base_url']= $protocol.$_SERVER['HTTP_HOST'].'/site_directory/';     ***/

How to get current protocol of current site?

    $isSecure = false;     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {         $isSecure = true;     }elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVE['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {         $isSecure = true;     }     $protocol = $isSecure ? 'https://' : 'http://';     echo $protocol;     /*** Mostly its used setting base url. Like codeigniter's config file for base url         For Ex.: $config['base_url']= $protocol.$_SERVER['HTTP_HOST'].'/site_directory/';     ***/

Replace morethan one characters or string to given string

/*** IT WILL REPLACE WITH SPACE WHERE GETTING NUMBERS FROM STRING ***/ $patterns = array ('/[0-9]+/'); $replace = array (' '); echo preg_replace($patterns, $replace, '374ethendoe@hotmail.com123');

Reload page when using JSON with success part in special case

/*****  This will reload with current page and tab ****/     window.location.href=window.location.href; /****  This will reload current page only *****/     window.location.reoload();

Set Hyperlink Using Jquery

Just set any default link here: <a href="http://www.google.com" target="_blank">Click Here</a> Now write jquery for setting the dynamic link: $(document).ready(function() { $("a").prop("href", "http://stcodewriter.blogspot.in/"); });

Login with google plus

<html lang="en"> <head> <meta name="google-signin-scope" content="profile email"> <meta name="google-signin-client_id" content="44813260673-o4ubmoa9vg5mm62mumthfulmonnj1198.apps.googleusercontent.com"> <script src="https://apis.google.com/js/platform.js" async defer></script> <meta charset="utf-8"> <script> function onSignIn(googleUser) { // Useful data for your client-side scripts: var profile = googleUser.getBasicProfile(); console.log("ID: " + profile.getId()); // Don't send this directly to your server! console.log('Full Name: ' + profile.getName()); console.log('Given Name: ' + profile.getGivenName()); console.log('Family Name: ' + profile.getFamilyName()); console.log("Image URL: " + profile.getImageUrl()); console.log("Email: &

Scrape the data in PHP

How to Scrape the data form website using CURL? To scrap the data from website, Website must be public and open for scrapable. In the following code, just update the URL to which websites data you want to scrap. <?php $s = curl_init(); curl_setopt($s,CURLOPT_URL,"http://www.domain_name.com/"); curl_setopt($s,CURLOPT_RETURNTRANSFER,1); curl_setopt($s,CURLOPT_HEADER,0); $op = curl_exec($s); curl_close($s); echo $op; ?>

File upload using ajax in php

upload.php   <!DOCTYPE html> <html> <head> <title>Image Upload Form</title> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> function submitForm() { console.log("submit event"); var fd = new FormData(document.getElementById("fileinfo")); fd.append("label", "WEBUPLOAD"); $.ajax({ url: "www.stcodewriter.com/get_upload.php", //put your get file path here type: "POST", data: fd, processData: false, // tell jQuery not to process the data contentType: false // tell jQuery not to set contentType }).done(function( data ) { console.log("Output:"); console.log( data ); }); return false; } </script> </head> <body> &l

Remove .php Using .htaccess File

# Apache Rewrite Rules  <IfModule mod_rewrite.c>   Options +FollowSymLinks   RewriteEngine On   RewriteBase /   # Add trailing slash to url   RewriteCond %{REQUEST_FILENAME} !-f   RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$   RewriteRule ^(.*)$ $1/ [R=301,L] # Remove .php-extension from url   RewriteCond %{REQUEST_FILENAME} !-d   RewriteCond %{REQUEST_FILENAME}\.php -f   RewriteRule ^([^\.]+)/$ $1.php #For error page RewriteCond %{REQUEST_URI} ^/404/$ RewriteRule ^(.*)$ /errors/404.php [L] RewriteCond %{REQUEST_URI} ^/503/$ RewriteRule ^(.*)$ /errors/503.php [L]

How to use AngularJS in PHP?

* Simple Example: /* ******* Start *** *** / "ajdemo.php" <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body> <div ng-app=""> <p>Input something in the input box:</p> <p>Name: <input type="text" ng-model="name"></p> <p ng-bind="name"></p> </div> </body> </html> /***** End *******/ * With Simple html and PHP: /***** Start *******/ "ajForm.html" <!DOCTYPE html> <html ng-app="formExample"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="

How to insert Gujarati or other langauges data to mySQL?

-> First of all create any database then execute below queries: CREATE TABLE `multi_lang` (`data` varchar( 1000 ) CHARACTER SET utf8 COLLATE utf8_bin default NULL); INSERT INTO `multi_lang`VALUES ('ગુજરાતી'); Now see your table data.