Skip to main content

Posts

Showing posts from March, 2019

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