$TRANS_MSG_ERROR_UNKNOWN = "Error unknown."; $extensions = array('.jpg', '.png', '.txt', '.doc', '.docx', '.xls', '.xlsx', '.msg', '.pdf'); $fileMax = 5000000; //5Mo $config = SimpleObject\OdaConfig::getInstance(); //-------------------------------------------------------------------------- $resources = str_replace("vendor" . DIRECTORY_SEPARATOR . "happykiller" . DIRECTORY_SEPARATOR . "oda" . DIRECTORY_SEPARATOR . "resources" . DIRECTORY_SEPARATOR . "script", $config->resourcesPath, __DIR__); //-------------------------------------------------------------------------- //Build the interface $params = new OdaPrepareInterface(); $ODA_INTERFACE = new OdaLibInterface($params); $folderDest = isset($_GET["path"]) ? $_GET["path"] : ""; $rewhrite = isset($_GET["rewhrite"]) ? filter_var($_GET["rewhrite"], FILTER_VALIDATE_BOOLEAN) : true; $path = $resources . $folderDest; if (is_null($config->resourcesPath)) { $ODA_INTERFACE->dieInError($TRANS_MSG_PATH_UNDEFINED); } if (!file_exists($path)) { $ODA_INTERFACE->dieInError($TRANS_MSG_PATH_NOT_EXIST); } else { foreach ($_FILES as $key => $value) { $extension = strrchr($value['name'], '.'); $extension = strtolower($extension); $taille = filesize($value['tmp_name']); $msg = new stdClass(); $msg->fileNameIn = $value["name"]; if ($key != $value["name"]) { $msg->fileNameOut = $key . $extension; } else { $msg->fileNameOut = $value["name"]; }
use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd; //-------------------------------------------------------------------------- //Build the interface $params = new SimpleObject\OdaPrepareInterface(); $params->arrayInput = array("login", "mdp"); $ODA_INTERFACE = new OdaLibInterface($params); //-------------------------------------------------------------------------- // vendor/happykiller/oda/resources/api/getAuth.php?milis=123450&login=VIS&mdp=VIS //-------------------------------------------------------------------------- $params = new SimpleObject\OdaPrepareReqSql(); $params->sql = "select a.`id_rang`, a.`code_user`, a.`password`, a.`mail`\n from `api_tab_utilisateurs` a\n where 1=1\n and a.`code_user` = :code_user\n;"; $params->bindsValue = ["code_user" => $ODA_INTERFACE->inputs["login"]]; $params->typeSQL = OdaLibBd::SQL_GET_ONE; $retour = $ODA_INTERFACE->BD_ENGINE->reqODASQL($params); if (!$retour->data) { $ODA_INTERFACE->dieInError('Auth impossible.(user unknown)', $ODA_INTERFACE::STATE_ERROR_AUTH); } else { if (OdaLib::startsWith($ODA_INTERFACE->inputs["mdp"], "authByGoogle-")) { $mail = str_replace("authByGoogle-", "", $ODA_INTERFACE->inputs["mdp"]); if ($mail !== $retour->data->mail) { $ODA_INTERFACE->dieInError('Auth impossible.(mail incorrect)', $ODA_INTERFACE::STATE_ERROR_AUTH); } } } $key = $ODA_INTERFACE->buildSession(array('code_user' => $ODA_INTERFACE->inputs["login"], 'password' => $ODA_INTERFACE->inputs["mdp"], 'dbPassword' => $retour->data->password)); $data = new stdClass(); $data->id_rang = $retour->data->id_rang; $data->code_user = $retour->data->code_user; $data->keyAuthODA = $key; $retour->data = $data; //--------------------------------------------------------------------------
namespace Oda; require '../../../../../header.php'; require '../../../../../vendor/autoload.php'; require '../../../../../config/config.php'; use stdClass, Oda\SimpleObject\OdaPrepareInterface, Oda\SimpleObject\OdaPrepareReqSql, Oda\OdaLibBd; //-------------------------------------------------------------------------- //Build the interface $params = new SimpleObject\OdaPrepareInterface(); $params->arrayInput = array("code_user", "mdp", "champs", "value"); $ODA_INTERFACE = new OdaLibInterface($params); //-------------------------------------------------------------------------- // vendor/happykiller/oda/resources/api/setChangeProfile.php?milis=123450&code_user=VIS&mdp=VIS&champs=prenom&value=kikoo //-------------------------------------------------------------------------- $params = new \stdClass(); $params->nameObj = "api_tab_utilisateurs"; $params->keyObj = ["code_user" => $ODA_INTERFACE->inputs["code_user"]]; $retour = $ODA_INTERFACE->BD_ENGINE->getSingleObject($params); if (!password_verify($ODA_INTERFACE->inputs["mdp"], $retour->password)) { $ODA_INTERFACE->dieInError('Mot de passe éronné.'); } else { $params = new \stdClass(); $params->nameObj = "api_tab_utilisateurs"; $params->keyObj = ["code_user" => $ODA_INTERFACE->inputs["code_user"]]; $params->setObj = [$ODA_INTERFACE->inputs["champs"] => $ODA_INTERFACE->inputs["value"]]; $retour = $ODA_INTERFACE->BD_ENGINE->setSingleObj($params); $params = new \stdClass(); $params->label = "resultat"; $params->value = $retour; $ODA_INTERFACE->addDataStr($params); }