<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
include "includes/db.php";
require_once "Objects/FunctionClass.php";
//$json = json_decode($_GET['data']);
$username = $_POST['username'];
$password = $_POST['password'];
try {
    $DBH->query('BEGIN');
    $functionObject = new FunctionClass('./');
    $user_id = $functionObject->getIdMembre($username, $password);
    $quantite_au_compte = $functionObject->getQuantiteFromMember($user_id);
    $activated = $functionObject->getActivatedMember($user_id);
    echo json_encode(array("resultat" => "true", "data" => array('quantite' => $quantite_au_compte, 'activated' => $activated)));
} catch (PDOException $e) {
    $DBH->query('ROLLBACK');
    echo json_encode(array("resultat" => "false", "data" => $e->getMessage() . " erreur-2"));
}
Beispiel #2
0
     //print_r($row);
     $temp_journal = array();
     $temp_journal['id'] = $row['id'];
     $temp_journal['id_journal'] = $row['id_journal'];
     $temp_journal['nom'] = $row['nom'];
     $temp_journal['type'] = $row['type'];
     $temp_journal['categorie'] = $row['categorie'];
     $temp_journal['id_journal'] = $row['id_journal'];
     $temp_journal['datePublication'] = $row['datePublication'];
     $temp_journal['downloadPath'] = $row['downloadPath'];
     $temp_journal['coverPath'] = $row['imagePath'];
     $temp_journal['prix'] = $row['quantite'];
     $temp_journal['isSubscription'] = $row['until'] ? 1 : 0;
     $temp_journal['telechargementRestant'] = $functionObject->getNbTelechargementIssueForAchat($member_id, $row['id']);
     if ($username != "" && $password != "") {
         $temp_journal['activatedAccount'] = $functionObject->getActivatedMember($member_id);
     } else {
         $temp_journal['activatedAccount'] = 1;
     }
     /*
     $bought_id = $functionObject->getBoughtIssueMembre($member_id, $row['id']);
     if($bought_id != NULL) {
     	$temp_journal['bought'] = 1;
     }
     else {
     	$temp_journal['bought'] = verifProductForAbonnement($row, $abonnementArray);
     }
     */
     $json = $temp_journal;
     ++$x;
 }