Jump to content

Problem connecting (or inserting in MySQL?): Connection closed gracefully


firlefanz

Recommended Posts

Hello everybody,

 

I am new to this forum so Hello :-)

 

I am an absolute php beginner and a hobby game developer. I need php to send hiscores to my online hiscore list (using mysql) and get that hiscorelist.

 

I had some stuff which was working perfect until I changed my web homepage provider, which also has new mysql und php versions.

 

Right now I cannot insert a score anymore or connect, I always get the error "Connection closed gracefully".

 

To connect to the database I used a file db.inc until now (******* is for my Passwort, dbuser is for my database user):

 

<?
$db =
mysql_connect("mysql.webhosting68.1blu.de","dbuser ","********
"); mysql_select_db("db172972x1819060",$db);
?>

 

Can anybody pleeeeeease help me? I have own written shareware games online, none of them can send a highscore anymore, please help and thanks a lot :-)

 

And this is how my newscore-php looks like which adds a score:

 

 
<?php
require_once('db.inc.php');
$highscorestring=$_POST["Name"] . $_POST["Info"] . $_POST["Rank"] . $_POST["Score"] . $_POST["Skill"] . $_POST["Level"] . $_POST["Quest"] . $_POST["Vers"] . $_POST["Difficulty"] . "crypter";
if ( md5($highscorestring) == $_POST["Hash"]){
$sql="Select Count(*) from mygame_highscores where ModeID=".$_POST["ModeID"]." and Name='".$_POST["Name"]."'";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
if ($row[0] == 0)
{
$sql = "INSERT INTO mygame_highscores (ModeID,Name,Rank,Info,Score,Skill,Level,Quest,Vers,Difficulty) VALUES (
'".$_POST["ModeID"]."',
'".$_POST["Name"]."',
'".$_POST["Rank"]."',
'".$_POST["Info"]."',
".$_POST["Score"].",
".$_POST["Skill"].",
".$_POST["Level"].",
".$_POST["Quest"].",
'".$_POST["Vers"]."',
".$_POST["Difficulty"].")";
}
else
{
$sql = "Update mygame_highscores set
Score=".$_POST["Score"].",
Skill=".$_POST["Skill"].",
Rank='".$_POST["Rank"]."',
Level=".$_POST["Level"]."
where ModeID=".$_POST["ModeID"]."
AND Name='".$_POST["Name"]."'
AND Score<".$_POST["Score"];
}
$result = mysql_query($sql);
$sql="Select Count(*) from mygame_highscores where ModeID=".$_POST["ModeID"]." AND Score>".$_POST["Score"];
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
echo $row[0];
}
else
{
echo "1000";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.