Beispiel #1
0
/**
 * Authentifie le numéro de troll et un mot de pas hashé contre la base de donnée, et positionne les variables de
 * session en conséquence.
 * @return true si l'authentification a réussie
 * @return false si elle a échouée (mot de passe incorrecte ou troll inexistant)
 */
function userLogin($numTroll, $md5pass)
{
    global $db_vue_rm;
    // On regarde si le troll existe dans la base de données
    $sql = "SELECT pass_outils_troll, guilde_troll, nom_troll";
    $sql .= " FROM trolls WHERE id_troll={$numTroll}";
    $result = mysql_query($sql, $db_vue_rm);
    if ($result == false) {
        return false;
    }
    list($DBmd5pass, $DBAuthGuilde, $DBNomTroll) = mysql_fetch_array($result);
    if (mysql_affected_rows() > 0 && $DBmd5pass != "" && $DBmd5pass == $md5pass) {
        $_SESSION['AuthTroll'] = $numTroll;
        $_SESSION['Auth'] = $md5pass;
        $_SESSION['AuthGuilde'] = $DBAuthGuilde;
        $_SESSION['AuthNomTroll'] = $DBNomTroll;
        if (userIsGuilde() || userIsGroupSpec()) {
            // Controle de l'administrateur
            // Remplis la variable de session
            if (isDbAdministration()) {
                $_SESSION['admin'] = "authenticated";
            } else {
                $_SESSION['admin'] = "notauthorized";
            }
            $_SESSION['Status'] = "authentified";
            setcookie("cookie_id_troll", $_SESSION['AuthTroll'], time() + 31536000);
            // on garde le cookie 1 an
            enregistre_connection($_SESSION['AuthTroll']);
            return true;
        }
    }
    return false;
}
Beispiel #2
0
function addItemMenu($rm_only, $is_parent, $pos, $name, $tip, $link = "", $target = "")
{
    $flag = true;
    if ($rm_only) {
        if (userIsGuilde() || userIsGroupSpec()) {
            $flag = false;
        }
    } else {
        $flag = false;
    }
    if (!$flag) {
        if (!$is_parent) {
            echo "menu.addSubItem('{$pos}','{$name}','{$tip}','{$link}','{$target}');";
            //echo "menu.addSubItem('$pos','$name','$tip','$link','$target');";
            //echo "ssmItems[$pos]=[\"$name\", \"$link\", \"$target\", \"$colspan\", \"$endrow\"];";
            //	$pos++;
        } else {
            //echo "menu.addItem('$pos', '$name', '$tip',  null, null);";
            echo "menu.addItem('{$pos}', '{$name}', '{$tip}',  null, null);";
        }
    }
    return $pos;
}
function TestSecurite()
{
    require "conf.php";
    // CONNEXION MYSQL
    $db_link = @mysql_connect($serveur, $user, $password);
    if (!$db_link) {
        echo "Connexion impossible à la base de données <b>{$sql_bdd}</b> sur le serveur <b>{$sql_server}</b><br>Vérifiez les paramètres du fichier conf.php3";
        exit;
    }
    mysql_select_db($bdd);
    if ($_SESSION['AuthTroll'] > 0 && userIsGuilde() || $_SESSION['AuthTroll'] > 0 && userIsGroupSpec()) {
        //Le troll est connecté chez R&M
        $sql = "select id_troll from ggc_troll where id_troll='{$_SESSION['AuthTroll']}'";
        $result = mysql_query($sql, $db_link);
        echo mysql_error();
        list($nb) = mysql_fetch_array($result);
        if ($nb > 0) {
            //Le troll est inscrit c'est bon
            $id_troll = $_SESSION[AuthTroll];
            return $id_troll;
        } else {
            //Le troll n'est pas inscrit au GGC-> vers page d'inscription
            echo "<script language='JavaScript'>";
            echo "document.location.href='inscription.php'";
            echo "</script>";
            exit;
        }
        mysql_free_result($requete);
    } else {
        //Le troll n'est pas connecté R&M
        echo "<script language='JavaScript'>";
        echo "document.location.href='erreur.php'";
        echo "</script>";
        exit;
    }
}
Beispiel #4
0
<?php

