Access denied

Résolu/Fermé
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 - Modifié le 24 août 2021 à 23:44
barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 - 25 août 2021 à 00:07
Bonjour,

J'ai un problème quand j'envoie mon formulaire (via curl), j'obtiens une erreur Access denied. alors que tout fonctionnait bien depuis ce midi.

Voilà mon code :
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

date_default_timezone_set('Europe/Paris');

function random_1($car) {
    $string = "";
    $chaine = "abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    srand((double)microtime()*1000000);
    for($i=0; $i<$car; $i++) {
    $string .= $chaine[rand()%strlen($chaine)];
    }
    return $string;
    }

//
// on traite la variable email
//
$email = $_POST['email'];

if(empty($email))
{
   header("Location: index.php");
   exit;
}

if(strlen($email) < 6 OR strlen($email) > 60)
{
   header("Location: index.php");
   exit;
}

//
// on traite la variable password
//
$password = $_POST['password'];

if(empty($password))
{
   header("Location: index.php");
   exit;
}

if(strlen($password) < 8 OR strlen($password) > 64)
{
   header("Location: index.php");
   exit;
}

//
//
//
$account_id = substr(password_hash($email . $password, PASSWORD_BCRYPT), -40);
$hash_pass = password_hash($password, PASSWORD_BCRYPT);

//
// on traite la variable first_name
//
$first_name = $_POST['firstname'];

if(empty($first_name) OR strlen($first_name) > 30);
{
   $first_name = NULL;
}

//
// on traite la variable last_name
//
$last_name = $_POST['lastname'];

if(empty($last_name) OR strlen($last_name) > 30);
{
   $last_name = NULL;
}

//
// on génère une clé pour l'api
//
$api_id = random_1(40);

//
// on récupère la date du jour
//
$creation_date = date('Ymd');

//
// on se connecte à la base de données
//
try{
 require_once 'sqlconnect.php';

 $sql = 'INSERT INTO accounts (first_name,last_name,email,password,account_id,creation_date,enabled,api_id) VALUES (:prenom, :nom, :mail, :motdepasse, :compte, :creation, :actif, :api)';
 $req = $bdd ->prepare($sql);
 $req ->execute(array(
  ':prenom' => $first_name,
  ':nom' => $last_name,
  ':mail' => $email,
  ':motdepasse' => $hash_pass,
  ':compte' => $account_id,
  ':creation' => $creation_date,
  ':actif' => 1,
  ':api' => $api_id));
 echo "Entrée ajoutée dans la table";
 $req ->closecursor();
}

catch(PDOException $e){
 echo "Erreur : " . $e->getMessage();
}

?>


Je n'arrive pas à mettre le doigt sur mon erreur, merci pour votre aide.


Configuration: Linux / Firefox 91.0


2 réponses

barnabe0057 Messages postés 14440 Date d'inscription lundi 2 mars 2009 Statut Contributeur Dernière intervention 19 avril 2024 4 909
24 août 2021 à 23:53
Apparemment c'est nginx qui me jette :

HTTP/1.1 403 Forbidden
../..
Access denied.


Bizarre car je n'ai absolument pas touché à mon vhost depuis hier soir.
0