javascript - PHP Mysqli Parallel Connection doesnt go through when IP is incorrect -


i have small application used connect several databases across multiple ips, takes input ip, username, password. 3 free text fields , users can provide value. database selected in next screen.

the purpose of page validate if credentials valid.

var arrayinput = [ip, username, password]; $.ajax({             url: 'login.php',             type: 'post',             data: {                 arrayinput             },             success: function (data) {                 console.log(data);             },              error: function (data) {                 console.log(data);             } 

the php file below.

< ? php mysqli_report(mysqli_report_all | mysqli_report_strict); $ip=$_post['arrayinput'][0]; $username=$_post['arrayinput'][1]; $password=$_post['arrayinput'][2]; try {          $mysqli = mysqli_connect($ip,$username,$password);         mysqli_close($mysqli);         $data = array('type' => 'success', 'message' => 'connected');             header('content-type: application/json');         return json_encode($data);     } catch (exception $e) {          mysqli_close($mysqli);         $data = array('type' => 'error', 'message' => 'failure connect');             header('content-type: application/json');         return json_encode($data);    } ?> 

now issue that, works fine when ip correct. in case when ip incorrect, mysqli_connect waits till timeout , goes exception.

now problem facing when mysqli_connect attempting connection cannot launch app in new session trigger different connection, though ip correct.

for e.g.

valid ip 127.0.0.1

and tried 1.0.0.1

after cannot try 127.0.0.1 though close browser , open new browser. have wait way till timeout. reducing timeout option. want see if there other options can close connection.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -