Access denied for user 'epiz_31263592'@'192.168.0.64' (using password: YES)

http://aurele-et-hugo-font-vos-courses.great-site.net/contact.php)
I have read the awnser but i have the bug again

Access denied for user ‘epiz_31263592’@‘192.168.0.64’ (using password: YES)

I need help
Thanks

Welcome!

Can you please share the code you are using? Be sure to hide that password!

1 Like

Check your credentials…


<?php

	/*************************
	*  Page: espace-membre.php
	*  Page encodée en UTF-8
	**************************/


//on se connecte une fois pour toutes les actions possible de cette page:
$mysqli=mysqli_connect('sql308.epizy.com','epiz_31263592','*****','epiz_31263592_listecourse');//'serveur','nom d'utilisateur','pass','nom de la table'
if(!$mysqli) {
	die("Erreur connection BDD: " . mysqli_connect_error());
	//Dans ce script, je pars du principe que les erreurs ne sont pas affichées sur le site, vous pouvez donc voir qu'elle erreur est survenue avec mysqli_error(), pour cela décommentez la ligne suivante:
	//echo "<br>Erreur retournée: ".mysqli_error($mysqli);
	exit(0);
}

// ------------------------- Do not modify code under this field -------------------------- //


function sanitize($variable){
	$clean_variable = strip_tags($variable);
	$clean_variable = htmlentities($clean_variable, ENT_QUOTES, 'UTF-8');
	return $clean_variable;
}

function connect_to_mysqli($mysqlserverhost, $username_mysql, $password_mysql, $database_name){
	$connect = mysqli_connect($mysqlserverhost, $username_mysql, $password_mysql, $database_name);
	if (!$connect) {
		  die("Connection failed mysql: " . mysqli_connect_error());
	}
	return $connect;	
}

if(isset($_POST["processform"])){
	$connection = connect_to_mysqli($mysqlserverhost, $username_mysql, $password_mysql, $database_name);
	$firstfield = mysqli_real_escape_string($connection, sanitize($_POST["firstfield"]));
	$secondfield = mysqli_real_escape_string($connection, sanitize($_POST["secondfield"]));
	$thirdfield = mysqli_real_escape_string($connection, sanitize($_POST["thirdfield"]));
	$fourthfield = mysqli_real_escape_string($connection, sanitize($_POST["fourthfield"]));	 
	$sql = "INSERT INTO table_form (dbfield1, dbfield2, dbfield3, dbfield4) VALUES ('$firstfield', '$secondfield', '$thirdfield', '$fourthfield')";
	if (mysqli_query($connection, $sql)) {
		  echo "<h2><font color=blue>New record added to database.</font></h2>";
	} else {
		  echo "Error: " . $sql . "<br>" . mysqli_error($connection);
	}
	mysqli_close($connection);
}

