I couldn't figure out why google wasn't indexing my site...then...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • camperjohn64
    Confirmed User
    • Feb 2005
    • 1531

    #1

    I couldn't figure out why google wasn't indexing my site...then...

    So I checked and double checked my code and found that I had some code that checked for a cookie to show adult content. This was supposed to check if the browser was Google and let Google see everything even if the "over 18 button" was not clicked.

    But the code had a bug, and was refusing to show Google any HTML at all since the Google crawler had not clicked on the "over 18 button" and set the cookie. My override code, to check if Google was coming had a bug.

    My heart sank when I saw this. Months of Google crawling and never indexing wasted.
    www.gimmiegirlproductions.com
  • TheStout
    Confirmed User
    • Jul 2007
    • 2089

    #2
    What was the code and how did it get there?

    Comment

    • pussyserver - BANNED FOR LIFE
      So Fucking Banned
      • Oct 2005
      • 5133

      #3
      Originally posted by camperjohn64
      So I checked and double checked my code and found that I had some code that checked for a cookie to show adult content. This was supposed to check if the browser was Google and let Google see everything even if the "over 18 button" was not clicked.

      But the code had a bug, and was refusing to show Google any HTML at all since the Google crawler had not clicked on the "over 18 button" and set the cookie. My override code, to check if Google was coming had a bug.

      My heart sank when I saw this. Months of Google crawling and never indexing wasted.
      Can you please post the exact code that caused the error thanks

      Comment

      • camperjohn64
        Confirmed User
        • Feb 2005
        • 1531

        #4
        I put it there!

        Code:
        // If its a crawler looking for content
        $agentlist = array("Web Indexer","crawlerinfo","TurnitinBot","Mediapartners-Google","Googlebot","genieBot","YahooYSMcm","picsearch","[email protected]","Slurp",
        				               "Yahoo!","Sidewinder","Scooter","InfoSeek","Ultraseek","vscooter","Gulliver","Crawler",
        				               "Baiduspider","RealWebCrawler","Gigabot","Ask Jeeves","Dead Link Checker","msnbot",
        				               "Robot","knowledge agent","ArchitextSpider","Offline Explorer");
        
        if (in_array ($_SERVER['HTTP_USER_AGENT'],$agentlist))
        {
            // When Google crawls, Google gets everything
            $a = USER_CATEGORY_SFW | USER_CATEGORY_STRAIGHT | USER_CATEGORY_GAY; 
        } 
        
        if (cookie_set('ov18'))
        {
            // If the user has previously clicked the over 18 button, show him everything
            $a = USER_CATEGORY_SFW | USER_CATEGORY_STRAIGHT | USER_CATEGORY_GAY;
        }
        else
        {
            // Show users mainstream content as they may be at work
            $a = USER_CATEGORY_SFW;
        }
        Do you see the bug?

        Code:
        if (in_array ($_SERVER['HTTP_USER_AGENT'],$agentlist))
        {
        } 
        
        if (cookie_set('ov18'))
        {
        }
        else
        {
        }
        
        // Here is the correct code, with the correct else statement
        
        if (in_array ($_SERVER['HTTP_USER_AGENT'],$agentlist))
        {
        } 
        // !!!!!!!!!!!!!
        else if (cookie_set('ov18'))
        {
        }
        else
        {
        }
        I don't need the bug fixed, I was just so disappointed when I saw it!! The second set of if/else was overrriding anything to do with the browser check.
        Last edited by camperjohn64; 10-17-2008, 09:44 AM.
        www.gimmiegirlproductions.com

        Comment

        Working...