Blogroll

Saturday, October 29, 2011

Detect ajax request php

I have one script use for both ajax and normal request.
This code can help you detect ajax request to coding.

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  /* special ajax here */
 
}
Friday, October 14, 2011

Auto refresh page with header meta

Meta refresh is a legacy method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML meta element with the http-equiv parameter set to "refresh" and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in thecontent parameter. By setting the refresh time interval to zero (or a very low value), this allows meta refresh to be used as a method of URL redirection.
Wednesday, October 12, 2011

Embbed pdf for your website without flash

Today, i found the way to embbed pdf  in my webiste and i found many solution.
But the best way use google reader.

Monday, October 10, 2011

Save buffer output in Php

We all know that PHP is default sending all output to the standard output buffer( the browser in many cases if I can say like that.) That depends off course about your server configurations but that’s how it gets setup into the standard. There is a buffer size set in php.ini; when the output buffer is full, it is automatically flushed and sent to the browser. Many times in our programming life we wanted to change this standard way and send the contents to a variable instead of printing to the browser .
Thursday, October 6, 2011

Create unique Id sercure with hash

have many algorithm to generate to unique Id but almost is popular and the result only containt number
This function allow you to unique Id containt leter and number.
More it provide hash to sercure your unique Id.

Dropdown for IE6

Almost modern browser support dropdown menu easy only with css code.
But IE6 not support hover CSS. So this solution will be solved.

Download safe file without error

When you use header function to download to client. Sometime happend error because file is interupt. It cause by many reason: browser, your function and here is the code to solved this problem.
Tuesday, October 4, 2011

Cắt bỏ tiếng việt trong php

Việc cắt bỏ tiếng việt thực sự cần thiết khi chúng ta tìm kiếm thứ gì đó.
Sau đây là đoạn code để thực hiện điều đó.

Hàm chuyển chuỗi có dấu (Unicode) thành không dấu


Bài này mình viết hàm chuyển một chuỗi ký tự có dấu (Unicode), chuyển thành chuỗi không dấu