Log in

View Full Version : What is the code format of Robot.txt? Can someone explained?



sumu
11-12-2010, 04:27 PM
Dear Sir/Madam,

I'm a newbie in this interactive web designing and developing platform. I need the code of Robot.txt file's to indexing my website pages in the search engines except a single secret page.

Let me clarify you the details; I've a website with 6 pages. I want that the 5 pages would scrawl in the search engines except the last one for the security of my documents.

Also, is there any kind of codes to banning a user to accessing that restricted page more than once?

I would be greatful if someone help me to provide. Eagerly waiting for the helpful answer.

Thank you....................

Regards,
Sumu

Nile
11-12-2010, 09:41 PM
To hide a specific page from all robots that could be lurking around your pages, do:


User-agent: *
Disallow: html/file.html

Change the highlighted to the hidden file.

When you say you want to ban them from seeing the file again after one time, it's hard to do. You can try two things that I can think of - I would do both. You could try storing the IPs in a database and then getting information from a database to see if a user has already viewed the page. The first things you have to think about is whether you want to use a file database or a sql database. I would suggest a sql database if you can get one. The following code will be for a file database.


<?php
function find($file, $ip){
$test = strrpos($file, $ip);
$exception = array('11.11.111.111');
if($test !== false && !in_array($ip, $exception)){
die("$ip is banned.");
} else if (!in_array($ip, $exception)){
file_put_contents('banned.txt', $_SERVER['REMOTE_ADDR']);
}
}
find(file_get_contents('banned.txt'), $_SERVER['REMOTE_ADDR']);
?>

The second suggestion is using cookies.