Thanks for the suggestions. I use several text editors that all have syntax highlighting. I have made some headway on this code but am running into a problem when I try to INSERT data into the database. I have tried using mysqli_query() but I am not getting the confirmation or the error text. Just a blank screen. I have commented on the point that the code works till. Any suggestions would be much appreciated.
PHP Code:
<?php
require_once('connectvars.php');
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s \n", $mysqli->connect_error);
exit();
}
$player_name = 'itivae'; //$_POST['playername'];
$player_id = '1010103'; //$_POST['playerid'];
$guid = '4e72f140c35df55909ce551273c44007'; //$_POST['guid'];
/*if(!isset($_POST['playernam']) ||
!isset($_POST['playerid']) ||
!isset($_POST['guid']) || {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}*/
$query = "SELECT * FROM player_bans WHERE banned_guid = '$guid'";
if ($result = $mysqli->query($query)){
while ($obj = $result->fetch_object()) {
printf ('<div class="bans">'."%s", $obj->banned_guid);
printf (" appears in the ban list" . '</div>');
}
} //WORKS TILL HERE
else {
$query = "INSERT INTO player_data (player_name, player_id, guid)
VALUES ('$player_name', '$player_id', '$guid')";
$result = $mysqli->query($query);
if ( false===$result ) {
printf("error: %s\n", mysqli_error($mysqli));
}
else {
echo 'Player: ' . $player_name . ' ' . $player_id . ' ' . $guid . ' has been added to the whitelist.';
}
}
$mysqli->close();
?>
Bookmarks