I'm trying to create a consultant with PHP who makes a request on 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 the screen the value true
(it should only pass me the values of if
after the query 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>";
?>