1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
| <?php session_start() ; ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
/* A partir de là jusqu'au prochain commentaire, c'est Dreamweaver qui met ça. N'ayant aucune raison de le retirer, j'ai laissé. */
<?php require_once('Connections/iloled.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
/* A partir d'ici, et jusqu'à la fin, ce sont des morceaux de codes prit à d'autres pages faites sous Dreamweaver que j'ai adapté pour obtenir ce que je voulais ou des codes que j'ai fait seul */
}
$colname_Recordset2 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset2 = $_SESSION['MM_Username'];
}
mysql_select_db($database_iloled, $iloled);
$query_Recordset2 = sprintf("SELECT perso FROM Comptes WHERE Username = %s", GetSQLValueString($colname_Recordset2, "text"));
$Recordset2 = mysql_query($query_Recordset2, $iloled) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = $_SESSION['MM_Username'];
}
mysql_select_db($database_iloled, $iloled);
$query_Recordset1 = sprintf("SELECT * FROM Personnages WHERE Nom = %s", GetSQLValueString($row_Recordset2['perso'], "text"));
$Recordset1 = mysql_query($query_Recordset1, $iloled) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_Milieu = "-1";
mysql_select_db($database_iloled, $iloled);
$query_Milieu = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($row_Recordset1['LocalY'], "int"),GetSQLValueString($row_Recordset1['LocalX'], "int"));
$Milieu = mysql_query($query_Milieu, $iloled) or die(mysql_error());
$row_Milieu = mysql_fetch_assoc($Milieu);
$totalRows_Milieu = mysql_num_rows($Milieu);
$LocalYHG = $row_Recordset1['LocalY']+1 ;
$LocalXHG = $row_Recordset1['LocalX']-1 ;
mysql_select_db($database_iloled, $iloled);
$query_HautGauche = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYHG, "int"),GetSQLValueString($LocalXHG, "int"));
$HautGauche = mysql_query($query_HautGauche, $iloled) or die(mysql_error());
$row_HautGauche = mysql_fetch_assoc($HautGauche);
$totalRows_HautGauche = mysql_num_rows($HautGauche);
$LocalYHM = $row_Recordset1['LocalY']+1 ;
$LocalXHM = $row_Recordset1['LocalX'] ;
mysql_select_db($database_iloled, $iloled);
$query_HautMilieu = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYHM, "int"),GetSQLValueString($LocalXHM, "int"));
$HautMilieu = mysql_query($query_HautMilieu, $iloled) or die(mysql_error());
$row_HautMilieu = mysql_fetch_assoc($HautMilieu);
$totalRows_HautMilieu = mysql_num_rows($HautMilieu);
$LocalYHD = $row_Recordset1['LocalY']+1 ;
$LocalXHD = $row_Recordset1['LocalX']+1 ;
mysql_select_db($database_iloled, $iloled);
$query_HautDroite = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYHD, "int"),GetSQLValueString($LocalXHD, "int"));
$HautDroite = mysql_query($query_HautDroite, $iloled) or die(mysql_error());
$row_HautDroite = mysql_fetch_assoc($HautDroite);
$totalRows_HautDroite = mysql_num_rows($HautDroite);
$LocalYMG = $row_Recordset1['LocalY'] ;
$LocalXMG = $row_Recordset1['LocalX']-1 ;
mysql_select_db($database_iloled, $iloled);
$query_MilieuGauche = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYMG, "int"),GetSQLValueString($LocalXMG, "int"));
$MilieuGauche = mysql_query($query_MilieuGauche, $iloled) or die(mysql_error());
$row_MilieuGauche = mysql_fetch_assoc($MilieuGauche);
$totalRows_MilieuGauche = mysql_num_rows($MilieuGauche);
$LocalYMD = $row_Recordset1['LocalY'] ;
$LocalXMD = $row_Recordset1['LocalX']+1 ;
mysql_select_db($database_iloled, $iloled);
$query_MilieuDroite = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYMD, "int"),GetSQLValueString($LocalXMD, "int"));
$MilieuDroite = mysql_query($query_MilieuDroite, $iloled) or die(mysql_error());
$row_MilieuDroite = mysql_fetch_assoc($MilieuDroite);
$totalRows_MilieuDroite = mysql_num_rows($MilieuDroite);
$LocalYBD = $row_Recordset1['LocalY']-1 ;
$LocalXBD = $row_Recordset1['LocalX']+1 ;
mysql_select_db($database_iloled, $iloled);
$query_BasDroite = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYBD, "int"),GetSQLValueString($LocalXBD, "int"));
$BasDroite = mysql_query($query_BasDroite, $iloled) or die(mysql_error());
$row_BasDroite = mysql_fetch_assoc($BasDroite);
$totalRows_BasDroite = mysql_num_rows($BasDroite);
$LocalYBM = $row_Recordset1['LocalY']-1 ;
$LocalXBM = $row_Recordset1['LocalX'] ;
mysql_select_db($database_iloled, $iloled);
$query_BasMilieu = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYBM, "int"),GetSQLValueString($LocalXBM, "int"));
$BasMilieu = mysql_query($query_BasMilieu, $iloled) or die(mysql_error());
$row_BasMilieu = mysql_fetch_assoc($BasMilieu);
$totalRows_BasMilieu = mysql_num_rows($BasMilieu);
$LocalYBG = $row_Recordset1['LocalY']-1 ;
$LocalXBG = $row_Recordset1['LocalX']-1 ;
mysql_select_db($database_iloled, $iloled);
$query_BasGauche = sprintf("SELECT Type FROM `Map` WHERE PosiY = %s AND PosiX = %s", GetSQLValueString($LocalYBG, "int"),GetSQLValueString($LocalXBG, "int"));
$BasGauche = mysql_query($query_BasGauche, $iloled) or die(mysql_error());
$row_BasGauche = mysql_fetch_assoc($BasGauche);
$totalRows_BasGauche = mysql_num_rows($BasGauche);
mysql_select_db($database_iloled, $iloled);
$query_Recordset3 = sprintf("SELECT Nom FROM Personnages WHERE LocalX = %s AND LocalY = %s", GetSQLValueString($row_Recordset1['LocalX'], "int"),GetSQLValueString($row_Recordset1['LocalY'], "int") );
$Recordset3 = mysql_query($query_Recordset3, $iloled) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
/* test de changement de position */
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
/* Aller en haut */
$localYetun = $row_Recordset1['LocalY']+1 ;
if ((isset($_POST["Allerenhaut"])) && ($_POST["Allerenhaut"] == "AllerEnHaut")) {
$updateSQL = sprintf("UPDATE Personnages SET LocalY=%s WHERE Nom=%s",
GetSQLValueString($localYetun, "int"),
GetSQLValueString($row_Recordset1['Nom'], "text"));
mysql_select_db($database_iloled, $iloled);
$Result1 = mysql_query($updateSQL, $iloled) or die(mysql_error());
$updateGoTo = "map.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
/* Aller à gauche */
$localXmoinsun = $row_Recordset1['LocalX']-1 ;
if ((isset($_POST["Alleragauche"])) && ($_POST["Alleragauche"] == "AllerAGauche")) {
$updateSQL = sprintf("UPDATE Personnages SET LocalX=%s WHERE Nom=%s",
GetSQLValueString($localXmoinsun, "int"),
GetSQLValueString($row_Recordset1['Nom'], "text"));
mysql_select_db($database_iloled, $iloled);
$Result1 = mysql_query($updateSQL, $iloled) or die(mysql_error());
$updateGoTo = "map.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
/* Aller à droite */
$localXetun = $row_Recordset1['LocalX']+1 ;
if ((isset($_POST["Alleradroite"])) && ($_POST["Alleradroite"] == "AllerADroite")) {
$updateSQL = sprintf("UPDATE Personnages SET LocalX=%s WHERE Nom=%s",
GetSQLValueString($localXetun, "int"),
GetSQLValueString($row_Recordset1['Nom'], "text"));
mysql_select_db($database_iloled, $iloled);
$Result1 = mysql_query($updateSQL, $iloled) or die(mysql_error());
$updateGoTo = "map.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
/* Aller en bas */
$localYmoinsun = $row_Recordset1['LocalY']-1 ;
if ((isset($_POST["Allerenbas"])) && ($_POST["Allerenbas"] == "AllerEnBas")) {
$updateSQL = sprintf("UPDATE Personnages SET LocalY=%s WHERE Nom=%s",
GetSQLValueString($localYmoinsun, "int"),
GetSQLValueString($row_Recordset1['Nom'], "text"));
mysql_select_db($database_iloled, $iloled);
$Result1 = mysql_query($updateSQL, $iloled) or die(mysql_error());
$updateGoTo = "http://www.luxobscura.org/map.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
<p><img src="map/<?php echo $row_HautGauche['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_HautMilieu['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_HautDroite['Type'] ;?>.gif" width="32" height="32"><br>
<img src="map/<?php echo $row_MilieuGauche['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_Milieu['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_MilieuDroite['Type'] ;?>.gif" width="32" height="32"><br>
<img src="map/<?php echo $row_BasGauche['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_BasMilieu['Type'] ;?>.gif" width="32" height="32"><img src="map/<?php echo $row_BasDroite['Type'] ;?>.gif" width="32" height="32">
</p>
</p>
<br>
<?php echo $row_Recordset1['Nom']; ?>, vous êtes positioné<?php if($row_Recordset1['Genre'] == 0) {?>e<?php } ?> en X: <?php echo $row_Recordset1['LocalX']; ?> Y: <?php echo $row_Recordset1['LocalY']; ?><br />
<form action="<?php echo $editFormAction; ?>" method="post" name="AllerEnHaut" id="AllerEnHaut"><br /><input type="hidden" name="Allerenhaut" value="AllerEnHaut" /><input type="submit" value="Aller en haut" /></form>
<form action="<?php echo $editFormAction; ?>" method="post" name="AllerAGauche" id="AllerAGauche"><br />
<input type="hidden" name="Alleragauche" value="AllerAGauche" />
<input type="submit" value="Aller à gauche" />
</form>
<form action="<?php echo $editFormAction; ?>" method="post" name="AllerADroite" id="AllerADroite"><br />
<input type="hidden" name="Alleradroite" value="AllerADroite" />
<input type="submit" value="Aller à droite" />
</form>
<form action="<?php echo $editFormAction; ?>" method="post" name="AllerEnBas" id="AllerEnBas"><br />
<input type="hidden" name="Allerenbas" value="AllerEnBas" />
<input type="submit" value="Aller en bas" />
</form>
<?php
mysql_free_result($Recordset1);
mysql_free_result($MilieuDroite);
mysql_free_result($Milieu);
mysql_free_result($MilieuGauche);
mysql_free_result($BasDroite);
mysql_free_result($BasMilieu);
mysql_free_result($BasGauche);
mysql_free_result($Recordset3);
mysql_free_result($Recordset2);
mysql_free_result($HautDroite);
mysql_free_result($HautMilieu);
mysql_free_result($HautGauche);
?> |
Partager