Archive for December, 2007

301 redirect in PHP and .htaccess

What is 301 redirect ? You have a website and its all pages are ranked in the search engine. And now you've moved these files to a new domain. What will happen in this scenario!!. You are sending the visitor to "Error 404 - File not found" page when they follow your website in the search engine. Furthermore, if you place the custom error page, then also you will be keep loosing ranking in upcoming days in search engines as the original file could not be found in the old URL. So what is the solution for this?? The solution is 301 redirect which means moved permanently. It is is the most efficient and search engine as well as visitor friendly method for the webpage redirection. Full story
Tags: ,

Getting real IP address in PHP

Are you using $_SERVER to find the the client's IP address in PHP? Well dude, you might be amazed to know that it may not return the true IP address of the client at all time. If your client is connected to the Internet through Proxy Server then $_SERVER in PHP just returns the the IP address of the proxy server not of the client's machine. So here is a simple function in PHP to find the real IP address of the client's machine. There are extra Server variable which might be available to determine the exact IP address of the client's machine in PHP, they are HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR. Full story

Sending e-mail from localhost in PHP in Windows Environment

Have you ever been frustrating, why e-mail is not going from the localhost while using XAMPP or WAMP or any other PHP servers in windows environment? well in that situation i think i can help you.In this article i am going to tell you how to send e-mail from localhost in PHP. Full story

Date or Time Comparison in PHP

If you've to compare the difference between two dates or times values. How you're going to accomplish it in PHP ? If you don't know how to do it, then here is simple fuction for you to compare the date (as well as time) in PHP. For this comparison to take place, the argument supplied to this function must be in a USA and ISO date format. Full story

SQL Injection Attack – Examples and Preventions in PHP

What is SQL injection? It is a basically a trick to inject SQL command or query as a input mainly in the form of the POST or GET method in the web pages. Most of the websites takes parameter from the form and make SQL query to the database. For a example, in a product detail page of php, it basically takes a parameter product_id from a GET method and get the detail from database using SQL query. With SQL injection attack, a intruder can send a crafted SQL query from the URL of the product detail page and that could possibly do lots of damage to the database. And even in worse scenario, it could even drop the database table as well. Full story
Copyright © 2014 Roshan Bhattarai's Blog. All rights reserved.
Powered by WordPress.org, Custom Theme and ComFi.com Calling Card Company.