So,
I run a Minecraft server and have a website on separately hosted server. I use a bukkit plugin which sends a value to the database when the player joins. This stored as [BLOB - 1 B] (image below), which is a binary value, so I conevert it into hexadecimal then check its value. As its boolean it can either be 00 - false or 01 - true. But when using my if statements to check what the value is, if the value is 00 it still says online...
But when I use this code on my webserver:
<form action="skript2.php" method="get">
<input type="text" name="user" />
<input type="submit" name="submit" value="Username" />
</form>
<?php
$uname = $_GET['user'];
$con=mysqli_connect("#####","#####","#####","#####");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM `variables21` WHERE name='db_sdb.$uname.onlinemode'");
if($row = mysqli_fetch_array($result)) {
$val = $row['value'];
$str = bin2hex("$val");
echo "$str";
if ($str = 01) {
echo "<body bgcolor=\"green\">";
echo "<font color=\"white\"><img src=\"https://minotar.net/helm/$uname/32\"> -- $uname is online!</font>";
}
if ($str = 00) {
echo "<body bgcolor=\"red\">";
echo "<font color=\"white\"><img src=\"https://minotar.net/helm/$uname/32\"> -- $uname is offline!</font>";
}
}
mysqli_close($con);
?>
Details where they're ##### is private, such as passwords etc.
The connection works just fine, other wise it return an error saying can't connect.
So why aren't my IF functions working?
Thanks! :)