Hi i am writing a script to check a guid against a column in a database. Here is what I have so far but I keep getting a "Parse error: syntax error, unexpected T_STRING in /home/mydir/foobar/guid-checker.php on line 39"
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>guid check</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
require_once('connectvars.php');
$player_name = 'itivae'; //$_POST['playername'];
$player_id = '1010103'; //$_POST['playerid'];
$guid = '4e72f140c35df55909ce551273c44006'; //$_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.');
}*/
$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();
}
$query = "SELECT banned_guid, player_id, player_name FROM player_data WHERE banned_guid = $guid;
if ($result = $mysqli->query($query)) {
if (mysql_num_rows($result)>0) {
printf ('Unapproved ' . $guid . ' ' . 'matches a guid on the ban list.');
}
}
else {
$query ="INSERT INTO player_data (player_name, player_id, guid)
VALUES ('itivae', '1010103', '4e72f140c35df55909ce551273c44006')";
echo 'This player ' . $player_name. ' ' . $player_id . ' ' . $guid . ' has been added to the whitelist.');
}
$mysqli->close();
?>
</body>
</html>
Any help is appreciated. I may not even be going about this in the right manner as I am still new with php.
Thanks in advance.
Bookmarks