yms/validate.php
changeset 10 351d40b21cbc
parent 0 9997bee9ad03
equal deleted inserted replaced
9:d58bafde2a92 10:351d40b21cbc
    13   }
    13   }
    14   
    14   
    15   if ( !isset($_GET['otp']) )
    15   if ( !isset($_GET['otp']) )
    16   {
    16   {
    17     yms_send_reply('MISSING_PARAMETER', '', array('info' => 'otp'));
    17     yms_send_reply('MISSING_PARAMETER', '', array('info' => 'otp'));
       
    18   }
       
    19 
       
    20   $nonce = null;
       
    21   if ( isset($_GET['nonce']) )
       
    22   {
       
    23     $nonce = $_GET['nonce'];
    18   }
    24   }
    19   
    25   
    20   // first, get API key so we can properly sign responses
    26   // first, get API key so we can properly sign responses
    21   $id = intval($_GET['id']);
    27   $id = intval($_GET['id']);
    22   $q = $db->sql_query("SELECT apikey FROM " . table_prefix . "yms_clients WHERE id = $id;");
    28   $q = $db->sql_query("SELECT apikey FROM " . table_prefix . "yms_clients WHERE id = $id;");
    40     }
    46     }
    41   }
    47   }
    42   
    48   
    43   $GLOBALS['g_api_key'] =& $g_api_key;
    49   $GLOBALS['g_api_key'] =& $g_api_key;
    44   
    50   
    45   yms_send_reply(yms_validate_otp($_GET['otp'], $id));
    51   yms_send_reply(yms_validate_otp($_GET['otp'], $id), '', array('nonce' => $nonce, 'otp' => $_GET['otp']));
    46 }
    52 }
    47 
    53