Example #1
0
 function initAjout($taniere, $id, $type, $nom, $template, $description, $poids, $enVentePrix, $enVenteTroll, $dateMaj)
 {
     $this->arriveeDate = date("d/m/Y");
     $this->taniere = $taniere;
     $this->id = $id;
     $this->type = $type;
     $this->nom = $nom;
     $this->template = $template;
     $this->description = $description;
     $this->poids = $poids;
     if ($enVenteTroll >= 0) {
         $this->enVente = 1;
         $this->enVentePrix = $enVentePrix;
         $this->enVenteTroll = $enVenteTroll;
         $this->enVenteTrollNom = getNomTroll($enVenteTroll);
     } else {
         $this->enVente = 0;
         $this->enVentePrix = 0;
         $this->enVenteTroll = -1;
         $this->enVenteTrollNom = '';
     }
     if ($this->type == 'Composant' || $this->type == 'Champignon' || $this->type == 'Minerai') {
         $this->isCompo = 1;
     } else {
         $this->isCompo = 0;
     }
     $this->dateMaj = $dateMaj;
     $this->absent = 0;
 }
Example #2
0
function appelScript($login, $password)
{
    global $db_vue_rm;
    //on vérifie le nombre d'appels au script
    $date = date("Y-m-d H-i-s");
    $date_less_24 = date("Y-m-d H-i-s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 1, date("Y")));
    $query = "DELETE FROM variables WHERE nom='REFRESH_MAGASIN' AND valeur_date<'{$date_less_24}';";
    $query_result = mysql_query($query, $db_vue_rm);
    $query = "SELECT COUNT(*) FROM variables WHERE nom='REFRESH_MAGASIN';";
    $query_result = mysql_query($query, $db_vue_rm);
    $row = mysql_fetch_array($query_result);
    if ($row) {
        list($nb) = $row;
        if ($nb >= NB_REFRESH_MAGASIN_BY_GUILDE) {
            die("La guilde a utilisé " . $nb . " fois le script public dans les dernières 24 heures, pour " . NB_REFRESH_MAGASIN_BY_GUILDE . " fois max.");
        }
    }
    $query = "INSERT INTO variables(nom, valeur_date, valeur_txt) VALUES('REFRESH_MAGASIN','{$date}','" . getNomTroll($login) . "');";
    $query_result = mysql_query($query, $db_vue_rm);
    //appel au script
    $url = 'http://sp.mountyhall.com/SP_GrandesTanieres.php?Numero=' . $login . '&Motdepasse=' . $password;
    //$url='C:\\temp\\GTMountyhall.txt';
    $ressource = fopen($url, 'r');
    //parsing du retour du script
    $result = array();
    $taniere = 0;
    while ($line = fgets($ressource)) {
        //echo("<!--".$line."-->\n");
        if (trim($line) == "") {
            continue;
        }
        if ($line[0] == '#') {
            if (strpos($line, '#DEBUT') == 0) {
                $temp = explode(';', $line);
                $taniere = substr($temp[0], 21);
            }
            continue;
        }
        $temp = explode(';', $line);
        $tab['id'] = $temp[0];
        $tab['type'] = $temp[2];
        $tab['identifie'] = $temp[3];
        $tab['nom'] = $temp[4];
        $tab['template'] = $temp[5];
        $tab['description'] = $temp[6];
        $tab['poids'] = $temp[7];
        $tab['enVenteTroll'] = $temp[8];
        $tab['enVentePrix'] = $temp[9];
        $tab['taniere'] = $taniere;
        $result[] = $tab;
    }
    return $result;
}