Chyba

Technická podpora pro naše hostované weby
Message
Autor
Magic-Sector
Příspěvky: 237
Registrován: 16 bře 2013, 10:46
Reputation: 0

Chyba

#1 Příspěvekod Magic-Sector » 09 dub 2013, 15:28

Spoiler: zobrazit

Kód: Vybrat vše

<?php
/*
Plugin Name: Minecraft Server info
Plugin URI: http://phgame.cz
Description: Zobrazuje stav Vašeho Minecraft Serveru.
Version: 1.0.1
Author: Webster.K
Author URI: http://phgame.cz
*/


function minecraft_server_info_install(){
global $wpdb;
mysql_query("DROP TABLE IF EXISTS ".$wpdb->prefix."plugin_minecraft_server_info");

mysql_query("CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."plugin_minecraft_server_info (id INT NOT NULL AUTO_INCREMENT,typ VARCHAR(15) NOT NULL,nastaveni VARCHAR(50) NOT NULL,PRIMARY KEY (id))");
      mysql_query("INSERT INTO ".$wpdb->prefix."plugin_minecraft_server_info (typ,nastaveni) VALUES ('HLAVA', 'Server')");
      mysql_query("INSERT INTO ".$wpdb->prefix."plugin_minecraft_server_info (typ,nastaveni) VALUES ('IP', '93.91.250.207')");
      mysql_query("INSERT INTO ".$wpdb->prefix."plugin_minecraft_server_info (typ,nastaveni) VALUES ('PORT', '27372')");
      mysql_query("INSERT INTO ".$wpdb->prefix."plugin_minecraft_server_info (typ,nastaveni) VALUES ('JAZYK', 'CZ')");
}

add_action('activate_minecraft-server-info/minecraft-server-info.php', 'minecraft_server_info_install');

   
function get_minecraft_server_info($url, $port, $jazyk, $before = '', $after = '') {

   if($jazyk=='CZ'){$mutace = array("Stav","Hráči online","Port","IP");}
   elseif($jazyk=='EN'){$mutace = array("Status","Players online","Port","IP");}
   
   
   
      if ( $sock = @stream_socket_client('tcp://'.$url.':'.$port, $errno, $errstr, 1) ) {

         

         fwrite($sock, "\xfe");
         $h = fread($sock, 2048);
         $h = str_replace("\x00", '', $h);
         $h = substr($h, 2);
         $data = explode("\xa7", $h);
         unset($h);
         fclose($sock);

         if (sizeof($data) == 3) {
            $output .= "$before";
            $output .= $mutace[0] . ": <font color=\"#00FF00\">Online</font>";
            $output .= "$after\n$before";
            $output .= $mutace[3] .": " . $url;
            $output .= "$after\n$before";
            $output .= $mutace[2] .": " . $port;
            $output .= "$after\n$before";
            $output .= $mutace[1] .": " . $data[1] . "/" . $data[2];
         }
         else {
            $output .= "$before";
            $output .= $mutace[0] . ": <font color=\"#FF0000\">Offline</font>";
            $output .= "$after\n$before";
            $output .= $mutace[3] .": " . $url;
            $output .= "$after\n$before";
            $output .= $mutace[2] .": " . $port;
         }

      }
      else {
         $output .= "$before";
         $output .= $mutace[0] . ": <font color=\"#FF0000\">Offline</font>";
         $output .= "$after\n$before";
         $output .= $mutace[3] .": " . $url;
         $output .= "$after\n$before";
         $output .= $mutace[2] .": " . $port;
      }
      
return $output;
}



function widget_minecraft_server_info($args) {

   global $wpdb;
   $adresa_serveru = mysql_query("SELECT * FROM ".$wpdb->prefix."plugin_minecraft_server_info WHERE typ='IP'");
   while ($minecraft_server_info_nastav = mysql_fetch_array($adresa_serveru)):
      $server_ip = $minecraft_server_info_nastav["nastaveni"];
   endwhile;
   
   $cislo_portu = mysql_query("SELECT * FROM ".$wpdb->prefix."plugin_minecraft_server_info WHERE typ='PORT'");
   while ($minecraft_server_info_nastav = mysql_fetch_array($cislo_portu)):
      $server_port = $minecraft_server_info_nastav["nastaveni"];
   endwhile;
   
   $nadpis_widgetu = mysql_query("SELECT * FROM ".$wpdb->prefix."plugin_minecraft_server_info WHERE typ='HLAVA'");
   while ($minecraft_server_info_nastav = mysql_fetch_array($nadpis_widgetu)):
      $nadpis_widget = $minecraft_server_info_nastav["nastaveni"];
   endwhile;
   
   $jazyk_widgetu = mysql_query("SELECT * FROM ".$wpdb->prefix."plugin_minecraft_server_info WHERE typ='JAZYK'");
   while ($minecraft_server_info_nastav = mysql_fetch_array($jazyk_widgetu)):
      $jazy_widget = $minecraft_server_info_nastav["nastaveni"];
   endwhile;

   extract($args);
   echo "$before_widget";
   echo "$before_title\n";
   echo $nadpis_widget . zpetny_odkaz_1();
   echo "$after_title\n";
   echo "<div id=\"odsazeni\">". get_minecraft_server_info($server_ip,$server_port,$jazy_widget,'<ul><li>','</li></ul>') ."</div>";
   echo "$after_widget\n";
}

function zpetny_odkaz_1() {
   return '<div id="zpetny_odkaz" style="visibility: hidden;width:1px;height:1px"><a href="http://phgame.cz">PHGame.cz</a></div>';
}

function widget_minecraft_server_info_control($args) {
}

function init_minecraft_server_info_widget(){
        register_sidebar_widget("Minecraft Server info", "widget_minecraft_server_info");
      register_widget_control("Minecraft Server info Widget", "widget_minecraft_server_info_control");
}

function minecraft_server_info_menu(){
    global $wpdb;
    include 'minecraft-server-info_admin.php';
}
function minecraft_server_info_admin_actions()
{
    add_options_page("Minecraft Server info", "Minecraft Server info", 1,"minecraft_server_info", "minecraft_server_info_menu");
}
 
add_action('admin_menu', 'minecraft_server_info_admin_actions');

add_action("plugins_loaded", "init_minecraft_server_info_widget");
?>

Kde tu mám chybu na webe mi píše že je server off a je on
Pomohol som ? Karma+

Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Chyba

#2 Příspěvekod Qefik » 09 dub 2013, 15:37

Kde na webu ti to píše? Kam to dáváš? Si si jistý že jen ten kód funkční? Když ho zkusím spustit tak se ukáže jen prázdná stránka...
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain

Magic-Sector
Příspěvky: 237
Registrován: 16 bře 2013, 10:46
Reputation: 0

Re: Chyba

#3 Příspěvekod Magic-Sector » 09 dub 2013, 15:55

To neni kód je to plugin Minecraf Server Info ,keď si ho stiahnej je tam niaky server ale keď tam das tvoju op píše že je off a pritom je on
Pomohol som ? Karma+

Uživatelský avatar
Qefik
Příspěvky: 5714
Registrován: 26 pro 2009, 11:26
Reputation: 0
Kontaktovat uživatele:

Re: Chyba

#4 Příspěvekod Qefik » 09 dub 2013, 16:03

Tak co třeba napsat autorovi nebo na podporu WP? Tam ti poradí spíš, ví jak to funguje, kde se dají chyby. Můžeš tam zkusit ještě dát nějaký jiný server, ale nemyslím že by to pomohlo...
Rozdávat rady je zbytečné. Moudrý si poradí sám a hlupák stejně neposlechne.
Mark Twain

Magic-Sector
Příspěvky: 237
Registrován: 16 bře 2013, 10:46
Reputation: 0

Re: Chyba

#5 Příspěvekod Magic-Sector » 09 dub 2013, 19:00

Nwm kde je chyba
Pomohol som ? Karma+

enalan
Příspěvky: 1552
Věk: 26
Registrován: 13 led 2013, 14:36
Reputation: 0

Re: Chyba

#6 Příspěvekod enalan » 09 dub 2013, 19:14

Už ti zde někdo psal, že si máš napsat na WP Podporu a né zde na fakahedu ! Tak prosím supporty respektuj :) Děkuji
WP-WordPress
Ušetři na nákupech v eshopech se společností Plná Peněženka.
Web, který tě přiučím novým věcem - http://neobycejny-svet.cz/
Aktuální kontakt na mě - tom.cana@seznam.cz

Magic-Sector
Příspěvky: 237
Registrován: 16 bře 2013, 10:46
Reputation: 0

Re: Chyba

#7 Příspěvekod Magic-Sector » 09 dub 2013, 19:55

Aké keď tam dám ip co bola tam keď som ten plugin stiahol tak to vyzerá takto
Přílohy
image.jpg
image.jpg (87.7 KiB) Zobrazeno 2889 x
Pomohol som ? Karma+

Uživatelský avatar
Mysteria
Příspěvky: 9122
Registrován: 26 pro 2009, 15:40
Reputation: 7
Bydliště: Česká republika
Kontaktovat uživatele:

Re: Chyba

#8 Příspěvekod Mysteria » 09 dub 2013, 20:29

Sakra, pokud tam dáváš správnou IP adresu a stejně ti to nejde, tak by asi bylo logický napsat autorovi, ne?
Author: Webster.K
Author URI: http://phgame.cz


Zpět na „Web hosting“

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 0 hostů