Download Facebook PHP SDK from here. Extract the folder src in the zip file to a folder named fbsdk in the home directory of your app. Installation There is no installation. You can run the functions in the file if you put this line at top of each file you run the SDK functions : include(‘fbsdk/facebook.php’); Facebook SDK requires the following to work properly : JSON PHP extension. CURL PHP extension. ... [READ MORE]
Posts marked with "PHP" in categories
The best age calculation code in PHP
Age calculation is a tricky calculation especially in Programming Languages. I’m going to tell you a simple way to find out age in PHP. This is a simple function that will calculate age if it is given a birthday date in the format date/month/year. For example : 20/01/2000 or 04/12/1990 Here is the function : function age($birthday){ list($day,$month,$year) = explode("/",$birthday); $year_diff = date("Y") – $year; $month_diff = date("m") – $month; $day_diff = date("... [READ MORE]
SPAM URL’s in Blogger Traffic Source Stats : What should I do ?
You might have noticed a great volume of sites you never heard of coming to your site apart from Search Engine URL’s. Some of those URL’s are filmhill.com and vampirestat.com. These kind of URL‘s are SPAM. The SPAM site is referring your site but they are not persons, they’re BOTS. These bots are visiting your site just for fun. These bots don’t read your posts or anything. They’re just a pile of robots.... [READ MORE]
Login with Google OAuth without using Google PHP Library
Google PHP Library is very hard to use and is very long. It wasted a lot of my time. So I decided to do it manually. I created a new library for Google OAuth in PHP. Download Demo It is very simple to use and you don’t have to worry about a thing. FAQ How to get a client Id and Client Secret ? 1) Go to https://code.google.com/apis/console and create a new project.... [READ MORE]
How to display errors in a PHP file ?
When you code PHP some errors might have happened. But you won’t know that and the program don’t work. You can use PHP‘s error_reporting function to display errors. Here’s how to do it: Create a file named errors.php in the folder where the file with errors exist. Open the errors.php file in text editor and paste these codes in the file: error_reporting(E_ALL); ini_set("display_errors", 1); include("filename.php"); ?> Replace filename.php with the name of the file that has errors.... [READ MORE]
How to make sure that a CSS file will load on your site using PHP
This is a simple trick. Most of the web developers worry that the Stylesheet file will not load completely. This happens if your CSS file’s size is too large. The fail in complete loading of the file mostly happens to users who are using slower connections like me. The page will look disgusting if the CSS file don’t load. To avoid the file not getting loaded you can do this simple trick using PHP.... [READ MORE]
What is SQL Injection and how to make your PHP site free from SQL Injection hacking
SQL Injection (SQLi) is a very dangerous thing that a hacker can do to your site. This happens mostly in SQL queries. Let me make you understand this in a simple way. Suppose you’re SQL query code is this: $user=$_GET[‘user’]; $sql=mysql_query("SELECT * FROM users WHERE user='".$user."‘"); It’s a normal code. BUT it is a very easy method for hacker to easily destroy your database. The user ID is getting from a GET request. If the file’s name (where the request is going) is user.... [READ MORE]
Get Google Profile Picture URL by email id using PHP
This is a trick using Google Profile. First of all we are going to set a variable with a Google E-mail address (Gmail address). We are going to set it with my E-mail address $email=’[email protected]’; Then we are going to split @ from the mail address. list($id, $domain) = split("@",$email); Next we are going to send a request to Google Profiles to fetch the IMAGE url. $headers = get_headers("https://profiles.google.com/s2/photos/profile/".$id, 1); The variable $id above is from the splitted part.... [READ MORE]
My Short URL – a site for shortening URL’s
My Short URL is my latest invention. A site for shortening URL’s like goo.gl and bit.ly. <div> You can short URL’s on the site <a href="http://msurl.tk/" style="font-weight: bold;">MSURL.TK</a>. </div> <div> </div> As other projects the site is also hosted by AppFog and the free domain is given by My.Dot.TK. The project was created under 30 minutes and the lines of code is less that 64. It’s written in PHP as you already know it. The shortened URL only has 13 characters (without HTTP://).... [READ MORE]
Subins Games : A new Game site from Subins
This is my 5th project. The Subins Games. This site is for playing games. Functions Commenting Score saving Play History Add your game Game stats (And adding new ones!) Like all the other projects this project has used Javascript Library Jquery and the server side language is PHP. This site’s games is the combination of old PFOGB and G2E. The main problem I faced was the merging of two blogs to one. It was very difficult to merge manually.... [READ MORE]