php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005-2

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 07.10.2005, 17:32  
Gast
 
Beiträge: n/a
Standard Aus Bild eine Tabelle

Hallo

Ich hab diese drei dateien von dem browserspiel landkampf:

map.php

PHP-Code:
<?PHP

 $filename
="map.php";

 require(
"./global.php");

 if(!isset(
$_SESSION['userid'])) error_page("Bitte logge dich ein!");

 if(isset(
$_REQUEST['page'])) $page=intval($_REQUEST['page']);
 else 
$page=$userdata['x'];

 
$result $db->query("SELECT x FROM cc".$n."_crand GROUP BY x");
 while(
$row $db->fetch_array($result)) {
 if (
$page==$row['x']) {
   
$opt .= "<option value=\"$row[x]\" selected>$row[x]</option>";
  } else {
   
$opt .= "<option value=\"$row[x]\">$row[x]</option>";
  }
 }
 
 
$goto_1=$page+1;
 
$goto_2=$page-1;
 
$goto_3=$page+5;
 
$goto_4=$page-5;

 if(
$page<0$page=0;

 
$i=0;

  eval(
"\$tpl->output(\"".$tpl->get("map")."\");");

  
$username_r=username($row['userid']);
  
$row['name']=b_trim($row['name']);

?>
map.html im Ordner templates


Code:
<table width="200" border="1">
  <tr>
    <td bgcolor="#999999" style="color:#FFFFFF">Unsename</td>
    <td bgcolor="#999999" style="color:#FFFFFF">Allianz</td>
  </tr>
  <tr>
    <td>$userdata[username]</td>
    <td><if($userdata['allianzid']==0)><then>keine</then><else>$allianz[name]</else></if></td>
  </tr>
  <tr>
    <td>$row[name]</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
  </tr>
</table>
<center>
  <h2>Galaxie: $page</h2>
</center>
<table bgcolor="#FFFFFF" align="center" border="0" width="450" height="200">
<tr>
<td>
[img]mapgd.php?x=$page&cxid=$sid[/img]
</td>
</tr>
</table>




<center>
<table><tr>
<td valign="top"><if($page!=0)><then>&laquo;</then><else></else></if></td>
<td><form action="map.php?cxid=$sid" method="post"><select name="page">
$opt
</select>
<input type="submit" value="Ok">
</form></td>
<td valign="top"><if($page!=100)><then>&raquo;</then><else></else></if></td>
</tr></table>
</center>
</form>
$footer

und mapgd.php

PHP-Code:
<?PHP
 
require("./global.php");

$result=$db->query("SELECT * FROM cc".$n."_countries WHERE x='$x' ORDER BY y ASC");
$free=$db->query("SELECT * FROM cc".$n."_crand WHERE x='$x' AND used='0' ORDER BY y ASC");
$countOfRes=$db->num_rows($result)+$db->num_rows($free);
if (
$countOfRes 4) {
 
$add 1;
}
$imy    = (int) ($countOfRes/4+$add)*60;
$ds        1;
$image    imagecreatetruecolor(600$imy);
$bgimg    imagecreatefromjpeg("images/kartebg.jpg");
$land1    imagecreatefrompng("images/land1.png");
$land2    imagecreatefrompng("images/land2.png");
$land3    imagecreatefrompng("images/land3.png");
$land4    imagecreatefrompng("images/land4.png");
imagecolortransparent($land1imagecolorat($land111));
imagecolortransparent($land2imagecolorat($land211));
imagecolortransparent($land3imagecolorat($land311));
imagecolortransparent($land4imagecolorat($land411));
$blk    imagecolorallocate($image000);
$wht    imagecolorallocate($image200200200);
imagecopyresized($image$bgimg0000600796600796);
imagecopyresized($image$bgimg079600600796600796);
$x=0;
$y=0;
 while(
$row=$db->fetch_array($result)) {
  
$allires=$db->query("SELECT allianzid FROM cc".$n."_users WHERE userid='$row[userid]'");
  
$alli=$db->fetch_array($allires);
  
$alliname=allianz($alli['allianzid']);
  if (!
$alliname) {
   
$alliname="Keine Allianz";
  }
  
$username_r=username($row['userid']);
  
$row['name']=b_trim($row['name']);
  
$array="&auml;:ä|&Auml;:Ä|&ouml;:ö|&Ouml;:Ö|&uuml;:ü|&Uuml;:Ü";
  
$bit=explode("|",$array);
   for(
$i=0;$i<count($bit);$i++) {
    
$space=explode(":",$bit[$i]);
    
$username_r=str_replace($space[0],$space[1],$username_r);
    
$row['name']=str_replace($space[0],$space[1],$row['name']);
   }
  
$bx rand(-25,25);
  
$by rand(-5,5);
  if (
$row['picid']==1) {
   
imagecopyresized($image$land1, ($x+25+$bx), $y+5+$by0060605050);   
  } elseif (
$row['picid']==2) {
   
imagecopyresized($image$land2, ($x+25+$bx), $y+5+$by0060605050);   
  } elseif (
$row['picid']==3) {
   
imagecopyresized($image$land3, ($x+25+$bx), $y+5+$by0060605050);   
  } elseif (
$row['picid']==4) {
   
imagecopyresized($image$land4, ($x+25+$bx), $y+5+$by0060605050);   
  }
   
imagestring($image2, ($x+5+$ds), ($y+$ds), $username_r$wht);
   
imagestring($image2, ($x+5+$ds), ($y+10+$ds), $row['name'], $wht);
   
imagestring($image2, ($x+5+$ds), ($y+20+$ds), $alliname$wht);
   
imagestring($image2, ($x+5+$ds), ($y+30+$ds), $row['x'].":".$row['y'], $wht);
   
imagestring($image2, ($x+5+$ds), ($y+40+$ds), "$row[points] Punkte"$wht);
   
imagestring($image2, ($x+5), ($y), $username_r$blk);
   
imagestring($image2, ($x+5), ($y+10), $row['name'], $blk);
   
imagestring($image2, ($x+5), ($y+20), $alliname$blk);
   
imagestring($image2, ($x+5), ($y+30), $row['x'].":".$row['y'], $blk);
   
imagestring($image2, ($x+5), ($y+40), "$row[points] Punkte"$blk);

  
$x += 150;
  if (
$x >= 600) {
   
$x 0;
   
$y += 60;
  }
 }
 while(
$row=$db->fetch_array($free)) { 
   
imagestring($image2, ($x+5+$ds), ($y+10+$ds), "Freie Fläche"$wht);
   
imagestring($image2, ($x+5+$ds), ($y+20+$ds), $row['x'].":".$row['y'], $wht);
   
imagestring($image2, ($x+5), ($y+10), "Freie Fläche"$blk);
   
imagestring($image2, ($x+5), ($y+20), $row['x'].":".$row['y'], $blk);

  
$x += 150;
  if (
$x >= 600) {
   
$x 0;
   
$y += 60;
  }
 }
header('Content-Type: image/jpeg');
imagejpeg($image""70);
imagedestroy($image);
imagedestroy($kartebg);
imagedestroy($land1);
imagedestroy($land2);
imagedestroy($land3);
imagedestroy($land4);
?>

Meine Karte sieht dann aus, wie ein alnd mit den besitzern. Ich will es aber haben, dass die User einzeln in tabellen aufgelistet sind, so wie in ogame oder so. Ich habe 400 sonnensysteme mit jeweils 25 Planeten. also x:y

ich hoff ihr könnt mir helfen eine tabelle zum spiel zu machen.

fragen seh ich gern. ich bin mir sicher, dass ich was vergessen hab.

mfg
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 07.10.2005, 17:48  
Gast
 
Beiträge: n/a
Standard

du hast was vergessen .....











dich aufs wesentliche zu beschränken


es hat sicher kaum jemand lust deine 200 zeilen code zurchzugehen
sich vorzustellen wie das spiel aussehen könnte dazu vergleichen wie
ein anderes spiel aussehen könnte ... und danach zu sehen wie man etwas
"ummotschen" könnte


gruss
 
Alt 07.10.2005, 19:13  
Gast
 
Beiträge: n/a
Standard

Hier ist die Seite im moment: http://darkgnom.da.funpic.de/

sie ist nicht sehr weit. den text beschränken kann ich nicht. ich weiß ja nicht mal, was wichtig ist


mfg
 
Alt 07.10.2005, 19:14  
Gast
 
Beiträge: n/a
Standard

Das heisst also, Du hast das Skript nicht geschrieben und kennst Dich mit php eigentlich garnicht aus und suchst kostenlose Rundumhilfe?

Zitat:
Ich hab diese drei dateien von dem browserspiel landkampf:
Schon wieder ein Browsergame.
 
Alt 07.10.2005, 19:16  
Gast
 
Beiträge: n/a
Standard

wow ... da kann man doch mal was erkennen ...

zumindest die werbung
 
Alt 07.10.2005, 19:21  
Gast
 
Beiträge: n/a
Standard

Wie meinst du das?

---

Ich habs immerhin schon geschafft, dass 25 mal dein name angezeigt wird....
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Bild an eine genaue Stelle in einer Tabelle einfügen?! miwius PHP Tipps 2008 6 28.10.2007 15:55
Bilder mit Tabelle... Yusuf HTML, Usability und Barrierefreiheit 9 17.10.2007 23:06
Druckbare Tabelle mit vielen Bildern havok HTML, Usability und Barrierefreiheit 3 21.06.2006 09:11
Problem mit Anzeige einer Tabelle mit dem Firefox? HTML, Usability und Barrierefreiheit 8 28.11.2005 15:08
Bild in Tabelle zentrieren (IE) dethlef14 PHP Tipps 2005-2 17 18.10.2005 12:05
[Erledigt] Problem mit mySQL Datenbanken 7 27.09.2005 12:06
[Erledigt] mysql abfrage über 4 Tabelle - bis 3 geht, bei der 4. habert Datenbanken 2 08.09.2005 11:59
[Erledigt] Tabelle mit Bild überlagern PHP Tipps 2005 4 28.04.2005 11:10
Bild mit Link aus Tabelle nebeneinander ausgeben PHP Tipps 2005 3 25.04.2005 12:19
Bild in Tabelle einfügen ohne daß es sich wiederholt ? HTML, Usability und Barrierefreiheit 11 21.03.2005 17:42
bild in tabelle einfügen und auf standartgröße programmieren PHP-Fortgeschrittene 3 14.02.2005 22:51
image in tabelle mit 100% breite anzeigen? Promaetheus HTML, Usability und Barrierefreiheit 2 15.12.2004 20:05
[Erledigt] Bild in mysql tabelle Datenbanken 5 04.08.2004 16:25
Tabelle, Bild unten HTML, Usability und Barrierefreiheit 3 04.07.2004 14:36
HILFE: Column count doesn't match value count at row 1 Datenbanken 17 12.06.2004 16:45

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
&uuml; imagestrinfg, raquo imagestring, eval imagepng($bild) in template, $query = \select * from \.$x.\order by\.$y.\asc\; in php

Alle Zeitangaben in WEZ +2. Es ist jetzt 06:53 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.