Esempio n. 1
0
 //	$result = mysql_query("SELECT * FROM $table WHERE username = '******' AND password = '******'");
 $result = $member->getOneByUsernameAndPassword($username, $password);
 if ($result->num_rows > 0) {
     $row = $result->fetch_array();
     $leadproviderid = $row['leadProviderId'];
     $_SESSION['username'] = htmlspecialchars($apiusername);
     // htmlspecialchars() sanitises XSS
     $session['memberId'] = $row["id"];
     print_r('<code> 0 </code><msg>(Authorized), Authentication Successfull </msg>');
     print_r("</header>");
     /*
     mysql_connect($host, $user, $pass);
     $result_rules = "SELECT rl.PHPLocation, rl.value, rl.FieldName FROM  `member` m LEFT JOIN  `RulesManagementSet` rm ON rm.`memberID` =  `m`.`id` LEFT JOIN  `rules` rl ON  `rl`.`rulesID` =  `rm`.`rulesID` WHERE username =  '******' AND rm.Active = 1";
     $result_rl =  mysql_query($result_rules);
     */
     $result_rl = $rules->getRulesByMemberId($memberId);
     //echo '<sql>';
     //print_r($result_rules);
     //echo '</sql>';
     $rules_Array = array();
     while ($row = $result_rl->fetch_array()) {
         $rules_Array[] = $row;
     }
     $bbcore = new BBCORE($urlstring, $rules_Array);
 } else {
     // Invalid username/password
     print_r('<code> 401 </code><msg>(Not Authorized), Authentication Failed, Failure with 1 or more API Authentication Elements Supplied </msg>');
     print_r("</header>");
     //echo $password;
     //header('Location: http://20ae-fscbb-primary.hgsitebuilder.comindex.php');
 }
Esempio n. 2
0
 $array3 = flatten_array($array, 2, $newarraytest, $last_subarray_found);
 // print_r($array3 );
 //	$apiusername = $_POST["apiusername"];
 //	$apipassword = $_POST["apipassword"];
 //	$apikey      = $_POST["apikey"];
 $apiId = $_POST["apiId"];
 $apiKey = $_POST["apiKey"];
 $apiRef = $_POST["apiRef"];
 $resultLP = $leadProvider->getOneByAPIIdAndKey($apiId, $apiKey);
 if ($resultLP->num_rows == 1) {
     echo '<code> 0 </code><msg>(Authorized), Authentication Successful Post received</msg>';
     $resultMem = $member->getOneByAPIRef($apiRef);
     if ($resultMem->num_rows == 1) {
         echo "Checking vs Ruleset";
         $row = $resultMem->fetch_array();
         $rules_result = $rules->getRulesByMemberId($row['id']);
         $rulesArray = array();
         //			print_r($array3);
         while ($row = $rules_result->fetch_array()) {
             // instead of copying to a new array simply run the rules test now
             $rulesArray[] = call_user_func($row["PHPLocation"], $row["value"], strtoupper($row["FieldName"]), $array3);
             //$rules_Array[] = $row;
         }
         //$bbcore = new BBCORE($array3, $rules_Array, $dbDataArr);
     } else {
         echo "Error in Ruleset";
     }
 } else {
     // fail
     $bolUnAuth = true;
 }