Skip to main content

Posts

Login with LinkedIn using PHP

Linkedin is one of the most popular social networks with the huge user base. Like the Facebook , Twitter and Google authentication, LinkedIn also is used for the user authentication in the website. If you want to allow your website’s user to login with the social account, LinkedIn login needs to be added. LinkedIn provides various API to integrate user login system in the website. Using LinkedIn API you can let the user login to your website with their LinkedIn account. In this tutorial, we will show you how to integrate user Login System with LinkedIn using PHP . The login with LinkedIn feature helps the user to sign into your website with their LinkedIn account without registration on your website. Our LinkedIn login API tutorial provides you an easy way to build user login system with LinkedIn using PHP and store the user profile data into the MySQL database. We’ll use OAuth library to connect with LinkedIn and build LinkedIn login system in PHP . Before you get started to int

CodeIgniter Redirect to Current Page URL After Logout ?

In CodeIgniter you can get current page URL using CodeIgniter URL helper function current_url() . Now you knew how to get current page url, then append the current page url to logout url, here is the code echo anchor('auth/logout','logout/'.base64_encode(current_url())); now in your logout method should be something like this : public function logout($url){ redirect(base64_decode($url)); } I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

How to Export Data to CSV File using PHP and MySQL

CSV (comma-separated values) is the most popular file format to store tabular data in plain text. Generally, CSV file is used to import and export data for moving tabular data between programs. Import and export data is the most used feature in the web application, and CSV file format is a best chose for that. In the earlier tutorial, we have shown How to Import CSV File Data into MySQL Database using PHP . In this tutorial, we will show you how to export data from MySQL database to CSV file using PHP . Also, you will learn to create CSV file in PHP and download and save MySQL data in CSV file using PHP. To demonstrate Export to CSV functionality, we will build an example script which will export members data from the MySQL database and save in a CSV file using PHP. Create Table in MySQL Database The following SQL creates a members table with some basic fields in MySQL database. The members table holds the member’s information which needs to be exported. CREATE TABLE `memb

PHP : detect location of the user

Using the below function you can check the city from which the user is visiting your website. function detect_city($ip) { $default = 'UNKNOWN'; $curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)'; $url = 'http://ipinfodb.com/ip_locator.php?ip=' . urlencode($ip); $ch = curl_init(); $curl_opt = array( CURLOPT_FOLLOWLOCATION => 1, CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT => $curlopt_useragent, CURLOPT_URL => $url, CURLOPT_TIMEOUT => 1, CURLOPT_REFERER => 'http://' . $_SERVER['HTTP_HOST'], ); curl_setopt_array($ch, $curl_opt); $content = curl_exec($ch); if (!is_null($curl_info)) { $curl_info = curl_getinfo($ch); } curl_close($ch); if ( preg_match('{<li>City : ([^<]*)</li>}i', $content, $regs) ) { $city = $regs[1]; } if ( preg_match('{<li>State/Provinc

Better Broken Image Handling

Missing images will either just display nothing, or display a [ ? ] style box when their source cannot be found. Instead, you may want to replace that with a "missing image" graphic that you are sure exists so there is better visual feedback that something is wrong. Or, you might want to hide it entirely. This is possible because images that a browser can't find fire off an "error" JavaScript event we can watch for. // Replace source $('img').on("error", function() { $(this).attr('src', '/images/missing.png'); }); // Or, hide them $("img").on("error", function() { $(this).hide(); }); Additionally, you may wish to trigger some kind of Ajax action to send an email to a site admin when this occurs.

Transparent Clothing Effect Photoshop Tutorial [ YouTube Embed Responsibly Example ]

Create secure login script in PHP

Recently more than 10 members asked me how to create secure login script in PHP. So in this article am going to explain you how to create a secure login system using PHP and MYSQL. This type of login system am using in most of the website, if you are using any CMS means no need of this system because CMS have inbuilt login system. In this method am mainly concentrating on the username and password strings. Am using number of steps to clear the string and prevent the any type of SQL injection to avoid the hacking. First we will start the session and connecting to the database. FInd the PHP code below, //Start session session_start(); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select

SMS Gateway Integration in PHP

These days SMS feature is used for the various purpose in the web application. For example user authentication, OTP verification, sending the notification to users. To send SMS from PHP script you need to select a best SMS gateway provider that suitable for your requirement. Once the SMS gateway and plan selection are completed, now it’s time to integrate SMS gateway in PHP script. In this tutorial, we will show you how to integrate SMS gateway API in PHP . SMS gateway integration process is very simple and less time required. Using our example code you can easily send SMS from your website using SMS gateway API and PHP . Usually, the SMS provider provides 3 types of plan, One-way messages, Two-way messages, and Both-ways messages. One-way messaging allow you to send SMS to the customers, but Two-way messaging allow not only the send SMS but also receive a reply from the customer. Generally, SMS gateway provides a callback URL for passing some parameters, like API Key, send

Laravel Tutorial – CRUD (Create Read Update Delete) Operations in Laravel

In our previous Laravel 5 tutorial, we have learned how to install and configure Laravel application on Windows or Ubuntu . Now you’ll learn the most used functionality in this third part of the Laravel tutorial. In this tutorial, we’ll create a simple CRUD application with Laravel 5 . Our step-by-step guide for beginners helps you to implement CRUD (Create, Read, Update, and Delete) Operations in Laravel . If you haven’t installed the Laravel application on your server, go through the Laravel installation and configuration tutorial first . Here we’ll provide the advanced functionality (fetch, add, edit, and delete) implementation guide in Laravel. For your better understanding, we’ll create an example blog post management application with Laravel 5 . CRUD Operations in Laravel 5 To demonstrate view, add, edit, and delete functionality, we’ll show the post management system in Laravel 5. This sample Laravel CRUD application has the following functionality. Retrieve posts dat

Fetch Meta Data from URL using PHP and Ajax

In this tutorial am going to explain how to get meta data from an URL to display in website. It’s similar to URL data extracting. You can see this example most of social networking sites like Facebook and Google Plus. It also called as Extracting data from URL using Jquery, Ajax and PHP. I have used get_meta_tags PHP function to get the Meta data from URL. This is a PHP in built function. The output will be returned in array. $url=get_meta_tags("http://www.webinfopedia.com/"); This will give you an array of all Meta data like Description, Keyword, Author, Copyright, Robot etc… Now you need to display it like below. echo ($url["description"]); echo substr($url["keywords"], 0, 128); echo ($url["copyright"]); To get the title tag form URL am using file_get_contents function. echo get(file_get_contents('http://www.webinfopedia.com/'), ""); //get function function get($a,$b,$c)