예제 #1
0
파일: aaa.php 프로젝트: ram-1501/rs
         $r = $api->login($_POST['email'], $_POST['password']);
         if ($r->returnCode == "SUCCESS") {
             $_SESSION['AUTH_STATUS'] = true;
             $_SESSION['user_name'] = trim(str_replace(" ", "", $_POST['email']));
             $_SESSION['user_pass'] = $_POST['password'];
             $_SESSION['version'] = VERSION;
             $_SESSION['internal'] = false;
             if ($r->settings->licenseType == 'Individual' || $r->settings->licenseType == 'Basic' || $r->settings->licenseType == 'Premier') {
                 $paymentConfig = $api->getUserPaymentConfig($_SESSION['user_name'], SERVER_IDENTIFIER);
                 if ($paymentConfig != null) {
                     $paymentId = $paymentConfig->paymentId;
                     try {
                         $subscription = Recurly_Subscription::get($paymentId);
                         if ($subscription->state != 'active') {
                             //$api->updateUserPaymentConfig ( SERVER_IDENTIFIER, $r->settings->licenseType, $_SESSION ['user_name'], $subscription->state );
                             $api->updateUserPaymentConfig(SERVER_IDENTIFIER, 'Free', $_SESSION['user_name'], $subscription->state);
                             $api->setUserLicense($_SESSION['user_name'], SERVER_IDENTIFIER);
                             $r->settings->licenseType = 'Free';
                         }
                     } catch (Exception $e) {
                     }
                 }
             }
             setcookie("first_login", "true");
         }
     }
     $resp = array();
     $resp["code"] = (string) $r->returnCode;
     $resp["description"] = (string) $r->description;
     echo json_encode($resp);
 }