?>

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p{
    text-align: right;
}
#box{
	width:955px;
	margin:20px auto;
	padding-top:20px;
	font-family: serif;
}
#form{
	border-radius:2px;
	padding:20px 30px;
	box-shadow:0 0 15px;
	font-size:14px;
	font-weight:bold;
	width:350px;
	margin:20px 250px 0 35px;
	float:left;
}
h3{
	text-align:center;
	font-size:20px;
}
input{
	width:100%;
	height:35px;
	margin-top:5px;
	margin-bottom: 20px;
	border:1px solid #999;
	border-radius:3px;
	padding:5px;
}
input[type=submit]{
	background-color:#ca1e1e;
	border:1px solid white;
	font-family: serif;
	font-Weight:bold;
	font-size:18px;
	color:white;
}
textarea{
	width:100%;
	height:80px;
	margin-top:5px;
	border-radius:3px;
	padding:5px;
}
span{
	color:red
}
.successMessage{
    background-color: #7acc7d;
    border: #2b5a2d 1px solid;
    padding: 5px 9px;
    color: #262b26;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}
.errorMessage{
    background-color: #e64141;
    border: #da1414 1px solid;
    padding: 5px 10px;
    color: #fdf7f7;
    border-radius: 4px;
}
.info{
    font-size: 0.9em;
    color: #d67262;
    letter-spacing: 2px;
    padding-left: 5px;
}

</style>
<script type="text/javascript">
  function validateForm() {
    var a = document.forms["Form"]["firstfield"].value;
    var b = document.forms["Form"]["secondfield"].value;
    var c = document.forms["Form"]["thirdfield"].value;
    var d = document.forms["Form"]["fourthfield"].value;
    if (a == null || a == "", b == null || b == "", c == null || c == "", d == null || d == "") {
      alert("Please Fill All Required Field");
      return false;
    }
  }
  

</script>    <link rel="stylesheet" href="style.css">
</head>
<body>

<div id="box">
  <form action="contact.php" method="post" name="Form" onsubmit="return validateForm()" id="form"><p>* Champs Requis.</p>
  <input type="hidden" name="processform" value="1">
        <label for="field">* Nom:</label>
        <input type="text" id="field1" name="firstfield" placeholder="Value...">
        <label for="field">* Numéro de téléphone:</label>
        <input type="text" id="field2" name="secondfield" placeholder="Value...">
        <label for="field">* Adresse:</label>
        <input type="text" id="field3" name="thirdfield" placeholder="Value...">
        <label for="field">* Votre liste de course:</label>
        <textarea id="field4" name="fourthfield" placeholder="Value..."></textarea>
      <input type="submit" value="Submit">

  </form>
  
</ul>
</body>
</html>

I’ve already done it

I checked your credentials, and the password is not correct.

Also, we have a KB article about this error:

4 Likes

Hello thank you very much for your answer, but now I have a problem of No such file or directory

Again, that error is also in the article Admin linked.

1 Like

Yes but this time I took a good look and it’s the good one

This code is trying to connect to the database a second time. There should only be one connect statement. Also, these variables to not exist (At least in your snippet).

2 Likes

ok thanks i removed that part. But now when I click on the button I get a 500 error I don’t know what to do again

It’s working for me now. Check the database and see if the data was entered.

1 Like

always empty

but i don’t have error 500 just a white page

Try using a different device/browser/network.

Is my test data in the database?

I still have the blank page, and I have no data in the database

Can you share the updated code? Hide the password!

type or paste code here<?php include('menu.php'); ?>
<?php

	/*************************
	*  Page: espace-membre.php
	*  Page encodée en UTF-8
	**************************/


//on se connecte une fois pour toutes les actions possible de cette page:
$mysqli=mysqli_connect('sql308.epizy.com','epiz_31263592','*****','epiz_31263592_listecourse');//'serveur','nom d'utilisateur','pass','nom de la table'
if(!$mysqli) {
	die("Erreur connection BDD: " . mysqli_connect_error());
	//Dans ce script, je pars du principe que les erreurs ne sont pas affichées sur le site, vous pouvez donc voir qu'elle erreur est survenue avec mysqli_error(), pour cela décommentez la ligne suivante:
	//echo "<br>Erreur retournée: ".mysqli_error($mysqli);
	exit(0);
}

// ------------------------- Do not modify code under this field -------------------------- //

if(isset($_POST["processform"])){
	$connection = connect_to_mysqli($mysqlserverhost, $username_mysql, $password_mysql, $database_name);
	$firstfield = mysqli_real_escape_string($connection, sanitize($_POST["firstfield"]));
	$secondfield = mysqli_real_escape_string($connection, sanitize($_POST["secondfield"]));
	$thirdfield = mysqli_real_escape_string($connection, sanitize($_POST["thirdfield"]));
	$fourthfield = mysqli_real_escape_string($connection, sanitize($_POST["fourthfield"]));	 
	$sql = "INSERT INTO table_form (dbfield1, dbfield2, dbfield3, dbfield4) VALUES ('$firstfield', '$secondfield', '$thirdfield', '$fourthfield')";
	if (mysqli_query($connection, $sql)) {
		  echo "<h2><font color=blue>New record added to database.</font></h2>";
	} else {
		  echo "Error: " . $sql . "<br>" . mysqli_error($connection);
	}
	mysqli_close($connection);
}

?>

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p{
    text-align: right;
}
#box{
	width:955px;
	margin:20px auto;
	padding-top:20px;
	font-family: serif;
}
#form{
	border-radius:2px;
	padding:20px 30px;
	box-shadow:0 0 15px;
	font-size:14px;
	font-weight:bold;
	width:350px;
	margin:20px 250px 0 35px;
	float:left;
}
h3{
	text-align:center;
	font-size:20px;
}
input{
	width:100%;
	height:35px;
	margin-top:5px;
	margin-bottom: 20px;
	border:1px solid #999;
	border-radius:3px;
	padding:5px;
}
input[type=submit]{
	background-color:#ca1e1e;
	border:1px solid white;
	font-family: serif;
	font-Weight:bold;
	font-size:18px;
	color:white;
}
textarea{
	width:100%;
	height:80px;
	margin-top:5px;
	border-radius:3px;
	padding:5px;
}
span{
	color:red
}
.successMessage{
    background-color: #7acc7d;
    border: #2b5a2d 1px solid;
    padding: 5px 9px;
    color: #262b26;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}
.errorMessage{
    background-color: #e64141;
    border: #da1414 1px solid;
    padding: 5px 10px;
    color: #fdf7f7;
    border-radius: 4px;
}
.info{
    font-size: 0.9em;
    color: #d67262;
    letter-spacing: 2px;
    padding-left: 5px;
}

</style>
<script type="text/javascript">
  function validateForm() {
    var a = document.forms["Form"]["firstfield"].value;
    var b = document.forms["Form"]["secondfield"].value;
    var c = document.forms["Form"]["thirdfield"].value;
    var d = document.forms["Form"]["fourthfield"].value;
    if (a == null || a == "", b == null || b == "", c == null || c == "", d == null || d == "") {
      alert("Please Fill All Required Field");
      return false;
    }
  }
  

</script>
</head>
<body>

<div id="box">
  <form action="index.php" method="post" name="Form" onsubmit="return validateForm()" id="form"><p>* Champs Requis.</p>
  <input type="hidden" name="processform" value="1">
        <label for="field">* Nom:</label>
        <input type="text" id="field1" name="firstfield" placeholder="Value...">
        <label for="field">* Numéro de téléphone:</label>
        <input type="text" id="field2" name="secondfield" placeholder="Value...">
        <label for="field">* Adresse:</label>
        <input type="text" id="field3" name="thirdfield" placeholder="Value...">
        <label for="field">* Votre liste de course:</label>
        <textarea id="field4" name="fourthfield" placeholder="Value..."></textarea>
      <input type="submit" value="Submit">

  </form>
  
</ul>
</body>
</html>


Remove this;

$mysqli=mysqli_connect('sql308.epizy.com','epiz_31263592','*****','epiz_31263592_listecourse');//'serveur','nom d'utilisateur','pass','nom de la table'
if(!$mysqli) {
	die("Erreur connection BDD: " . mysqli_connect_error());
	//Dans ce script, je pars du principe que les erreurs ne sont pas affichées sur le site, vous pouvez donc voir qu'elle erreur est survenue avec mysqli_error(), pour cela décommentez la ligne suivante:
	//echo "<br>Erreur retournée: ".mysqli_error($mysqli);
	exit(0);
}
2 Likes

But how do you connect to the DB?

2 Likes