Results 1 to 2 of 2

Thread: What is the code format of Robot.txt? Can someone explained?

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question What is the code format of Robot.txt? Can someone explained?

    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

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    To hide a specific page from all robots that could be lurking around your pages, do:
    Code:
    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.
    Code:
    <?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.
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    sumu (11-13-2010)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •