Jeg har et spørgsmål til hvorfor den sidger:
MySQLi Connection was not established: Connection refusedhttp://williamhein.66ghz.com/users/users.phpHer er koden users.php den man logger ind på:
<!DOCTYPE html>
<?php session_start();?>
<html>
<head>
<title>User Login</title>
</head>
<body>
<form action="users.php" method="post">
<table width="500" align="center" bgcolor="skyblue">
<tr align="center">
<td colspan="3"><h2>User Login</h2></td>
</tr>
<tr>
<td align="right"><b>Email</b></td>
<td><input type="text" name="email" required="required "/></td>
</tr>
<tr>
<td align="right"><b>Password:</b></td>
<td><input type="password" name="pass" required="required></td>
</tr>
<tr align="center">
<td colspan="3">
<input type="submit" name="login" value="Login"/>
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
// establishing the MySQLi connection
$con = mysqli_connect("192.168.0.6","cucch_16153660_users","","cucch_16153660_users");
if (mysqli_connect_errno())
{
echo "MySQLi Connection was not established: " . mysqli_connect_error();
}
// checking the user
if(isset($_POST['login'])){
$email = mysqli_real_escape_string($con,$_POST['email']);
$pass = mysqli_real_escape_string($con,$_POST['pass']);
$sel_user = "select * from users where user_email='$email' AND user_pass='$pass'";
$run_user = mysqli_query($con, $sel_user);
$check_user = mysqli_num_rows($run_user);
if($check_user>0){
$_SESSION['user_email']=$email;
echo "<script>window.open('home.php','_self')</script>";
}
else {
echo "<script>alert('Email or password is not correct, try again!')</script>";
}
}
?>