include_once "../functions_auth.php";
include_once "../admin_functions_db.php";
include_once "firemago_functions.php";
if (userIsGuilde() || userIsGroupSpec()) {
    $vue = $_REQUEST["Vue"];
    $X = $_REQUEST["X"];
    $Y = $_REQUEST["Y"];
    $N = $_REQUEST["N"];
    echo "try { \n";
    echo "\n\t\t\t\tfunction piege(){\n\t\t\t\t\t\n\t\t\t\t\t\$('.fm_piege').each(function(index) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t\$(this).css('background-color',colorUrg);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif ( \$(this).css('display') == 'none' )\n\t\t\t\t\t\t\t\$(this).show();\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\$(this).hide();\n\t\t\t\t\t\t\n\t\t\t\t\t});\t\n\t\t\t\t\n\t\t\t\t}\t\n\t\t\t\t\t\n\t\t\t";
    echo "var anchorPlace = \$('html>body>table>tbody>tr:eq(1)>td>table>tbody>tr>td:eq(1)>p>table:eq(4)>tbody>tr:eq(1)');";
    $sql = "SELECT * FROM ggc_piege WHERE abs(X-" . intval($X) . ") < 6  AND abs(Y-" . intval($Y) . ") < 6 AND abs(N-" . intval($N) . ") < 6;";
    $pieges = mysql_query($sql, $db_vue_rm);
    if (mysql_error()) {
        echo "alert('" . mysql_error() . "');";
    }
    if (mysql_num_rows($pieges) > 0) {
        while ($piege = mysql_fetch_assoc($pieges)) {
            $dist = getDist($X, $Y, $N, $piege["X"], $piege["Y"], $piege["N"]);
            echo "anchorPlace.after('<tr style=\"background-color:red;\"><td width=\"75\">" . $dist . "</td><td>Piège à " . $piege["type"] . "</td><td>" . addslashes($piege["date"] . " " . $piege["texte"]) . "</td><td align=\"center\">" . $piege["X"] . "</td><td align=\"center\">" . $piege["Y"] . "</td><td align=\"center\">" . $piege["N"] . "</td></tr>');";
            if ($dist < 2) {
                echo "\n\t\t\t\t\t\t\t\tif ( \$('#table_piege').length == 0 )\n\t\t\t\t\t\t\t\t\t\$('html>body>table>tbody>tr:eq(1)>td>table>tbody>tr>td:eq(1)>p>table:eq(0)').before('<table id=\"table_piege\" class=\"mh_tdborder\" width=\"50%\"><tr style=\"background-color:red;\" onClick=\"piege();\" onMouseOver=\"this.style.cursor = \\'pointer\\';\"<td align=\"center\" colspan=\"6\">ATTENTION => Pièges à une cases de votre Troll !</td></tr></table><br/>');\n\t\t\t\t\t\t\t ";
                echo "\$(\"#table_piege\").append('<tr class=\"fm_piege\" style=\"display:none\" align=\"center\"><td>Dist : " . $dist . "</td><td>Type : " . $piege["type"] . "</td><td>" . addslashes($piege["date"] . " " . $piege["texte"]) . "</td><td>X:" . $piege["X"] . "</td><td>Y:" . $piege["Y"] . "</td><td>N" . $piege["N"] . "</td></tr>');";
            }
        }
    }
    echo "} catch ( e ) { error ( e, 'Piege error' ); } \n";
}
Beispiel #5
0
function afficherRechercheTrollsResultat($id_troll, $nom_troll, $race_troll, $nom_guilde, $niveau_troll, $is_tk_troll, $is_wanted_troll, $is_venge_troll, $x_troll, $y_troll, $z_troll, $limite, $statut_troll, $statut_guilde, $lesTrolls = "")
{
    if (!isset($lesTrolls)) {
        $lesTrolls = selectDbRechercheTrolls($id_troll, $nom_troll, $race_troll, $nom_guilde, $niveau_troll, $is_tk_troll, $is_wanted_troll, $is_venge_troll, $x_troll, $y_troll, $z_troll, $limite, $statut_troll, $statut_guilde);
    }
    $nbTrolls = count($lesTrolls);
    ?>
 <br>
   <table  border='0' cellpadding='0' cellspacing='0' class='mh_tdborder' align='center'width='100%'>
     <tr class='mh_tdtitre'>
      <td align='center' colspan='15'>
				<?php 
    echo "R&eacute;sultat de la recherche de trolls : {$nbTrolls} trouv&eacute;(s). Position d&eacute;part : ";
    echo "X={$x_troll}/Y={$y_troll}/Z={$z_troll}";
    ?>
			</td>
			</tr>
			<?php 
    if ($nbTrolls == 0) {
        echo "</table>";
        return;
    }
    ?>
      <tr class='mh_tdtitre'>
			<?php 
    if (is_numeric($x_troll) && is_numeric($y_troll) && is_numeric($z_troll)) {
        echo "<td>Distance en PA</td>";
    }
    ?>
				<td>Nom</td>
				<td>Guilde</td>
				<td>Race</td>
				<td>Niveau</td>
				<td>Tk</td>
				<td>Wanted</td>
				<td>Chati&eacute;</td>
				<td>Diplo Troll</td>
				<td>Diplo Guilde</td>
				<td colspan=3>Position</td>
				<td>Date de Mise &agrave; jour </td>
				<td>Acc&egrave;s </td>
				</tr>
<?php 
    usort($lesTrolls, "callbackSortDistancePa");
    while (list($key, $res) = each($lesTrolls)) {
        $i++;
        if ($res[maj_groupe_spec_troll] == 'oui' && !userIsGroupSpec()) {
            $res[distance_pa] = '?';
            $res[x_troll] = '?';
            $res[y_troll] = '?';
            $res[z_troll] = '?';
        }
        echo "<tr class='mh_tdpage'>";
        if (is_numeric($x_troll) && is_numeric($y_troll) && is_numeric($z_troll)) {
            echo "<td >{$res['distance_pa']}</a></td>";
        }
        echo "<td>";
        afficherLien("troll", "fiche", $res[id_troll], "", "", "", htmlentities($res[nom_troll]) . " ({$res['id_troll']})");
        echo "</td>";
        $lien_guilde = "href='/engine_view.php?guilde={$res['id_guilde']}'";
        echo "<td ><a {$lien_guilde}>" . htmlentities($res[nom_guilde]) . "</a></td>";
        echo "<td align=center>{$res['race_troll']}</td>";
        echo "<td align=center>{$res['niveau_troll']}</td>";
        echo "<td align=center>{$res['is_tk_troll']}</td>";
        echo "<td align=center>{$res['is_wanted_troll']}</td>";
        echo "<td align=center>{$res['is_venge_troll']}</td>";
        echo "<td align=center>{$res['statut_troll']}</td>";
        echo "<td align=center>{$res['statut_guilde']}</td>";
        echo "<td width=10>X={$res['x_troll']}</td>";
        echo "<td width=10>Y={$res['y_troll']}</td>";
        echo "<td width=40>N={$res['z_troll']}</td>";
        echo "<td>{$res['date_troll']}";
        if ($res['is_seen_troll'] == 'non') {
            $title = "Disparu depuis le " . date("d/m H:i", $res['date_troll']) . "";
            echo "<img src='images/puce_disparu.gif' title='{$title}'>";
        }
        echo "</td>";
        echo "<td>";
        afficherLien("troll", "fiche", $res[id_troll]);
        afficherLien("troll", "vue2d", $res[id_troll]);
        afficherLien("troll", "gps", $res[id_troll]);
        afficherLien("troll", "mh_evenements", $res[id_troll]);
        echo "</td>";
        echo "</tr>";
        if ($i > 299) {
            echo "<tr><td colspan='10'><h2><b>Il n'y a que les 300 premiers r&eacute;sultats d'affich&eacute;s, affinez votre recherche si vous voulez...</b></h2></td></tr>";
            break;
        }
    }
    echo "</table>";
    echo "</td></tr></table><br>";
}
Beispiel #6
0
function parseZone($id_troll, $cX = '', $cY = '', $cZ = '', $nCasesVue = '', $taille_distance_pa = "", $trolls_disparus)
{
    global $db_vue_rm;
    global $DEV, $quadrillage, $quadrillage_delai_max;
    if ($DEV) {
        echo "DEBUG parseZone({$id_troll},{$cX},{$cY},{$cZ},{$nCasesVue},{$taille_distance_pa},{$trolls_disparus}) entré<br>\n";
    }
    if ($taille_distance_pa == "" || $nCasesVue > $taille_distance_pa) {
        $taille = $nCasesVue;
    } else {
        $taille = $taille_distance_pa;
    }
    //Labyrinthe ?
    $laby = 0;
    if ($cZ == '') {
        $sql = "SELECT x_troll, y_troll, z_troll, maj_groupe_spec_troll, est_labyrinthe_troll";
        $sql .= " FROM trolls";
        $sql .= " WHERE id_troll={$id_troll}";
        if ($DEV) {
            echo "DEBUG parseZone() {$sql} <br>";
        }
        $res = mysql_query($sql, $db_vue_rm);
        echo mysql_error();
        if ($res != '') {
            list($X, $Y, $Z, $grpspec, $laby) = mysql_fetch_array($res);
        }
        if ($DEV) {
            echo "DEBUG parseZone() Le troll à la position {$X},{$Y},{$Z}<br>\n";
        }
        if ($grpspec == 'oui' && !userIsGroupSpec()) {
            $X = 0;
            $Y = 0;
            $Z = 0;
        }
    } else {
        $X = $cX;
        $Y = $cY;
        $Z = $cZ;
    }
    $miniX = $X - $taille;
    $maxiX = $X + $taille;
    $miniY = $Y - $taille;
    $maxiY = $Y + $taille;
    $miniZ = $Z - ceil($taille / 2);
    $maxiZ = $Z + ceil($taille / 2);
    $miniXv = $X - $nCasesVue;
    $maxiXv = $X + $nCasesVue;
    $miniYv = $Y - $nCasesVue;
    $maxiYv = $Y + $nCasesVue;
    $miniZv = $Z - ceil($nCasesVue / 2);
    $maxiZv = $Z + ceil($nCasesVue / 2);
    /* Brouillard de guerre */
    #$sql = "SELECT id_troll_quad, UNIX_TIMESTAMP(last_seen_quad) last_seen_quad, ";
    #$sql .= " TO_DAYS(NOW()) - TO_DAYS(last_seen_quad) delais, x_min_quad, x_max_quad, y_min_quad,";
    #$sql .= " y_max_quad ,	z_min_quad ,	z_max_quad";
    #$sql .= " FROM quadrillage";
    #$sql .= " WHERE ";
    #$sql .= " x_min_quad <= $maxiX";
    #$sql .= " AND x_max_quad >= $miniX";
    #$sql .= " AND y_min_quad <= $maxiY";
    #$sql .= " AND y_max_quad >= $miniY";
    #$sql .= " AND z_min_quad <= $maxiZ";
    #$sql .= " AND z_max_quad >= $miniZ";
    #if ($DEV) echo "DEBUG parseZone() QUADRILLAGE $sql <br>";
    #$res=mysql_query($sql, $db_vue_rm);
    #echo mysql_error();
    #if ($nCasesVue <= 10)	{
    #		while ($objet = mysql_fetch_assoc($res)) {
    #			for ($i=$miniXv; $i<=$maxiXv; $i++) {
    #				for ($j=$miniYv; $j<=$maxiYv; $j++) {
    #					for ($k=$miniZv; $k<=$maxiZv; $k++) {
    #						$flag = false;
    #
    #						if ( ($objet['x_min_quad'] <= $i) &&  ($objet['x_max_quad'] >= $i)
    #							 &&($objet['y_min_quad'] <= $j) &&  ($objet['y_max_quad'] >= $j)
    #							 &&($objet['z_min_quad'] <= $k) &&  ($objet['z_max_quad'] >= $k)
    #							 )
    #					  {
    #
    #								if ($quadrillage[$i][$j][$k]['delais'] == "") {
    #									$flag = true;
    #								} elseif ($quadrillage[$i][$j][$k]['last_seen'] <= $objet['last_seen_quad']) {
    #									$flag = true;
    #								}
    #								if ($flag) {
    #									$quadrillage[$i][$j][$k]['delais'] = $objet['delais'];
    #									$quadrillage[$i][$j][$k]['last_seen'] = $objet['last_seen_quad'];
    #									$quadrillage[$i][$j][$k]['id_troll'] = $objet['id_troll_quad'];
    #								}
    #						 }
    #					}
    #				}
    #			}
    #		}
    #	}
    # Labyrinthe
    // $labyrinthe="";
    if ($laby == 1) {
        $sql = "SELECT x_labyrinthe, y_labyrinthe, z_labyrinthe, type_labyrinthe ";
        $sql .= " FROM labyrinthe";
        $sql .= " WHERE x_labyrinthe >= {$miniX}";
        $sql .= " AND x_labyrinthe <= {$maxiX}";
        $sql .= " AND y_labyrinthe >= {$miniY}";
        $sql .= " AND y_labyrinthe <= {$maxiY}";
        $sql .= " AND z_labyrinthe >= {$miniZ}";
        $sql .= " AND z_labyrinthe <= {$maxiZ}";
        if ($DEV) {
            echo "DEBUG parseZone() labyrinthe {$sql} <br>";
        }
        $res = mysql_query($sql, $db_vue_rm);
        echo mysql_error();
        while (list($oX, $oY, $oZ, $oType) = mysql_fetch_array($res)) {
            $distance_pa = calcPA($X, $Y, $Z, $oX, $oY, $oZ);
            $objet = array(type => $oType, z => $oZ, x => $oX, y => $oY, distance_pa => $distance_pa);
            $labyrinthe[$oX + 100][$oY + 100][] = $objet;
        }
    }
    # TROLLS
    $date_less_5days = date("Y-m-d H-i-s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 5, date("Y")));
    // statut_guilde 'neutre','tk','ennemie','amie','alliée'
    $sql = "SELECT x_troll, y_troll, z_troll, ";
    $sql .= " id_troll, nom_troll, race_troll, niveau_troll, guilde_troll,";
    $sql .= " malade_troll, nom_guilde, statut_guilde,";
    $sql .= " is_tk_troll, is_wanted_troll, is_seen_troll, UNIX_TIMESTAMP(date_troll) as date_troll";
    $sql .= " FROM trolls,guildes";
    $sql .= " WHERE x_troll >= {$miniX}";
    $sql .= " AND x_troll <= {$maxiX}";
    $sql .= " AND y_troll >= {$miniY}";
    $sql .= " AND y_troll <= {$maxiY}";
    $sql .= " AND z_troll >= {$miniZ}";
    $sql .= " AND z_troll <= {$maxiZ}";
    $sql .= " AND est_labyrinthe_troll = '{$laby}'";
    $sql .= " AND guilde_troll = id_guilde";
    if ($trolls_disparus == "oui") {
        $sql .= " AND (is_seen_troll = 'oui'";
        $sql .= " OR (is_seen_troll = 'non' AND date_troll >'{$date_less_5days}'))";
    } else {
        $sql .= " AND is_seen_troll = 'oui'";
    }
    /*if (!userIsGroupSpec()){
    		$sql .= " AND maj_groupe_spec_troll <> 'oui'";
    	}*/
    if ($DEV) {
        echo "DEBUG parseZone() TROLLS {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($tX, $tY, $tZ, $tId, $nom, $race, $level, $IdGuilde, $malade, $nom_guilde, $diplomatie, $is_tk, $is_wanted, $is_seen, $date_troll) = mysql_fetch_array($res)) {
        if ($malade == '-') {
            $malade = "";
        }
        $distance_pa = calcPA($X, $Y, $Z, $tX, $tY, $tZ);
        $objet = array(id => $tId, nom => $nom, z => $tZ, race => $race, level => $level, guilde => $nom_guilde, x => $tX, y => $tY, tk => $is_tk, wanted => $is_wanted, malade => $malade, diplomatie => $diplomatie, guilde_troll => $IdGuilde, is_seen => $is_seen, date_troll => $date_troll, distance_pa => $distance_pa);
        $trolls[$tX + 100][$tY + 100][] = $objet;
    }
    # STREUMS
    $sql = "SELECT x_monstre, y_monstre, z_monstre, ";
    $sql .= " id_monstre, nom_monstre";
    $sql .= " FROM monstres";
    $sql .= " WHERE x_monstre\t >= {$miniX}";
    $sql .= " AND x_monstre <= {$maxiX}";
    $sql .= " AND y_monstre >= {$miniY}";
    $sql .= " AND y_monstre <= {$maxiY}";
    $sql .= " AND z_monstre >= {$miniZ}";
    $sql .= " AND z_monstre <= {$maxiZ}";
    $sql .= " AND is_seen_monstre = 'oui'";
    $sql .= " AND est_labyrinthe_monstre = '{$laby}'";
    if ($DEV) {
        echo "DEBUG parseZone() MONSTRES {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($mX, $mY, $mZ, $mId, $mNom) = mysql_fetch_array($res)) {
        unset($monstre);
        $mNom = stripslashes(stripslashes($mNom));
        $tab = getInfoFromMonstre($mNom);
        $monstre[famille] = $tab['famille'];
        $monstre[race] = $tab['race'];
        $monstre[niveau] = $tab['niv'];
        // niveau estimé
        $infos_monstre = $tab;
        $caracs_moyennes = SelectCaracMoyMonstre($tab['id_race'], $tab['id_template'], $tab['id_age']);
        //if($caracs_moyennes['niv']!='?' && $caracs_moyennes['niv']!='')
        //	$monstre[niveau]=$caracs_moyennes['niv']; // niveau calculé
        //else
        //	$monstre[niveau] = $tab['niv']; // niveau estimé / Juste pour info ici
        $tab_cdm = "";
        $monstre[connu] = 'non';
        if ($infos_monstre[id_template] != "" && $infos_monstre[id_age] != "") {
            $tab_cdm = SelectCdMs($infos_monstre[race], $infos_monstre[id_template], $infos_monstre[id_age], "-1", "-1", true);
            if (count($tab_cdm) > 0) {
                $monstre[connu] = 'oui';
            }
            if ($taille <= 15) {
                $monstre[tab_cdm] = $tab_cdm;
                $capacites_speciales = SelectCapSpe($tab['id_race'], $tab['id_template'], $tab['id_age']);
            }
        }
        $id_troll_gowap = "";
        $nom_troll = "";
        // On regarde si le monstre est un gowap de la guilde
        if (preg_match("/Gowap/", $mNom)) {
            $sql = " SELECT nom_troll, id_troll_gowap";
            $sql .= " FROM gowaps, trolls";
            $sql .= " WHERE id_troll_gowap = id_troll";
            $sql .= " AND id_gowap = {$mId}";
            if ($DEV) {
                echo "DEBUG MONSTRES {$sql} <br>";
            }
            $result2 = mysql_query($sql, $db_vue_rm);
            echo mysql_error();
            if (mysql_num_rows($result2) > 0) {
                $res2 = mysql_fetch_assoc($result2);
                $id_troll_gowap = $res2[id_troll_gowap];
                $nom_troll = $res2[nom_troll];
            }
        }
        // On regarde si le monstre est recherché (composant)
        $recherche = "";
        $sql = " SELECT id_composant, priorite_composant, id_race_composant";
        $sql .= " FROM composants";
        $sql .= " WHERE id_race_composant = '" . addslashes($monstre[race]) . "'";
        if ($DEV) {
            echo "DEBUG MONSTRES {$sql} <br>";
        }
        $result2 = mysql_query($sql, $db_vue_rm);
        echo mysql_error();
        if (mysql_num_rows($result2) > 0) {
            $res2 = mysql_fetch_assoc($result2);
            $recherche = $res2[priorite_composant];
        }
        $distance_pa = calcPA($X, $Y, $Z, $mX, $mY, $mZ);
        $objet = array(id => $mId, nom => $mNom, z => $mZ, x => $mX, y => $mY, race => $monstre[race], famille => $monstre[famille], niveau => $monstre[niveau], connu => $monstre[connu], recherche => $recherche, id_troll_gowap => $id_troll_gowap, nom_troll => $nom_troll, infos_monstre => $infos_monstre, caracs_moyennes => $caracs_moyennes, capacites_speciales => $capacites_speciales, tab_cdm => $monstre[tab_cdm], distance_pa => $distance_pa);
        $streums[$mX + 100][$mY + 100][] = $objet;
    }
    # Mythiques
    $sql = "SELECT x_monstre, y_monstre, z_monstre, ";
    $sql .= " id_monstre, nom_monstre";
    $sql .= " FROM monstres, best_races";
    $sql .= " WHERE nom_monstre like CONCAT('%',nom_race,'%')";
    $sql .= " AND commentaire like 'Mythique'";
    $sql .= " AND is_seen_monstre = 'oui'";
    if ($DEV) {
        echo "DEBUG parseZone() MYTHIQUES {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($oX, $oY, $oZ, $oId, $oNom) = mysql_fetch_array($res)) {
        $distance_pa = calcPA($X, $Y, $Z, $oX, $oY, $oZ);
        $objet = array(id => $oId, nom => $oNom, z => $oZ, x => $oX, y => $oY, distance_pa => $distance_pa);
        $mythiques[$oX + 100][$oY + 100][] = $objet;
    }
    # CAME
    $sql = "SELECT x_tresor, y_tresor, z_tresor, ";
    $sql .= " id_tresor, nom_tresor";
    $sql .= " FROM tresors";
    $sql .= " WHERE x_tresor >= {$miniX}";
    $sql .= " AND x_tresor <= {$maxiX}";
    $sql .= " AND y_tresor >= {$miniY}";
    $sql .= " AND y_tresor <= {$maxiY}";
    $sql .= " AND z_tresor >= {$miniZ}";
    $sql .= " AND z_tresor <= {$maxiZ}";
    $sql .= " AND est_labyrinthe_tresor = '{$laby}'";
    if ($DEV) {
        echo "DEBUG parseZone() TRESOR {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($oX, $oY, $oZ, $oId, $oNom) = mysql_fetch_array($res)) {
        $distance_pa = calcPA($X, $Y, $Z, $oX, $oY, $oZ);
        $objet = array(id => $oId, nom => $oNom, z => $oZ, x => $oX, y => $oY, distance_pa => $distance_pa);
        $came[$oX + 100][$oY + 100][] = $objet;
    }
    # LIEUX
    $sql = "SELECT x_lieu, y_lieu, z_lieu,";
    $sql .= " id_lieu, nom_lieu";
    $sql .= " FROM lieux";
    $sql .= " WHERE x_lieu >= {$miniX}";
    $sql .= " AND x_lieu <= {$maxiX}";
    $sql .= " AND y_lieu >= {$miniY}";
    $sql .= " AND y_lieu <= {$maxiY}";
    $sql .= " AND z_lieu >= {$miniZ}";
    $sql .= " AND z_lieu <= {$maxiZ}";
    $sql .= " AND est_labyrinthe_lieu = '{$laby}'";
    if ($DEV) {
        echo "DEBUG parseZone() LIEU {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($lX, $lY, $lZ, $lId, $lNom) = mysql_fetch_array($res)) {
        $id_info = "";
        $nom_info = "";
        $statut_info = "";
        $type_info = "";
        // On regarde si la taniere est une tanière de la guilde
        //		if (preg_match("/Tani.re de/",$lNom)) {
        if (preg_match("/.*\\((\\d+)\\)/", $lNom, $match)) {
            if (is_numeric($match[1])) {
                $sql = " SELECT nom_guilde, statut_guilde";
                $sql .= " FROM guildes";
                $sql .= " WHERE id_guilde = {$match['1']}";
                $result2 = mysql_query($sql, $db_vue_rm);
                echo mysql_error();
                if (mysql_num_rows($result2) > 0) {
                    $res2 = mysql_fetch_assoc($result2);
                    $id_info = $match[1];
                    $nom_info = $res2[nom_guilde];
                    $statut_info = $res2[statut_guilde];
                    if ($match[1] == ID_GUILDE) {
                        $statut_info = "guilde";
                    } else {
                        $statut_info = $res2[statut_guilde];
                    }
                    $type_info = "guilde";
                }
            }
        }
        // Recherche du statut dans les trolls
        if (preg_match("/Tani.re de .*\\((\\d+)\\)/", $lNom, $match)) {
            if (is_numeric($match[1])) {
                $sql = " SELECT nom_troll, id_troll, statut_troll, statut_guilde";
                $sql .= " FROM trolls, guildes";
                $sql .= " WHERE id_troll = {$match['1']}";
                $sql .= " AND guilde_troll = id_guilde";
                $result2 = mysql_query($sql, $db_vue_rm);
                echo mysql_error();
                if (mysql_num_rows($result2) > 0) {
                    $res2 = mysql_fetch_assoc($result2);
                    $id_info = $res2[id_troll];
                    $nom_info = $res2[nom_troll];
                    if ($res2[statut_troll] != "") {
                        $statut_info = $res2[statut_troll];
                    } else {
                        $statut_info = $res2[statut_guilde];
                    }
                    $type_info = "troll";
                }
            }
        }
        // Recherche dans les tanières de guildes
        if (preg_match("/Tani.re de/", $lNom)) {
            $sql = " SELECT nom_troll, id_troll_taniere";
            $sql .= " FROM tanieres, trolls";
            $sql .= " WHERE id_troll_taniere = id_troll";
            $sql .= " AND id_taniere = {$lId}";
            if ($DEV) {
                echo "DEBUG LIEUX tanieres  {$sql} <br>";
            }
            $result2 = mysql_query($sql, $db_vue_rm);
            echo mysql_error();
            if (mysql_num_rows($result2) > 0) {
                $res2 = mysql_fetch_assoc($result2);
                $id_info = $res2[id_troll_taniere];
                $nom_info = $res2[nom_troll];
                $statut_info = "guilde";
                $type_info = "troll";
            }
        }
        $distance_pa = calcPA($X, $Y, $Z, $lX, $lY, $lZ);
        $objet = array(id => $lId, nom => $lNom, z => $lZ, x => $lX, y => $lY, id_info => $id_info, nom_info => $nom_info, statut_info => $statut_info, is_guilde => $is_guilde, type_info => $type_info, distance_pa => $distance_pa);
        $lieux[$lX + 100][$lY + 100][] = $objet;
    }
    # CHAMPIGNONS
    $sql = "SELECT x_champi, y_champi, z_champi,";
    $sql .= " id_champi, nom_champi";
    $sql .= " FROM champignons";
    $sql .= " WHERE x_champi >= {$miniX}";
    $sql .= " AND x_champi <= {$maxiX}";
    $sql .= " AND y_champi >= {$miniY}";
    $sql .= " AND y_champi <= {$maxiY}";
    $sql .= " AND z_champi >= {$miniZ}";
    $sql .= " AND z_champi <= {$maxiZ}";
    $sql .= " AND is_seen_champi ='oui'";
    $sql .= " AND est_labyrinthe_champi = '{$laby}'";
    if ($DEV) {
        echo "DEBUG parseZone() CHAMPI {$sql} <br>";
    }
    $res = mysql_query($sql, $db_vue_rm);
    echo mysql_error();
    while (list($cX, $cY, $cZ, $cId, $cNom) = mysql_fetch_array($res)) {
        $objet = array(id => $cId, nom => $cNom, z => $cZ, x => $cX, y => $cY);
        $champi[$cX + 100][$cY + 100][] = array(id => $cId, nom => $cNom, z => $cZ);
    }
    # BARONNIES
    /*
    	$sql = "SELECT x_deb_baronnie, y_deb_baronnie, z_deb_baronnie,";
    	$sql .= " x_fin_baronnie, y_fin_baronnie, z_fin_baronnie,";
    	$sql .= " x_trone_baronnie, y_trone_baronnie, z_trone_baronnie,";
    	$sql .= " nom_baronnie, id_baron_baronnie, id_baronnie,nom_troll as nom_baron, ";
    	$sql .= " img_drapeau_baronnie, img_mini_blason_baronnie";
    	$sql .= " FROM baronnies,trolls";
    	$sql .= " WHERE x_fin_baronnie >= $miniX";
    	$sql .= " AND x_deb_baronnie <= $maxiX";
    	$sql .= " AND y_fin_baronnie >= $miniY";
    	$sql .= " AND y_deb_baronnie <= $maxiY";
    	$sql .= " AND z_fin_baronnie >= $miniZ";
    	$sql .= " AND z_deb_baronnie <= $maxiZ";
    	$sql .= " AND id_troll = id_baron_baronnie";
    
    	if ($DEV) echo "DEBUG parseZone() BARONNIE $sql <br>";
    	$res=mysql_query($sql, $db_vue_rm);
    	echo mysql_error();
    
    	while (list(
    				$x_deb_baronnie, $y_deb_baronnie, $z_deb_baronnie,
    				$x_fin_baronnie, $y_fin_baronnie, $z_fin_baronnie,
    				$x_trone_baronnie, $y_trone_baronnie, $z_trone_baronnie,
    				$nom_baronnie, $id_baron_baronnie, $id_baronnie, $nom_baron,
    				$img_drapeau_baronnie, $img_mini_blason_baronnie
    	 			)=mysql_fetch_array($res))
    	{
    
    		$distance_pa = calcPA($X,$Y,$Z,$x_trone_baronnie,$y_trone_baronnie,$z_trone_baronnie);
    
    		$objet=array(
    				x_deb_baronnie=>$x_deb_baronnie, y_deb_baronnie=>$y_deb_baronnie, z_deb_baronnie=>$z_deb_baronnie,
    				x_fin_baronnie=>$x_fin_baronnie, y_fin_baronnie=>$y_fin_baronnie, z_fin_baronnie=>$z_fin_baronnie,
    				x_trone_baronnie=>$x_trone_baronnie, y_trone_baronnie=>$y_trone_baronnie, z_trone_baronnie=>$z_trone_baronnie,
    				nom_baronnie=>$nom_baronnie, id_baron_baronnie=>$id_baron_baronnie, id_baronnie=>$id_baronnie,
    				nom_baron=>$nom_baron, img_drapeau_baronnie=>$img_drapeau_baronnie, 
    				img_mini_blason_baronnie=>$img_mini_blason_baronnie,
    				distance_pa=>$distance_pa
    		);
    								 
    $baronnies[$x_trone_baronnie+100][$y_trone_baronnie+100][]=$objet;
    	}
    */
    /* On retourne la position et le numéro */
    $tab[t_quadrillage] = $quadrillage;
    $tab[t_trolls] = $trolls;
    $tab[t_monstres] = $streums;
    $tab[t_mythiques] = $mythiques;
    $tab[t_lieux] = $lieux;
    $tab[t_tresors] = $came;
    $tab[t_champignons] = $champi;
    $tab[t_laby] = $labyrinthe;
    //$tab[t_baronnies] = $baronnies;
    $tab[max_pa] = $taille_distance_pa;
    $tab[taille_vue] = $nCasesVue;
    $tab[x_position] = $X;
    $tab[y_position] = $Y;
    $tab[z_position] = $Z;
    $tab[trolls_disparus] = $trolls_disparus;
    if ($id_troll != "") {
        $tab[myTroll] = getTroll($id_troll);
    }
    return $tab;
}
Beispiel #7
0
<?php

session_start();
require_once '../top.php';
if (!userIsGroupSpec() && !userIsGuilde()) {
    die("Tu n'es pas R&M !");
}
$array_data = array();
$lignes = is_array($_REQUEST["copiercoller"]) ? explode("!:!", htmlspecialchars_decode(stripslashes(implode("", $_REQUEST["copiercoller"])))) : explode("\n", htmlspecialchars(stripslashes($_REQUEST["copiercoller"])));
$j = 0;
$sorts = 0;
$nb_sorts = 0;
$nb_comps = 0;
foreach ($lignes as $k => $value) {
    $value = trim($value);
    if (empty($value)) {
        unset($lignes[$k]);
    } else {
        $lignes[$k] = $value;
    }
}
foreach ($lignes as $ligne) {
    if (preg_match("#Identifiants.+ (\\d+) - (.+)#", $ligne, $resultat)) {
        $id = trim(htmlspecialchars($resultat[1]));
        $nom = trim($resultat[2]);
    }
    if (preg_match("#[ \t]*Race.+\\.+:(.+)#", $ligne, $resultat)) {
        $array_data["Race"] = trim($resultat[1]);
    }
    if (preg_match("#.+Date Limite d'Action :  (.+)#", $ligne, $resultat)) {
        $troll_dla_en_cours = trim($resultat[1]);
Beispiel #8
0
function initAuth()
{
    global $db_vue_rm;
    if (isset($_SERVER['REQUEST_URI'])) {
        $REQUEST_URI = $_SERVER['REQUEST_URI'];
    } else {
        $REQUEST_URI = "";
    }
    if (isset($_SERVER['HTTP_REFERER'])) {
        $HTTP_REFERER = $_SERVER['HTTP_REFERER'];
    } else {
        $HTTP_REFERER = "";
    }
    if (isset($_REQUEST['CHTROLL'])) {
        $CHTROLL = $_REQUEST['CHTROLL'];
    } else {
        $CHTROLL = "";
    }
    if (isset($_REQUEST['CHPASS'])) {
        $CHPASS = $_REQUEST['CHPASS'];
    } else {
        $CHPASS = "";
    }
    if (isset($_REQUEST['logout'])) {
        $logout = $_REQUEST['logout'];
    } else {
        $logout = "";
    }
    if (isset($_REQUEST['CHTROLL']) && isset($_REQUEST['CHPASS'])) {
        setcookie('autologin', $_REQUEST['autologin'], time() + 365 * 24 * 3600);
        if ($_REQUEST['autologin']) {
            setcookie('num_troll', $_REQUEST['CHTROLL'], time() + 365 * 24 * 3600);
            setcookie('hash_pass_troll', md5($_REQUEST['CHPASS']), time() + 365 * 24 * 3600);
        }
    }
    if (isset($_COOKIE['autologin'])) {
        $autologin = $_COOKIE['autologin'];
    } else {
        $autologin = false;
    }
    if ($autologin) {
        $CHTROLL = $_COOKIE['num_troll'];
        $CHPASS = $_COOKIE['hash_pass_troll'];
    }
    if ($HTTP_REFERER == "" || preg_match("/inc_authent/", $HTTP_REFERER)) {
        $GOTO = $REQUEST_URI;
    } else {
        $GOTO = $HTTP_REFERER;
    }
    if (!preg_match("/inc_authent/", $GOTO) && !preg_match("/index/", $GOTO)) {
        $_SESSION['uri'] = $GOTO;
    } else {
        $_SESSION['uri'] = "/cockpit.php";
    }
    # submit tout frais ?
    if ($CHTROLL > 0 || $CHPASS != "") {
        // Si le mot de passe n'est pas le mot de passe md5
        if (strlen($CHPASS) != 32) {
            // On se débarasse du pass en clair
            $CHPASS = md5($CHPASS);
        }
        $_SESSION['AuthTroll'] = $CHTROLL;
        $_SESSION['Auth'] = $CHPASS;
    }
    # demande de logout ?
    if ($logout) {
        $_SESSION['Status'] = "";
        $_SESSION['AuthTroll'] = "";
        $_SESSION['AuthNomTroll'] = "";
        $_SESSION['AuthGuilde'] = "";
        $_SESSION['Auth'] = "";
        $_SESSION['AuthGroupSpec'] = "";
        session_unset();
        session_destroy();
        setcookie('autologin', false);
        echo "<script language='JavaScript'>";
        echo "document.location.href='/index.php'";
        echo "</script>";
    }
    # Si la personne est déjà authentifiée
    if (isset($_SESSION['Status']) && $_SESSION['Status'] == "authentified") {
        return;
    }
    # Vérification normale
    if (is_numeric($CHTROLL) && $_SESSION['Status'] != "authentified") {
        $md5pass = "******";
        // Initialisation, mais çà sert pas à grand chose ici
        // On regarde si le troll existe dans la base de données
        $sql = "SELECT pass_outils_troll, guilde_troll, nom_troll, nom_rang_troll, groupe_spec_troll";
        $sql .= " FROM trolls WHERE id_troll={$CHTROLL}";
        $result = mysql_query($sql, $db_vue_rm);
        echo mysql_error();
        list($md5pass, $AuthGuilde, $AuthNomTroll, $nom_rang_troll, $groupe_spec_troll) = mysql_fetch_array($result);
        // S'il existe
        if (preg_match("/essai/", $nom_rang_troll)) {
            die("<h2>Vous êtes un troll à l'essai, vous n'avez pas accès aux outils pendant cette période<h2>");
        }
        if (mysql_affected_rows() > 0 && $md5pass != "") {
            // et que le mot de passe est correct
            if ($md5pass == $_SESSION['Auth']) {
                //$_SESSION[AuthTroll]=$_SESSION[AuthTroll]; // pour indiquer ici toutes les valeurs possibles de session
                $_SESSION['AuthGuilde'] = $AuthGuilde;
                $_SESSION['AuthNomTroll'] = $AuthNomTroll;
                $_SESSION['AuthGroupSpec'] = $groupe_spec_troll;
                //$_SESSION[Auth]=$_SESSION[Auth];
            } else {
                setcookie('autologin', false);
                die("<h2><font color='red'>Mot de passe incorrect</font></h2>");
            }
            // S'il n'existe pas dans la base de données
        } else {
            /* Premier connection du troll sur les outils */
            setcookie('autologin', false);
            echo "<script language='JavaScript'>";
            echo "document.location.href='/change_password.php'";
            echo "</script>";
            echo "2 - Si vous n'etes pas redirigé automatiquement, cliquez ici : ";
            echo "<a href='/change_password.php?act=premiere'> Là j'tai dis !! </a>";
        }
        if (userIsGuilde() || userIsGroupSpec()) {
            // Controle de l'administrateur
            // Remplis la variable de session
            if (isDbAdministration()) {
                $_SESSION['admin'] = "authenticated";
            } else {
                $_SESSION['admin'] = "notauthorized";
            }
            $_SESSION['Status'] = "authentified";
            setcookie("cookie_id_troll", $_SESSION['AuthTroll'], time() + 31536000);
            // on garde le cookie 1 an
            enregistre_connection($_SESSION['AuthTroll']);
            redirectAuth();
        } else {
            setcookie('autologin', false);
            session_unset();
            session_destroy();
            die("<h2>Soit vous n'êtes pas un Relais&Mago\n\t\t\t<br> soit le mot de passe est incorrect\n\t\t\t<br> soit c'est votre première connexion (réessayez)<br>\n\t\t\t<br><br>Conclusion : \n\t\t\t<br>Vous n'avez pas accès à ces pages<br>\n\t\t\tContactez glupglup (51166) pour résoudre le problème.<br><br>\n\t\t\t");
        }
    }
}
Beispiel #9
0
function selectDbMicheline($id_objet_depart, $id_objet_arrivee, $type_objet_depart, $type_objet_arrivee)
{
    global $db_vue_rm;
    $id_objet = $id_objet_depart;
    $type_objet = $type_objet_depart;
    for ($i = 0; $i <= 1; $i++) {
        if ($i == 1) {
            $id_objet = $id_objet_arrivee;
            $type_objet = $type_objet_arrivee;
            $x1 = $x;
            $y1 = $y;
            $z1 = $z;
            $nom1 = $nom;
        }
        switch ($type_objet) {
            case "troll":
                $res = selectDbTrolls($id_objet);
                $res = $res[1];
                if (!userIsGroupSpec() && $res[maj_groupe_spec_troll] == 'oui') {
                    $res[x_troll] = 0;
                    $res[y_troll] = 0;
                    $res[z_troll] = 0;
                }
                $x = $res[x_troll];
                $y = $res[y_troll];
                $z = $res[z_troll];
                $nom = $res[nom_troll];
                break;
            case "monstre":
                $res = selectDbRechercheMonstres($id_objet);
                $x = $res[x_monstre];
                $y = $res[y_monstre];
                $z = $res[z_monstre];
                $nom = $res[nom_monstre];
                break;
            case "lieux":
                $res = selectDbLieux($id_objet);
                $x = $res[x_lieu];
                $y = $res[y_lieu];
                $z = $res[z_lieu];
                $nom = $res[nom_lieu];
                break;
            case "champignons":
                $res = selectDbRechercheChampignons($id_objet);
                $x = $res[x_champi];
                $y = $res[y_champi];
                $z = $res[z_champi];
                $nom = $res[nom_champi];
                break;
        }
    }
    $tab[0]['x'] = $x1;
    $tab[0]['y'] = $y1;
    $tab[0]['z'] = $z1;
    $tab[0]['nom'] = $nom1;
    $tab[1]['x'] = $x;
    $tab[1]['y'] = $y;
    $tab[1]['z'] = $z;
    $tab[1]['nom'] = $nom;
    return $tab;
}
Beispiel #10
0
include_once "inc_connect.php";
include_once "functions_auth.php";
include_once "functions.php";
//$auto = false;
$auto = $_REQUEST['auto'];
$refresh = $_REQUEST['refresh'];
if ($auto != "") {
    if (md5($auto) == MD5_PASS_EXTERNE) {
        if ($_REQUEST['state'] == "") {
            die('ERREUR STATE');
        }
    } else {
        die('Acces Refuse - seq_ref');
    }
}
if (userIsGuilde() || $auto != "" || userIsGroupSpec()) {
    $state = $_REQUEST['state'];
    $maj_troll_id = $_REQUEST['maj_troll_id'];
    $maj_x_troll = $_REQUEST['maj_x_troll'];
    $maj_y_troll = $_REQUEST['maj_y_troll'];
    $maj_z_troll = $_REQUEST['maj_z_troll'];
    if (!$auto) {
        initSequenceRefresh($state);
    }
    suiteSequenceRefresh($auto, $state, $maj_troll_id, $maj_x_troll, $maj_y_troll, $maj_z_troll, $refresh);
} else {
    die("Accès refusé");
}
function initSequenceRefresh($state)
{
    ?>