<?php //******************************************************************** // phpaie //------------------------------------------------------------------ // Version: 0.1 // // Copyright (c) 2002 by Jean-Charles Gibier (~Le Mulot Fou~) // (http://www.phpaie.net) // (webmaster@machinbidule.com) // // Support éventuel sur www.phpaie.net //********************************************************************* // This program is free software. You can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation. //********************************************************************* //Initialisation de la session [INIT_PAGE] require_once "CONNECTION_def.php"; require_once "../inc/session_libre.php"; //Récupération des variables des méthodes POST et GET $pg_CONNECTION = new CONNECTION(isset($_POST) && array_count_values($_POST) ? $_POST : $_GET); //Récupération des variables pour le formulaire $vars = $pg_CONNECTION->getValidVars(); //INIT_PAGE enregistrement //Lead enregistrement code ($ld_enrg_code) //Trail code ($tr_code) // Affichage de la présentation // paramètre: action à effectuer si validation $pg_CONNECTION->pageDisplay("");
<?php require_once "Auth/Auth.php"; require_once "../inc/cnx_param.php"; function myOutput($username, $status) { include "authlogin.php"; } $params = array('table' => 'INSCRIPTION', 'usernamecol' => 'INSCRIPTION_PSEUDO_CKEY_VCH', 'passwordcol' => 'INSCRIPTION_PASSWORD_VCH', 'dsn' => $dsn, 'cryptType' => 'none'); $a = new Auth("DB", $params, "myOutput"); $a->logout(); $a->start(); if ($a->getAuth()) { //recupère les paramètres $vars = isset($_POST) && array_count_values($_POST) ? $_POST : $_GET; //serialize_session($id, $SID); require_once "CONNECTION_def.php"; // les champs 'username' et 'password' doivent être remplis $id = MAIN_CLASS::fetchOne("INSCRIPTION", "ID_INSCRIPTION", "where INSCRIPTION_PSEUDO_CKEY_VCH = '" . $vars['username'] . "' AND INSCRIPTION_PASSWORD_VCH = '" . $vars['password'] . "'", ""); // On note la connexion et la correspondance id <-> sid CONNECTION::staticInsertDbVars(array('ID_INSCRIPTION' => $id, 'CONNECTION_SID_CKEY_VCH' => $PHPSESSID, 'CONNECTION_HOUR_DATE' => date("y-m-d", time()))); // Go away header("Location: {$domaine}/{$fpath}/Desk/desk.php" . (isset($PHPSESSID) ? "?" . session_name() . "=" . session_id() : "")); exit; } //obliger la reconnexion a chaque test ?>
$book->deleteFromDB($conn); } function handlePUT(mysqli $conn) { parse_str(file_get_contents("php://input"), $data); $book = new Book(); $book->update($conn, $data['id']); $book->setTitle($data['title']); $book->setAuthor($data['author']); $book->setDesc($data['desc']); } $methodType = $_SERVER['REQUEST_METHOD']; $conn = Connection::startConnection(); switch ($methodType) { case "GET": handleGET($conn); break; case "POST": handlePOST($conn); break; case "DELETE": handleDELETE($conn); break; case "PUT": handlePUT($conn); break; default: die("nie obslugujemy"); } CONNECTION::stopConnection($conn);
function staticInsertDbVars($pvars) { MAIN_CLASS::insertDbVars("CONNECTION", $pvars, CONNECTION::getInitInputs()); }