mene sono dimenticato un pezzo:
Codice PHP:
function install($name, $pass, $email, $faction)
{
global $db_id;
$query="insert into users(name, pass, email, level, joined, lastVisit, points, ip, grPath, faction) values('".$name."', '".$pass."', '".$email."', 5, now(), now(), 0, '".$_SERVER["REMOTE_ADDR"]."', 'default/', ".$faction.")";
$result=mysql_query($query, $db_id);
$handle = fopen ("map.dat","r") or
die("Error opening map data file."); $ok=1;
for ($i=0; $info[$i] = fscanf ($handle, "%i %i %i %i"); $i++)
{
if (!$info[$i][3])
switch($info[$i][2])
{
case 1: $info[$i][3]=rand(1, 6); break;
case 2: $info[$i][3]=rand(1, 4); break;
default: ;
}
$query="insert into map(x, y, type, subtype) values (".$info[$i][0] .", ".$info[$i][1].", ".$info[$i][2].", ".$info[$i][3].")";
$result=mysql_query($query, $db_id); if (!$result) $ok=0;
}
fclose($handle);
if ($ok) msg(" Perfetto. Dati aggiunti nella mappa.");
else msg("Failed.".mysql_error());
}