WordPress.org

Plugin Directory

Changeset 533652


Ignore:
Timestamp:
04/19/12 17:32:06 (2 years ago)
Author:
dimadin
Message:

Cleanup gravatar-check.php.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gravatar-signup-encouragement/trunk/gravatar-check.php

    r303019 r533652  
    55*/ 
    66 
    7 /* 
    8 * Load e-mail address sent via POST 
    9 */ 
     7/* Load e-mail address sent via POST */ 
    108$gravatar_email = $_POST['gravmail']; 
    119 
    12 /* 
    13 * If there is no POST, return 403 error 
    14 */ 
    15 if (!$gravatar_email) { 
    16     header('Status: 403 Forbidden'); 
    17     header('HTTP/1.1 403 Forbidden'); 
    18     exit(); 
    19 } 
     10/* If there is no POST, return 403 error */ 
     11if ( ! $gravatar_email ) exit; 
    2012 
    2113/* 
    22 * Check if gravatar exists: 
    23 * 1) load gravatar 2) get it's headers 3) chech if status is 200 4) if isn't, return "no" 
    24 * Based on work from florinel2k at yahoo dot com (  http://php.net/file_exists#75720 ) and worldclimb at gmail dot com (  http://php.net/file_exists#76545 ) 
    25 */ 
    26 $fileUrl = "http://www.gravatar.com/avatar/".md5( strtolower($gravatar_email) )."?s=2&d=404"; 
    27 $AgetHeaders = @get_headers($fileUrl); 
    28 if (!preg_match("|200|", $AgetHeaders[0])) { 
     14 * Check if gravatar exists: 
     15 *  1) load gravatar 
     16 *  2) get it's headers 
     17 *  3) chech if status is 200 
     18 *  4) if isn't, return "no" 
     19 * Based on work from florinel2k at yahoo dot com (  http://php.net/file_exists#75720 ) 
     20 * and worldclimb at gmail dot com (  http://php.net/file_exists#76545 ) 
     21 */ 
     22$fileUrl = "http://www.gravatar.com/avatar/" . md5( strtolower( $gravatar_email ) ) . "?s=2&d=404"; 
     23$AgetHeaders = @get_headers( $fileUrl ); 
     24if ( ! preg_match( "|200|", $AgetHeaders[0] ) ) { 
    2925    echo 'no'; 
    3026} 
Note: See TracChangeset for help on using the changeset viewer.