Posts

Showing posts from November, 2011

How to Redirect a Web Page

This post describes how to properly redirect a web page using an HTTP 301 status code and Location header. The 301 status code is used to indicate that a page has permanently moved. 301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. PHP redirect tells the browser (or a search engine bot) that the page has been permanently moved to a new location. <?php // Permanent redirection header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.new-domain.com/"); exit(); ?> If you set the Location header by itself, PHP automatically sets the status code to HTTP/1.1 302 Found Note: if you attempt to send headers after content has been sent, you will get a warning like, "Warning: Cannot modify header information - headers already sent by ...". Look for empty lines and spaces between PHP open and close tags. Tip: Use lower-case name for the header function (not Header) to make sure your PHP redirec...

SQL injections

what is SQL Injection? SQL injection is defined as a technique that takes advantage of non-validated input vulnerabilities and inject SQL commands through a web application that are executed in a back-end database. Programmers use sequential SQL command with client supplied parameters making it easier for attackers to inject commands. Attackers can easily execute random SQL queries on the database server through a web application. how does it work? While performing SQL injection, attackers look for pages which allows the submission of data to the backend database, such pages are login page, search page, feedback page, registration page. Attackers use simple test to find vulnearabilities by simply passing single quotation mark in fields. how to retrieve any data? To check for input vulnerabilities, use single quotes. For e.g type in use name text box ' OR 1=1-- this can be used in input box or even in the URL of the web page. If there is a match, it will login without valid username...