Avatar billede tras Juniormester
04. maj 2006 - 09:44 Der er 4 kommentarer og
1 løsning

Har problemer med at sætte get ind i kode?!

Hej for at få denne kode til at virke siger en af mine venner der skal sættes $_GET[ ind for at få fat i nogle af variablerne eller hvad det nu heder, det virkede på min gamle server men den nye kan ikke finde ud af det uden get er der ikke nogle som vil hjælpe mig med at sætte get ind så det kommer til at virke´!!!

mange tak

<?
$host = "xxx";                    // database host, usually localhost
$username = "xxx";                  // database username
$password = "xxx";                  // database password
$database = "xxx";            // database name
$dbtablename = "xxx";                  // table name
$color_normal = "255,0,0";              // color of the dots representing visitors < 100
$color_100 = "255,64,0";                // color of the dots representing 100 < visitors < 500
$color_500 = "255,96,0";                // color of the dots representing 500 < visitors < 1000
$color_1000 = "255,128,0";              // color of the dots representing 1000 < visitors
$color_current = "255,255,0";            // color of the dots the current visitor
$file = "worldmap.jpg";                  // name of the map
$limit = 999999;                        // maximum number of visitors that is displayed

$server = mysql_connect($host, $username, $password);
$connection = mysql_select_db($database, $server);

$im = imagecreatefromjpeg($file);

$scale_x = imagesx($im);
$scale_y = imagesy($im) * 1.175;
$i = 0;

$sql = mysql_query("SELECT * FROM ".$dbtablename." LIMIT 0,".$limit);
while ($row = mysql_fetch_array($sql)){
$output[$i] = array($row['lat'], $row['long']);
$i++;
}

for ($x=0;$x<count($output);$x++){
$times= 0;
for ($y=0;$y<count($output);$y++){
  if ($output[$x]['lat'] == $output[$y]['lat'] AND $output[$x]['long'] == $output[$y]['long']){
  $times++;
  }
}

if ($times <= 100){ $color=$color_normal; }
if ($times > 100 AND $times <= 500){ $color=$color_100; }
if ($times > 500 AND $times <= 1000){ $color=$color_500; }
if ($times > 1000){ $color=$color_1000; }

  $color = explode(",", $color);
  $color_n = imagecolorallocate($im, $color[0],$color[1],$color[2]);
  $pt = getlocationcoords($output[$x][0], $output[$x][1], $scale_x, $scale_y);
  imagefilledrectangle($im,$pt["x"]-1,$pt["y"]-1,$pt["x"],$pt["y"],$color_n);
}



if(($long != "") && ($lat != "") && ($ipaddress != "")) { 
$sql = mysql_query("INSERT INTO world VALUES ( '$ipaddress', '$long', '$lat', '".date('h:i, j-m-Y')."')");
$color_current = explode(",", $color_current);
$mainColor = imagecolorallocate($im, $color_current[0], $color_current[1], $color_current[2]);
$pt = getlocationcoords($lat, $long, $scale_x, $scale_y);
imagefilledrectangle($im,$pt["x"]-1,$pt["y"]-1,$pt["x"]+1,$pt["y"]+1,$mainColor);
}





header ("Content-type: image/png"); 
imagepng($im);
imagedestroy($im);

function getlocationcoords($lat, $lon, $width, $height) {
$x = (($lon + 180) * ($width / 360));
$y = ((($lat * -1) + 90) * ($height / 180));
return array("x"=>round($x),"y"=>round($y));
}
?>
Avatar billede tras Juniormester
04. maj 2006 - 09:45 #1
Siden der viser informationerne vis det hjælper lidt


<?

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                        //
// COPYRIGHT                                                                                              //
//                                                                                                        //
//  This software is developed and copyrighted by Xantus WEBdevelopment.                                  //
//                                                                                                        //
//                                                                                                        //
// TERMS OF USE                                                                                            //
//                                                                                                        //
//  This script is free for personal use. The copyright MUST remain intact.                                //
//  Please contact us if you want to have the copyright removed.                                          //
//                                                                                                        //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

?>
<table><tr><td>
<a style="color: green; font-size: 11px; text-decoration: none;" href="http://www.xantus-webdevelopment.com">Tool by - &copy; Xantus WEBdevelopment</a>
</td></tr><tr><td>
<script language='Javascript' src='http://gd.geobytes.com/gd?after=-1&variables=GeobytesLongitude,GeobytesLatitude,GeobytesIpAddress,GeobytesPopulation,GeobytesCountry,GeobytesCapital,GeobytesMapReference,GeobytesRegion,GeobytesCity'></script>
<script language='Javascript'>
    document.write('<img border=1 src=\"worldplotimg.php?long=' + sGeobytesLongitude + '&lat=' + sGeobytesLatitude + '&ipaddress=' + sGeobytesIpAddress + '&population=' + sGeobytesPopulation + '&country=' + sGeobytesCountry + '&capitol=' + sGeobytesCapital + '&mapref=' + sGeobytesMapReference + '&region=' + sGeobytesRegion + '&city=' + sGeobytesCity + '\">');
    if ((sGeobytesLongitude != '') && (sGeobytesLatitude != '')) {
        document.write('<br><table><tr><td><B>Your Location:</B></td><td>' + sGeobytesMapReference + ' &#187; ' + sGeobytesCountry + ' &#187; ' + sGeobytesRegion + ' &#187; ' + sGeobytesCity + '</td></tr>');
        document.write('<tr><td><B>Your Map Plot:</B></td><td>' + Math.round(sGeobytesLongitude*10)/10 + '&#176; Longitude<br>' + Math.round(sGeobytesLatitude*10)/10 + '&#176; Latitude</td></tr></table>');
    } else {
        document.write('<BR>I am sorry.  I could not plot your position.');
    }
</script>
</td></tr></table>
Avatar billede tras Juniormester
04. maj 2006 - 09:46 #2
sqlen

CREATE TABLE world (
  IP varchar(50) NOT NULL default '',
  long varchar(50) NOT NULL default '',
  lat varchar(50) NOT NULL default '',
  date varchar(50) NOT NULL default ''
) TYPE=MyISAM;
Avatar billede mccookie Seniormester
10. maj 2006 - 15:44 #3
Hvad gør dit script??

Mangler der ikke noget kode?

Gør den et eller andet? Får du e fejl?
Avatar billede dotcom1 Nybegynder
10. maj 2006 - 15:47 #4
Scriptet er herfra: http://www.xantus-webdevelopment.com/ --> Visitor's plotter. Det viser hvor en besøgende kommer fra på et kort.
Avatar billede tras Juniormester
29. maj 2006 - 13:03 #5
.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester