Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

1 aplikacja na IP.Board 3.


Przejdź do rozwiązania Rozwiązane przez X3nO,

Rekomendowane odpowiedzi

Witam, zaczynam pisać moją pierwszą aplikację w skrypcie IP.Board 3.4.9. Dotychczas korzystałem z MyBB.

Mój obecny kod:

<?php

class CDefault {
    protected $registry;
	protected $DB;
	protected $member;
	protected $memberData;
	protected $request;
	protected $settings;

	public function __construct( ipsRegistry $registry){
		$panelClass = IPSLib::loadLibrary( IPSLib::getAppDir( 'panel' ) . '/sources/panel.php', 'panel' );
		$this->panel = new $panelClass($registry);
		$this->registry = $registry;
		//$this->DB = $this->registry->DB();
		$this->member = $this->registry->member();
		$this->memberData = $this->registry->member()->fetchMemberData();
		$this->request = $this->registry->fetchRequest();
		$this->settings = $this->registry->fetchSettings();

    }
    public function getOutput(){ 
		switch($this->request['go']){
			default: {
				$this->registry->output->addNavigation( "Gracze OnLine" );	
				require_once(IPSLib::getAppDir( 'panel' ) . '/extensions/samp_api.php');
				$query = new SampQueryAPI('80.72.47.182', 3644);
				if($query->isOnline()){
					$aInformation = $query->getInfo();
					$aPlayers = $query->getDetailedPlayers();
					if($aInformation['players'] != 0){
						$counts = 0;
						$Players = array();
						foreach($aPlayers as $sValue){
							$gracze[ 'ponline' ][$counts ] = $sValue;
							$counts++;
						}
						$countsx=0;
						$online.= '<div class="table_wrap"><table class="ipb_table">';
						$online.= '	<tbody><tr style="2">';
						$online.= '	<td class="row1" align="center" width="15%" > <b>LP.</b> </td>';
						$online.= '	<td class="row1" align="center" width="35%"  > <b>Nick</b> </td>';
						$online.= '	<td class="row1" align="center" width="50%"  > <b>Score</b> </td>';
						$online.= '	</tr>';
						$count_player= array();
						$count_player['head'] =0;
						$count_player['admin']=0;
						$count_player['jadmin']=0;
						$count_player['vip']=0;
						foreach( $gracze['ponline'] as $entry ) {
							$danekonta = $this->registry->DB('acc')->buildAndFetch( array( 'select' => 'name, uid, premium, score', 
								'from'   => 'Accounts','where'  => 'name=\''.$entry['nickname'].'\'')); 		
									   
							$this->registry->DB('acc')->execute();
							$Players[$countsx]['samp_ID'] = $entry['playerid'];
							if($danekonta['uid']!=0) {
								$Players[$countsx]['samp_Respect'] = $danekonta['score'];
								$Players[$countsx]['samp_Name'] = $entry['nickname'];
								$Players[$countsx]['samp_Account'] = true;
									
								if($danekonta['premium'] == 3) {
									$Players[$countsx]['samp_Type'] = '#FF8000';
									$count_player['head']++;//head
								}
								else if($danekonta['premium'] == 2) {
									$Players[$countsx]['samp_Type'] = '#d40000'; 
									$count_player['admin']++;//admin
								}
								else if($danekonta['premium'] == 1) {
									$Players[$countsx]['samp_Type'] = '#520387'; 
									$count_player['jadmin']++;//jadmin
								}
								else if($danekonta['premium'] == 0) {
									$Players[$countsx]['samp_Type'] = '#124DFF'; 
									$count_player['vip']++;
								}
								else
									$Players[$countsx]['samp_Type'] = '#696969';//gracz
							}
							else {
								$Players[$countsx]['samp_Name'] = $entry['nickname'];
								$Players[$countsx]['samp_Respect'] = ' - ';
								$Players[$countsx]['samp_Account'] = false;
								$Players[$countsx]['samp_Type'] = '#696969'; // bez konta
							} 
							$countsx++;
						}
						foreach($Players as $player) {
							$url_nick = urlencode($player['samp_Name']); 
							$nick = $player['samp_Account'] ? $player['samp_Name'].' +' : $player['samp_Name'];
							$online.='<tr align=\'center\'>';
							$online.='<td class=\'row1\' width=\'15%\'><b>'.$player['samp_ID'].'</b></td>';
							$online.='<td class=\'row1\' width=\'35%\' style=\'text-shadow: 0px 0px 10px '.$player['samp_Type'].'; color: '.$player['samp_Type'].'\'><b>'.$nick.'</b></td> ';
							$online.='<td class=\'row1\' width=\'50%\'><b>'.$player['samp_Respect'].'</b></td>';
							$online.='</tr>';
						}	
						$online.= '</tbody></table></div>';
						$plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span>(
							<span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
							/<span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
							/<span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
							/<span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
							)';
							}
					else{
						$plr_count = "(0)";
						$online.= "<center><br/><br/><b>Brak graczy na serwerze! </b></center><br/><br/><br/><br/><br/>";
					}	
				}
				else{
					$plr_count = "(0)";
					$online.= "<center><br/><br/><b>Brak graczy na serwerze! </b></center><br/><br/><br/><br/><br/>";
				}		
				$out='<h3 class="maintitle">Gracze OnLine '.$plr_count.'</h3>'.$online;
			}
		}
		$menuClass = IPSLib::loadLibrary( IPSLib::getAppDir( 'panel' ) . '/sources/menu.php', 'globalMenu' );
		$menu = new $menuClass($this->registry);
		return $menu->getOutput2($out, $this->request['do'], $this->request['go'], array("Gracze OnLine", "Statystyki Serwera","Mapa Świata"), array("online", "statssvr","maps"));	

	}
  


}

I jedyne jaki pokazuje się błąd to:

Driver Error

There appears to be an error with the database.If you are seeing this page, it means there was a problem communicating with our database. Sometimes this error is temporary and will go away when you refresh the page. Sometimes the error will need to be fixed by an administrator before the site will become accessible again.

You can try to refresh the page by clicking here
← Return to the index

Może ktoś mnie naprowadzić, co źle robię? Zaznaczam, jest to moja pierwsza aplikacja w IPB.

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • Rozwiązanie

Daj kod błędu z cache/ (.cgi).

Dobra, nie wiedziałem gdzie zapisują się błędy. Pewnie będę miał jeszcze więcej problemów, i tu pytanie, czy jest zasada 1 problem = 1 wątek? Jeżeli tak to można zamknąć a jeżeli nie proszę o informacje.

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.