Archive for the PHP Category

How to get rank using mysql query

Posted by mahmud ahsan Filed Under MySQL, PHP with 4 Comments

mysql Some days ago I was working in a quiz project. Where user will play quiz and for each correct answer they will earn points. One of the task of this quiz application was, to get rank of a particular user. Now I am showing how could I solve this problem using mysql query.

Here is the table structure:

CREATE  TABLE IF NOT EXISTS `quiz_user` (
`uid` BIGINT UNSIGNED NOT NULL ,
`participated` SMALLINT UNSIGNED NULL DEFAULT 0 ,
`correct` SMALLINT UNSIGNED NULL DEFAULT 0 ,
`wrong` SMALLINT UNSIGNED NULL DEFAULT 0 ,
`created` DATETIME NULL ,
`updated` DATETIME NULL ,
PRIMARY KEY (`uid`) )
ENGINE = InnoDB

Continue

How to use amazon s3 using php

Posted by mahmud ahsan Filed Under Framework, PHP with No Comments

amazons3Amazon Simple Storage Service is designed to make web-scale computing easier for developers. If you have a medium to high traffic web application then S3 will help you to load your content faster. Here contents may be files, photos, videos or even text. Normally S3 is used for files, photos and videos. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites.

3 months ago I developed a project for one of my client using Zend Framework. 1 week ago he told me to change the photo uploading system from hosting disk to amazon s3. Yesterday I implemented s3 for him and found its really very easy using Zend framework.

Here I’m describing how did I do so:

Continue

Develop dynamic flash widget using PHP & ActionScript 3.0

Posted by mahmud ahsan Filed Under ActionScript, Facebook, PHP with 2 Comments

flash_php_fb
Basically I’m mainly php base web application developer. But I have  much interest in ActionScript project. Sometimes when I get opportunity I work on it. Someday ago, I was assigned in a project, where I’ve to develop a Flash Widget using ActionScript 3.0 and php. This widget will be use mainly for facebook page.

So shortly the project requirements are:

  1. Develop a dynamic flash widget using ActionScript 3.0
  2. Communication between ActionScript and PHP API
  3. This widget should be working on any facebook page

To develop this project I’ve learned a new library called amfphp. Using this library its much easier and practical to communicate between ActionScript and php. In this article, I’ll show how to use amfphp and develop a dynamic flash widget.

Continue

Obfuscate your email in webpage

Posted by mahmud ahsan Filed Under PHP with No Comments

If you have blog or website where you placed your email address, you may notice that there might be many spam emails send to your email address. This is because spammer scour the web to harvest email addresses. So to prevent this problem you can use obfuscated email address. Here I am showing a simple hack to solve this problem.

<?php
     $link = 'mailto:' . 'awoman@gmail.com';
     $coded = "";
     for ($i=0; $i<strlen($link); $i++){
         $coded .= "&#" . ord($link[$i]) . ";";
     }
?>

<a href="<?=$coded?>">Email Awoman</a>

In browser normal user will show simple html link like: Email Awoman but if you see the view source you ‘ll see

<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#97;&#119;&#111;&#109;&#97;&#110;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">Email Awoman</a>

The code is very simple. Using email address, create a mailto link and then loop though the characters by replacing each character with ASCII equivalent.

Publish facebook page status or wall post automatically

Posted by mahmud ahsan Filed Under Facebook, PHP with 8 Comments

fb_logoFacebook page is now very popular. Many companies and people create facebook page for their own publicity. Suppose your company has 100 products and they want to maintain 100 facebook pages, then isn’t it very difficult to update status all of the pages manually?

In this article, I’ll show and discuss about 2 facebook api, using that you can easily update your facebook page status or publish wall post on that page automatically

I assume that you know how to set cron from hosting admin panel, I also assume that you have intermediate knowledge of facebook application development and their api usage.

fb_page

Continue

YouTube Search functionality in facebook app

Posted by mahmud ahsan Filed Under Facebook, Facebook connect, PHP with 1 Comment

fb_logoSomeday ago I had to add youtube video search functionality in a facebook app. Here I described how I added youtube search functionality in that facebook app using Zend_Gdata php library.

Here is a screenshot of that facebook application, where I added YouTube video search functionality.

search_youtube_video

Continue

Develop auto post publishing twitter app

Posted by mahmud ahsan Filed Under PHP, Twitter with 5 Comments

twitterTwitter is a free social networking and micro-blogging service that enables its users to send and read messages known as tweets. Though according to CEO of Twitter he says “We think of Twitter as it’s not a social network, it is an information network. It tells people what they care about as it is happening in the world.”  Though first people personally use twitter for their own purpose, but now twitter is very popular in business world. Many companies are using twitter to promote their business, inform people about their products, services.

In this article, I’ll show how you could develop a basic twitter application using php and twitter api, that will auto publish your predefined tweets. Continue

Send facebook notification after invitation request

Posted by mahmud ahsan Filed Under Facebook, PHP with 9 Comments

fb_logo Sometimes people ask me how to send notification in facebook app after invitation request processed.

This is a very easy solutions. You just need to carefully look the api request and return value. Then you can easily integrate the solution

Here I’m describing what is invitation, what is request and how to send notification after invitation/request successfully processed. Continue

Develop customize facebook application for fan page

Posted by mahmud ahsan Filed Under Facebook, PHP with 22 Comments

facebook_platformFor many companies or individual, facebook fan page is an integral part of their social media campaign. They want to build up a large follower in their fan page.
Why?

Because, a company want to inform large number of people about their products. An individual want to make large network. As facebook fan page is a part of facebook, so building a large network is quite easy, but for this you have to make your fan page more dynamic, engaging.

In this article I’ll show you how to develop customize facebook application for fan page, that will be more dynamic and interesting for your fans! Continue

iframe based photo/file uploader

Posted by mahmud ahsan Filed Under Facebook, Java Script, PHP with 5 Comments

iframesuppose your client tell you to create a form where he needs file/photo uploader that will work instantly when you will select file/photo.

recently i’ve faced same type of situation for one of facebook app and here is the solution i developed for my purpose.

part_of_form_1

Continue

Page 1 of 41234»