From a687d8efe6bf12c8f0264e32da34dace7af2cd32 Mon Sep 17 00:00:00 2001
From: zolij <zolij86@gmail.com>
Date: Wed, 8 Jan 2014 11:39:02 +0100
Subject: [PATCH] fixing variable names

---
 php/AuthSCHClient.class.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/php/AuthSCHClient.class.php b/php/AuthSCHClient.class.php
index 8c86bd0..b80aa68 100644
--- a/php/AuthSCHClient.class.php
+++ b/php/AuthSCHClient.class.php
@@ -37,7 +37,7 @@ class AuthSCHClient {
         curl_setopt($ch, CURLOPT_URL, self::$host . $urlPart);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         if($urlPart != "oauth2/resource")
-            curl_setopt($curl, CURLOPT_USERPWD, self::$username . ":" . self::$password);
+            curl_setopt($ch, CURLOPT_USERPWD, self::$username . ":" . self::$password);
         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
@@ -62,10 +62,11 @@ class AuthSCHClient {
             );
             
             $ch = $this->curlExec("oauth2/resource", $data);
+            $res = json_decode($ch);
             
             // check api access & redirect to auth.sch.bme.hu for authorization
             if ($res != null && isset($res->success) && $res->success == true)
-                header("Location: " . self::$host . "site/login?response_type=code&client_id&". self::$username ."&state=" . sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']) . "&scope=" . self::$scope);
+                header("Location: " . self::$host . "site/login?response_type=code&client_id=". self::$username ."&state=" . sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']) . "&scope=" . self::$scope);
             else
                 throw new Exception("error during api check");
         } else {
-- 
GitLab