Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/web1/html/Game2/php/registrieren.php on line 7
$table = mysql_query("SELECT * FROM `user` WHERE `user` = '".$name."'");
$row = mysql_fetch_array($table);
<?php
include("./inc/db.php");
$table = mysql_query("SELECT * FROM `user` WHERE `user` = '".$name."'");
$row = mysql_fetch_array($table);
if (is_array($row)) {
?>
<div class="kasten-fehler">
Der Username existiert bereits.
</div>
<?php
$fehler = true;
}elseif ($name == "") {
?>
<div class="kasten-fehler">
Der Username ist ungültig
</div>
<?php
$fehler = true;
}elseif ($pwd == "") {
?>
<div class="kasten-fehler">
Das Passwort muss mindestends 1 Buchstaben enthalten
</div>
<?php
$fehler = true;
}else {
$name = stripslashes(htmlentities($name));
$pwd = stripslashes(htmlentities($pwd));
$bemerkung = stripslashes(nl2br($bemerkung));
$planet = stripslashes(htmlentities($planet));
$table = sendSQL("SELECT * FROM `user` ORDER BY `id` DESC LIMIT 0,1");
$row = mysql_fetch_array($table);
$id = $row['id'] + 1;
$table = sendSQL("SELECT * FROM `planeten` ORDER BY `id` DESC LIMIT 0,1");
$row = mysql_fetch_array($table);
$id_planet = $row['id'] + 1;
sendSQL("INSERT INTO `user` VALUES ('".$id."', '".$name."', '".$pwd."', '".$bemerkung."', 'nein', '0', '0', '0')");
sendSQL("INSERT INTO `planeten` VALUES ('".$id_planet."', '".$id."', '".$planet."', '0', '0', '0', '".time()."')");
sendSQL("INSERT INTO `res` VALUES ('".$id."', '100000', '50000', '0')");
sendSQL("INSERT INTO `produktion` VALUES ('".$id_planet."', '33', '33', '33')");
sendSQL("INSERT INTO `lager` VALUES ('".$id."', '5000', '5000', '5000')");
$table = sendSQL("SELECT * FROM `gebaude-shop`");
while ($row = mysql_fetch_array($table)) {
sendSQL("INSERT INTO `gebaude` VALUES ('', '".$id_planet."', '".$row['id']."', '0', '0')");
}
$table = sendSQL("SELECT * FROM `verteidigung-shop`");
while ($row = mysql_fetch_array($table)) {
sendSQL("INSERT INTO `verteidigung` VALUES ('', '".$id_planet."', '".$row['id']."', '0', '0', '0')");
}
$table = sendSQL("SELECT * FROM `forschung-shop`");
while ($row = mysql_fetch_array($table)) {
sendSQL("INSERT INTO `forschung` VALUES ('', '".$id."', '".$row['id']."', '0', '0')");
}
?>
<div class="kasten-hinweis">
Registrierung fertiggestellt
</div>
<table>
<tr>
<td>Name</td>
<td><?= $name ?></td>
</tr>
<tr>
<td>Passwort</td>
<td><?= $pwd ?></td>
</tr>
<tr>
<td>Bemerkung</td>
<td><?= $bemerkung ?></td>
</tr>
<tr>
<td>Planet</td>
<td><?= $planet ?></td>
</tr>
</table>
Zum Login
<?php
}
if ($fehler == true) {
?>
Zurück zur Registrierung
<?php
}
?>
<?php
$db = mysql_connect("localhost", "spacegame", "");
mysql_select_db("spacegame");
function sendSQL($sql, $db_connection) {
// Stringaufwertung
$sql = stripslashes($sql);
// SECURITY
// Nur ein Befehl auf einmal
$sql = str_replace(";", "", $sql);
// SQL senden
$result = mysql_query($sql, $db_connection);
// Resultat Ãœbergeben
return $result;
}
?>