1
I am trying to create a consultant with PHP who makes a request in a form with an email from the client and returns me if he is registered in the service. The problem is that when I start my page directly the if
prints on screen the value true
(he must only pass me the values of if
after the consultation made).
HTML code:
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<head>
</head>
<head>
<title>.::Cliente Consultor::.</title>
</head>
<body>
<form method="POST">
<center>
<BR>
<BR>
<BR>
<font size="4" color="orange" face="Segoe Print">.::Consulta::.<img src="" </font></span></p></div align="">
<BR>
<BR>
<BR>
<input type="text" name="bin">
<input type="submit">
</center>
</form>
</body>
<style>
body {
background: url() no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
color: black;
}
.twitter a{
text-decoration: none;
font-family: Arial, sans-serif ;
font-size: 50px;
text-shadow: grey 0px 0px 10px;
}
}</style>
</html>
PHP code:
<?php
error_reporting(0);
$bin = $_POST['bin'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://minhaconta.payleven.com.br/forgot-password");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, "password_token_type[email]=$bin" );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$s = curl_exec($ch);
$mensagem = ' ';
if ($1 == $2)
{
$q = explode('</title>', $s);
$1 = $q[1];
$2 = $q[1];
$binchecker = " [".$bin."] ";
$mensagem = 'cliente encontrado';
}
else
{
$mensagem= 'cliente não cadastrado';
}
echo "<br><br><center>".$mensagem."</center>";
?>
Is the PHP code in the same file as the HTML? And shouldn’t you run the check only when the form is submitted? Then one is missing
if
validating the request. Who are$1
and$2
and what you should doif ($1 == $2)
? Read about the PHP variable naming rules.– Woss
All the code is in a single index.php file the variables $1 and $2 contain the contents of the explode that stores the html of the page in which the request was made, if compares the two and returns me true or false
– Bruno Lazarine
I practically want to check if an email is registered on this site and return me the email with the answer next
– Bruno Lazarine