本文整理汇总了PHP中ouverture函数的典型用法代码示例。如果您正苦于以下问题:PHP ouverture函数的具体用法?PHP ouverture怎么用?PHP ouverture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ouverture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
function get($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// recherche du championnat en cours
$querySaisonEnCours = "SELECT phpl_gr_championnats.id\r\n\t\t\t\t\t\t\t\tFROM phpl_gr_championnats \r\n\t\t\t\t\t\t\t\tWHERE phpl_gr_championnats.activ_prono = '1' \r\n\t\t\t\t\t\t\t\tORDER by id desc";
$resultat = mysql_query($querySaisonEnCours) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$idSaisonEnCours = $row[0];
// évolution sur la dernière journée
$queryEvolution = "SELECT graph.type, graph.classement as place, graph.fin\r\n \t\t\t\t\t\t FROM phpl_membres membre\r\n\t\t\t\t JOIN phpl_pronos_graph graph ON graph.id_membre = membre.id_prono\r\n\t\t\t\t \t\t\t\t\t\t AND graph.id_gr_champ = '{$idSaisonEnCours}'\r\n\t\t\t\t \t\t\t\t\t\t AND graph.type in ('general', 'hourra', 'mixte')\r\n\t\t\t\t WHERE membre.pseudo = '{$user}'\t\t \t\t\t\t\t\t \t \r\n\t\t\t\t\t\t\t ORDER BY graph.type, graph.fin";
$resultat = mysql_query($queryEvolution) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($resultat)) {
$typeChamp = $row["type"];
$numPlace = $row['place'];
$numJournee = $row['fin'];
array_push($data, array("type" => $typeChamp, "place" => $numPlace, "jour" => $numJournee));
}
// Retour du tableau au format JSON
$response->body = json_encode(array("profilEvolution" => $data));
return $response;
}
示例2: get
function get($request, $debut, $limit)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
if ($debut == null) {
$debut = 0;
}
if ($limit == null) {
$limit = 10;
}
// requete pour récupérer tous les gazouillis
$requete = "SELECT id_membre, pseudo, contenu, date_creation \n\t\t\tFROM phpl_gazouillis, phpl_membres \n\t\t\tWHERE phpl_gazouillis.id_membre=phpl_membres.id\n\t\t\tORDER BY date_creation DESC\n\t\t\tLIMIT " . $debut . "," . $limit . "";
$resultat = mysql_query($requete);
while ($row = mysql_fetch_array($resultat)) {
$url_avatar = "http://" . $_SERVER['SERVER_NAME'] . "/suopronos/prono/images/avatars/" . $row["id_membre"] . ".gif";
if (!remote_file_exists($url_avatar)) {
$url_avatar = "http://" . $_SERVER['SERVER_NAME'] . "/suopronos/prono/images/avatars/no_avatar.png";
}
array_push($data, array("id_membre" => $row["id_membre"], "pseudo" => $row["pseudo"], "url_avatar" => $url_avatar, "contenu" => utf8_encode($row["contenu"]), "date" => $row["date_creation"]));
}
$response->body = json_encode(array("gazouillis" => $data));
return $response;
}
示例3: get
function get($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// recherche de l'id de l'utilisateur
$queryUser = "SELECT id_prono FROM phpl_membres WHERE pseudo='{$user}'";
$resultat = mysql_query($queryUser);
$row = mysql_fetch_array($resultat);
$idUser = $row[0];
// Saison en cours de l'utilisateur + palmarès de l'utilisateur
$queryPalmares = "SELECT classement.id_champ, classement.place, classement.type, \r\n\t\t\t\t\t\t\t\tcase when groupes.activ_prono = '0' then groupes.nom else 'Saison en cours' end as nom\r\n\t\t\t\t\t\t\tFROM phpl_clmnt_pronos classement\r\n\t\t\t\t\t\t\tJOIN phpl_gr_championnats groupes ON groupes.id = classement.id_champ\r\n\t\t\t\t\t\t\tWHERE classement.id_membre = {$idUser}\r\n\t\t\t\t\t\t\t\tAND classement.type IN ('general', 'hourra', 'mixte')\r\n\t\t\t\t\t\t\tORDER BY classement.id_champ DESC, classement.type ASC";
$resultat = mysql_query($queryPalmares) or die("probleme " . mysql_error());
// Remplissage du tableau avec le palmarès de l'utilisateur
while ($row = mysql_fetch_array($resultat)) {
$numPlace = $row["place"];
$typeChamp = $row["type"];
$nomSaison = $row["nom"];
array_push($data, array("nomSaison" => $nomSaison, "typeChamp" => $typeChamp, "numPlace" => $numPlace));
}
// Retour du tableau au format JSON
$response->body = json_encode(array("palmares" => $data));
return $response;
}
示例4: post
function post($request)
{
ouverture();
$response = new Response($request);
if (!$this->isSecured()) {
$response->body = "401";
return $response;
}
$contenu = file_get_contents('php://input');
if (empty($contenu)) {
$response->body = "500:NO_DATA";
return $response;
} else {
if (strlen($contenu) > 140) {
$response->body = "le message fait plus de 140 caractères";
return $response;
}
}
$user_pseudo = $_SERVER['PHP_AUTH_USER'];
$requete = "SELECT pseudo, id_prono FROM phpl_membres WHERE pseudo='{$user_pseudo}'";
$result = mysql_query($requete);
$row = mysql_fetch_array($result);
$user_id = $row[1];
$contenu = addslashes($contenu);
mysql_query("INSERT INTO phpl_gazouillis (id_membre, contenu, reponse_a) VALUES ('{$user_id}','{$contenu}',null)") or die("probleme " . mysql_error());
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
return $response;
}
示例5: get
function get($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// recherche du championnat en cours
$querySaisonEnCours = "SELECT phpl_gr_championnats.id\r\n\t\t\t\t\t\t\t\tFROM phpl_gr_championnats \r\n\t\t\t\t\t\t\t\tWHERE phpl_gr_championnats.activ_prono = '1' \r\n\t\t\t\t\t\t\t\tORDER by id desc";
$resultat = mysql_query($querySaisonEnCours) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$idSaisonEnCours = $row[0];
// recherche de l'id de la dernière journée
$queryDerniereJournee = "SELECT max(evolutionGraph.fin)\r\n\t\t\t\t\t\t\t\tFROM phpl_pronos_graph evolutionGraph\r\n\t\t\t\t\t\t\t\tWHERE evolutionGraph.id_gr_champ = '{$idSaisonEnCours}'";
$resultat = mysql_query($queryDerniereJournee);
$row = mysql_fetch_array($resultat);
$idDerniereJournee = $row[0];
// évolution sur la dernière journée
$queryEvolution = "SELECT P2.type, P2.classement as place, (P2.points - P1.points) as points, (P1.classement - P2.classement) as evolution\r\n \t\t\t\t\t\t FROM phpl_membres membre\r\n\t\t\t\t JOIN phpl_pronos_graph P1 ON P1.id_membre = membre.id_prono\r\n\t\t\t\t \t\t\t\t\t\t AND P1.id_gr_champ = '{$idSaisonEnCours}'\r\n\t\t\t\t \t\t\t\t\t\t AND P1.type in ('general', 'hourra', 'mixte')\r\n\t\t\t\t\t\t\t \t\t\t\t\t\t AND P1.fin = '" . ($idDerniereJournee - 1) . "'\t\t \t\t\t\t\t\t \r\n\t\t\t\t JOIN phpl_pronos_graph P2 ON P2.id_membre = P1.id_membre\r\n\t\t\t\t \t\t\t\t\t\t AND P2.id_gr_champ = P1.id_gr_champ\r\n\t\t\t\t \t\t\t\t\t\t AND P2.type = P1.type\r\n\t\t\t\t \t\t\t\t\t\t AND P2.fin = '{$idDerniereJournee}'\r\n\t\t\t\t WHERE pseudo = '{$user}'\t\t \t\t\t\t\t\t \t \r\n\t\t\t\t\t\t\t ORDER BY P2.type";
$resultat = mysql_query($queryEvolution) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($resultat)) {
$typeChamp = $row["type"];
$numPlace = $row['place'];
$nbPoints = $row['points'];
$numEvolution = $row["evolution"];
array_push($data, array("type" => $typeChamp, "place" => $numPlace, "points" => $nbPoints, "evolution" => $numEvolution));
}
// Retour du tableau au format JSON
$response->body = json_encode(array("profilStat" => $data));
return $response;
}
示例6: get
function get($request, $idMatch)
{
$response = new Response($request);
ouverture();
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
if (isset($_GET['paramProno'])) {
$paramProno = $_GET['paramProno'];
} else {
$paramProno = "";
}
$requete = "SELECT max(id) FROM phpl_championnats";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ = $row[0];
// Recherche du nombre de points max
$requete = "SELECT pts_prono_exact FROM phpl_gr_championnats WHERE id_champ = '{$gr_champ}'";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$points_prono_exact = $row[0];
// si il y des pronos automatiques à faire sur ce match, on calcule les cotes
//On compte le nombre de parieurs sur le match
$requete = "SELECT COUNT(*) FROM phpl_pronostics WHERE id_match = '{$idMatch}'";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$nb_parieurs_total = $row[0];
// Retour au format JSON
for ($i = 0; $i < 3; $i++) {
switch ($i) {
case 0:
$type_prono = "1";
break;
case 1:
$type_prono = "N";
break;
case 2:
$type_prono = "2";
break;
}
if ($paramProno != "") {
$type_prono = $paramProno;
$i = 3;
}
//On compte le nombre de parieurs sur une victoire de l'equipe à l'exterieur
$requete = "SELECT COUNT(*) FROM phpl_pronostics WHERE id_match = '{$idMatch}' AND pronostic = '{$type_prono}'";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$nb_parieurs = $row[0];
if ($nb_parieurs == "0") {
$points_prono = "0";
} else {
$points_prono = floor($points_prono_exact * $nb_parieurs_total / $nb_parieurs);
}
array_push($data, array("type" => $type_prono, "cote" => $points_prono));
}
$response->body = json_encode(array("coteMatch" => $data));
return $response;
}
示例7: get
function get($request, $username, $password)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
ouverture();
if (VerifSession($username, $password) == "1") {
$response->body = json_encode(array("compte" => "ok"));
} else {
$response->body = json_encode(array("compte" => "ko"));
}
return $response;
}
示例8: get
function get($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// récupération du type de liste
if (isset($_GET['type'])) {
$type = $_GET['type'];
} else {
$type = "1";
}
if ($type == "1") {
// Liste des amis triés par pseudo
$queryClassementAmis = "SELECT classement.pseudo, classement.type, classement.place, classement.points\r\n\t\t\t\tFROM phpl_membres membre\r\n\t\t\t\tJOIN phpl_clmnt_filtre filtre ON filtre.id = membre.id_prono\r\n\t\t\t\tJOIN phpl_clmnt_pronos classement ON classement.id_membre = filtre.idMembre\r\n\t\t\t\tJOIN phpl_gr_championnats groupes ON groupes.id = classement.id_champ\r\n\t\t\t\t\t\t\t\t\t\t\t\t AND groupes.activ_prono = '1'\r\n\t\t\t\tWHERE membre.pseudo = '{$user}' AND membre.actif = '1'\r\n\t\t\t\t AND classement.type IN ('general', 'hourra', 'mixte')\r\n\t\t\t\tORDER BY classement.pseudo ASC, classement.type ASC";
$resultat = mysql_query($queryClassementAmis) or die("probleme " . mysql_error());
// Remplissage du tableau avec le palmarès de l'utilisateur
while ($row = mysql_fetch_array($resultat)) {
$numPlace = $row["place"];
$typeChamp = $row["type"];
$pseudoAmi = $row["pseudo"];
$nbPoints = $row["points"];
array_push($data, array("pseudo" => $pseudoAmi, "type" => $typeChamp, "place" => $numPlace, "point" => $nbPoints));
}
} else {
// utilisateur postant la requête
$requete = "SELECT id_prono FROM phpl_membres WHERE pseudo = '{$user}'";
$result = mysql_query($requete);
$row = mysql_fetch_array($result);
$user_id = $row[0];
// Liste des utilisateurs non amis
$queryListeUtilisateur = "SELECT membre.pseudo, membre.nom, membre.prenom, ifnull(filtre.idMembre, 0) as ami\r\n\t\t\t\tFROM phpl_membres membre\r\n\t\t\t\tLEFT JOIN phpl_clmnt_filtre filtre ON filtre.idMembre = membre.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t AND filtre.id = '{$user_id}'\r\n\t\t\t\tWHERE membre.actif = '1'\r\n\t\t\t\tORDER BY membre.pseudo";
$resultat = mysql_query($queryListeUtilisateur) or die("probleme " . mysql_error());
// Remplissage du tableau avec le palmarès de l'utilisateur
while ($row = mysql_fetch_array($resultat)) {
$pseudo = $row["pseudo"];
$nom = utf8_encode($row["nom"]);
$prenom = utf8_encode($row["prenom"]);
if ($row["ami"] == 0) {
$ami = '0';
} else {
$ami = '1';
}
array_push($data, array("pseudo" => $pseudo, "nom" => $nom, "prenom" => $prenom, "ami" => $ami));
}
}
// Retour du tableau au format JSON
$response->body = json_encode(array("listeAmis" => $data));
return $response;
}
示例9: get
function get($request, $typeChamp)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// récupération du nombre d'utilisateur en retour par top/flop/classement
if (isset($_GET['nbUser'])) {
$nbUser = $_GET['nbUser'];
} else {
$nbUser = 3;
}
// récupération du type d'évolution
if (isset($_GET['typeEvol'])) {
$typeEvol = $_GET['typeEvol'];
} else {
$typeEvol = "0";
}
// recherche du championnat en cours
$querySaisonEnCours = "SELECT phpl_gr_championnats.id\r\n\t\t\t\t\t\t\t\tFROM phpl_gr_championnats \r\n\t\t\t\t\t\t\t\tWHERE phpl_gr_championnats.activ_prono = '1' \r\n\t\t\t\t\t\t\t\tORDER by id desc";
$resultat = mysql_query($querySaisonEnCours) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$idSaisonEnCours = $row[0];
// recherche de l'id de la dernière journée
$queryDerniereJournee = "SELECT max(evolutionGraph.fin)\r\n\t\t\t\t\t\t\t\tFROM phpl_pronos_graph evolutionGraph\r\n\t\t\t\t\t\t\t\tWHERE evolutionGraph.id_gr_champ = '{$idSaisonEnCours}'";
$resultat = mysql_query($queryDerniereJournee);
$row = mysql_fetch_array($resultat);
$idDerniereJournee = $row[0];
$queryEvolution = "SELECT P1.type, (P1.classement - P2.classement) as evolution, membre.pseudo\r\n\t\t\t\t\t\t\t FROM phpl_membres membre\r\n\t\t\t\t JOIN phpl_pronos_graph P1 ON P1.id_membre = membre.id_prono\r\n\t\t\t\t \t\t\t\t\t\t AND P1.id_gr_champ = '{$idSaisonEnCours}'\r\n\t\t\t\t \t\t\t\t\t\t AND P1.type = '{$typeChamp}'\r\n\t\t\t\t\t\t\t \t\t\t\t\t\t AND P1.fin = '" . ($idDerniereJournee - 1) . "'\t\t \t\t\t\t\t\t \r\n\t\t\t\t JOIN phpl_pronos_graph P2 ON P2.id_membre = P1.id_membre\r\n\t\t\t\t \t\t\t\t\t\t AND P2.id_gr_champ = P1.id_gr_champ\r\n\t\t\t\t \t\t\t\t\t\t AND P2.type = P1.type\r\n\t\t\t\t \t\t\t\t\t\t AND P2.fin = '{$idDerniereJournee}'\r\n\t\t\t\t WHERE membre.actif = '1'";
if ($typeEvol == "0") {
$queryEvolution = $queryEvolution . " ORDER BY P1.type, evolution DESC, P2.participations DESC, membre.pseudo\r\n\t\t\t\t\t\t\t\t\t\t\t\t LIMIT 0, {$nbUser}";
} else {
$queryEvolution = $queryEvolution . " ORDER BY P1.type, evolution ASC, P2.participations DESC, membre.pseudo\r\n\t\t\t\t\t\t\t\t\t\t\t\t LIMIT 0, {$nbUser}";
}
$resultat = mysql_query($queryEvolution) or die("probleme " . mysql_error());
// Remplissage du tableau avec les tops / flops
while ($row = mysql_fetch_array($resultat)) {
$typeChamp = $row["type"];
$nomPseudo = $row["pseudo"];
$numEvolution = $row["evolution"];
array_push($data, array("type" => $typeChamp, "evol" => $numEvolution, "pseudo" => $nomPseudo));
}
// Retour du tableau au format JSON
$response->body = json_encode(array("topFlop" => $data));
return $response;
}
示例10: get
function get($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
// récupération du filtre
if (isset($_GET['filtre'])) {
$filtre = $_GET['filtre'];
} else {
$filtre = "0";
}
// recherche du championnat en cours
$querySaisonEnCours = "SELECT phpl_gr_championnats.id\r\n\t\t\t\t\t\t\t\tFROM phpl_gr_championnats \r\n\t\t\t\t\t\t\t\tWHERE phpl_gr_championnats.activ_prono = '1' \r\n\t\t\t\t\t\t\t\tORDER by id desc";
$resultat = mysql_query($querySaisonEnCours) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$idSaisonEnCours = $row[0];
// recherche de l'id de la dernière journée
$queryDerniereJournee = "SELECT max(evolutionGraph.fin)\r\n\t\t\t\t\t\t\t\tFROM phpl_pronos_graph evolutionGraph\r\n\t\t\t\t\t\t\t\tWHERE evolutionGraph.id_gr_champ = '{$idSaisonEnCours}'";
$resultat = mysql_query($queryDerniereJournee);
$row = mysql_fetch_array($resultat);
$idDerniereJournee = $row[0];
// Liste des tops / flops de tous les utilisateurs
if ($filtre == "0") {
$queryEvolution = "SELECT P1.type, (P1.classement - P2.classement) as evolution, membre.pseudo\r\n\t\t\t\t\t\t\t\t FROM phpl_membres membre\r\n\t\t\t\t\t JOIN phpl_pronos_graph P1 ON P1.id_membre = membre.id_prono\r\n\t\t\t\t\t \t\t\t\t\t\t AND P1.id_gr_champ = '{$idSaisonEnCours}'\r\n\t\t\t\t\t \t\t\t\t\t\t AND P1.type in ('general', 'hourra', 'mixte')\r\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t AND P1.fin = '" . ($idDerniereJournee - 1) . "'\t\t \t\t\t\t\t\t \r\n\t\t\t\t\t JOIN phpl_pronos_graph P2 ON P2.id_membre = P1.id_membre\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.id_gr_champ = P1.id_gr_champ\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.type = P1.type\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.fin = '{$idDerniereJournee}'\r\n\t\t\t\t\t WHERE membre.actif = '1'\t\t \t\t\t\t\t\t \t \r\n\t\t\t\t\t\t\t\t ORDER BY P1.type, evolution DESC, P2.participations DESC, membre.pseudo";
} else {
// utilisateur postant la requête
$requete = "SELECT id_prono FROM phpl_membres WHERE pseudo = '{$user}'";
$result = mysql_query($requete);
$row = mysql_fetch_array($result);
$user_id = $row[0];
$queryEvolution = "SELECT P1.type, (P1.classement - P2.classement) as evolution, membre.pseudo\r\n\t \t\t\t\t\t\t FROM phpl_clmnt_filtre filtre\r\n\t \t\t\t\t\t\t JOIN phpl_membres membre ON membre.id_prono = filtre.idMembre\r\n\t \t\t\t\t\t\t \t\t\t\t\t\t AND membre.actif = '1'\r\n\t\t\t\t\t JOIN phpl_pronos_graph P1 ON P1.id_membre = filtre.idMembre\r\n\t\t\t\t\t \t\t\t\t\t\t AND P1.id_gr_champ = '{$idSaisonEnCours}'\r\n\t\t\t\t\t \t\t\t\t\t\t AND P1.type in ('general', 'hourra', 'mixte')\r\n\t\t\t\t\t\t\t\t \t\t\t\t\t\t AND P1.fin = '" . ($idDerniereJournee - 1) . "'\t\t \t\t\t\t\t\t \r\n\t\t\t\t\t JOIN phpl_pronos_graph P2 ON P2.id_membre = P1.id_membre\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.id_gr_champ = P1.id_gr_champ\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.type = P1.type\r\n\t\t\t\t\t \t\t\t\t\t\t AND P2.fin = '{$idDerniereJournee}'\r\n\t\t\t\t\t WHERE filtre.id = '{$user_id}'\t\t \t\t\t\t\t\t \t \r\n\t\t\t\t\t\t\t\t ORDER BY membre.pseudo, P1.type";
}
$resultat = mysql_query($queryEvolution) or die("probleme " . mysql_error());
// Remplissage du tableau avec les tops / flops
while ($row = mysql_fetch_array($resultat)) {
$typeChamp = $row["type"];
$nomPseudo = $row["pseudo"];
$numEvolution = $row["evolution"];
array_push($data, array("type" => $typeChamp, "evol" => $numEvolution, "pseudo" => $nomPseudo));
}
// Retour du tableau au format JSON
$response->body = json_encode(array("evolutionClassement" => $data));
return $response;
}
示例11: get
function get($request, $club)
{
$response = new Response($request);
ouverture();
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
$requete = "SELECT phpl_gr_championnats.id_champ FROM phpl_gr_championnats WHERE phpl_gr_championnats.activ_prono='1' ORDER by id desc";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ = $row[0];
$query = "SELECT numJour.numero, rencontre.date_reelle, rencontre.buts_dom, rencontre.buts_ext, \n\t \t\t\t\tCase When cldom.nom = '{$club}' then cldom.nom_court else cldom.nom end as clubDom, \n\t \t\t\t\tCase When clext.nom = '{$club}' then clext.nom_court else clext.nom end as clubExt,\n\t \t\t\t\tCase When cldom.nom = '{$club}' then 'D' else 'E' end as type\n\t \t\t\tFROM phpl_journees as numJour\n\t\t\t JOIN phpl_matchs as rencontre ON rencontre.id_journee = numJour.id\n\t\t\t JOIN phpl_equipes as dom ON dom.id = rencontre.id_equipe_dom\n\t\t\t JOIN phpl_equipes as ext ON ext.id = rencontre.id_equipe_ext\n\t\t\t JOIN phpl_clubs as cldom ON cldom.id = dom.id_club\n\t\t\t JOIN phpl_clubs as clext ON clext.id = ext.id_club\n\t\t\t WHERE numJour.id_champ = '{$gr_champ}'\n\t\t\t \tAND (cldom.nom = '{$club}' OR clext.nom = '{$club}')\n\t\t\t ORDER BY numJour.numero";
$result = mysql_query($query) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($result)) {
array_push($data, array("numJour" => $row["numero"], "date" => $row["date_reelle"], "butDom" => $row["buts_dom"], "butExt" => $row["buts_ext"], "clubDom" => $row["clubDom"], "clubExt" => $row["clubExt"], "type" => $row["type"]));
}
$response->body = json_encode(array("calendrierClub" => $data));
return $response;
}
示例12: get
function get($request, $club)
{
$response = new Response($request);
ouverture();
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
$requete = "SELECT phpl_gr_championnats.id_champ FROM phpl_gr_championnats WHERE phpl_gr_championnats.activ_prono='1' ORDER by id desc";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ = $row[0];
$query = "SELECT evol.fin, evol.classement\n\t \t\t\tFROM phpl_clubs club \n\t \t\t\tJOIN phpl_equipes equipe On equipe.id_club = club.id\n\t \t\t\t And equipe.id_champ = '{$gr_champ}' \n\t \t\t\tJOIN phpl_clmnt_graph evol On evol.id_equipe = equipe.id\n\t\t\t WHERE club.nom = '{$club}' \n\t\t\t ORDER BY evol.fin";
$result = mysql_query($query) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($result)) {
array_push($data, array("jour" => $row["fin"], "place" => $row["classement"]));
}
$response->body = json_encode(array("evolutionClassementL1" => $data));
return $response;
}
示例13: get
function get($request)
{
$response = new Response($request);
ouverture();
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
$requete = "SELECT max(id) FROM phpl_championnats";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ = $row[0];
$query = "SELECT classement.nom, points, joues, g, n, p, butspour, butscontre, diff, club.url_logo \n \t\t\tFROM phpl_clmnt_cache classement\n \t\t\tJOIN phpl_clubs club ON club.nom = classement.nom\n\t \t\tWHERE ID_CHAMP='{$gr_champ}' \n\t \t\tORDER BY POINTS DESC, DIFF DESC, BUTSPOUR DESC , BUTSCONTRE ASC, classement.NOM";
$result = mysql_query($query) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($result)) {
array_push($data, array("club" => $row["nom"], "points" => $row["points"], "joues" => $row["joues"], "g" => $row["g"], "n" => $row["n"], "p" => $row["p"], "butspour" => $row["butspour"], "butscontre" => $row["butscontre"], "diff" => $row["diff"], "url_logo" => "http://" . $_SERVER['SERVER_NAME'] . "/suopronos/prono/images/clubs/" . rawurlencode($row["url_logo"])));
}
$response->body = json_encode(array("classementL1" => $data));
return $response;
}
示例14: get
function get($request, $type)
{
$response = new Response($request);
ouverture();
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
if (isset($_GET['filtre'])) {
$filtre = $_GET['filtre'];
if ($filtre == "1") {
if (!$this->isSecured()) {
$response->body = "401";
return $response;
} else {
$user = $_SERVER['PHP_AUTH_USER'];
}
} else {
$filtre = "0";
}
} else {
$filtre = "0";
}
$requete = "SELECT phpl_gr_championnats.id FROM phpl_gr_championnats WHERE phpl_gr_championnats.activ_prono='1' ORDER by id desc";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ = $row[0];
$requete = "SELECT phpl_gr_championnats.id \n\t \t\t\tFROM phpl_gr_championnats \n\t \t\t\tWHERE phpl_gr_championnats.activ_prono='0' \n\t \t\t\tORDER by id desc";
$resultat = mysql_query($requete) or die("probleme " . mysql_error());
$row = mysql_fetch_array($resultat);
$gr_champ_prec = $row[0];
if ($filtre == "0") {
$query = "SELECT classement.pseudo, classement.points, classement.participation as champion, \n\t\t \t\t\t\t classement.place, ifNull(classementPrec.place, 0) as placePrec\n\t\t \t\t FROM phpl_membres membre \n\t\t \t\t JOIN phpl_clmnt_pronos classement ON classement.id_membre = membre.id_prono\n\t\t \t\t \t\t\t\t\t\t\t\t AND classement.id_champ = '{$gr_champ}'\n\t\t \t\t \t\t\t\t\t\t\t\t AND classement.type = '{$type}'\n\t\t \t\t LEFT JOIN phpl_clmnt_pronos classementPrec ON classementPrec.id_membre = membre.id_prono\n\t\t \t\t \t\t\t\t\t\t\t\t AND classementPrec.id_champ = '{$gr_champ_prec}'\n\t\t \t\t \t\t\t\t\t\t\t\t AND classementPrec.type = '{$type}'\n\t\t \t\t WHERE membre.actif = '1' \n\t\t \t\t ORDER by classement.points desc, classement.participation asc, classement.pseudo";
} else {
$query = "SELECT classement.pseudo, classement.points, classement.participation as champion,\n\t \t\t\t\t\t classement.place, ifNull(classementPrec.place, 0) as placePrec\n\t \t\t\t FROM phpl_membres membre\n\t \t\t\t JOIN phpl_clmnt_filtre filtre ON filtre.id = membre.id_prono\n\t \t\t\t JOIN phpl_clmnt_pronos classement ON classement.id_champ = '{$gr_champ}' \n\t \t\t\t \t\t\t\t\t\t\t\t AND classement.type = '{$type}' \n\t \t\t\t\t \t\t\t\t\t\t\t AND classement.id_membre = filtre.idMembre\n\t\t \t\t LEFT JOIN phpl_clmnt_pronos classementPrec ON classementPrec.id_membre = filtre.idMembre\n\t\t \t\t \t\t\t\t\t\t\t\t AND classementPrec.id_champ = '{$gr_champ_prec}'\n\t\t \t\t \t\t\t\t\t\t\t\t AND classementPrec.type = '{$type}'\n\t \t\t\t WHERE membre.pseudo = '{$user}' AND membre.actif = '1'\n\t \t\t\t ORDER by classement.points desc, classement.participation asc, classement.pseudo";
}
$result = mysql_query($query) or die("probleme " . mysql_error());
while ($row = mysql_fetch_array($result)) {
array_push($data, array("place" => $row["place"], "placePrec" => $row["placePrec"], pseudo => $row["pseudo"], "points" => $row["points"]));
}
$response->body = json_encode(array("classement" => $data));
return $response;
}
示例15: post
function post($request, $user)
{
$response = new Response($request);
$response->code = Response::OK;
$response->addHeader('content-type', 'text/plain');
$data = array();
ouverture();
if (!$this->isSecured($user)) {
$response->body = "401";
return $response;
}
// On vérifie s'il y a des matchs en cours pour savoir si on autrosie la mise à jour de la strategie
$requete = "SELECT phpl_matchs.id, phpl_matchs.date_reelle, TIMEDIFF( phpl_matchs.date_reelle, NOW( ) ) , TIME_TO_SEC( TIMEDIFF( phpl_matchs.date_reelle, NOW( ) ) )\n\t\t\tFROM phpl_matchs, phpl_journees, phpl_gr_championnats\n\t\t\tWHERE phpl_gr_championnats.id = {$gr_champ}\n\t\t\tAND phpl_journees.id_champ = phpl_gr_championnats.id_champ\n\t\t\tAND phpl_matchs.id_journee = phpl_journees.id\n\t\t\tAND phpl_matchs.buts_dom IS NULL\n\t\t\tAND phpl_matchs.buts_ext IS NULL\n\t\t\tAND TIME_TO_SEC( TIMEDIFF( phpl_matchs.date_reelle, NOW( ) ) ) < 0";
$resultat = mysql_query($requete);
if ($row = mysql_fetch_array($resultat)) {
$response->body = "La mise à jour de votre stratégie n'est pas autorisée quand des match sont en cours";
return $response;
}
// récupération de la nouvelle stratégie
$strategie = file_get_contents('php://input');
if (empty($strategie)) {
$response->body = "500:NO_DATA";
return $response;
}
$user_pseudo = $_SERVER['PHP_AUTH_USER'];
$requete = "SELECT pseudo, id_prono FROM phpl_membres WHERE pseudo='{$user_pseudo}'";
$result = mysql_query($requete);
$row = mysql_fetch_array($result);
$user_id = $row[1];
// mise à jour de la stratégie
$requete = "SELECT * FROM phpl_strategie WHERE id_membre='{$user_id}'";
$resultat = mysql_query($requete);
if ($row = mysql_fetch_array($resultat)) {
$strQuery = "UPDATE phpl_strategie SET id_type={$strategie}, priorite=0 WHERE id_membre='{$user_id}'";
mysql_query($strQuery) or die("probleme " . mysql_error());
} else {
$strQuery = "INSERT INTO phpl_strategie (id_membre, id_type, priorite) VALUES ({$user_id}, {$strategie}, 0)";
mysql_query($strQuery) or die("probleme " . mysql_error());
}
return $response;
}