Reklama
Pokazuje wyniki od 1 do 3 z 3

Temat: [8.4+][PHP]Temple change position - zmiana pozycji gracza/graczy

  1. #1
    Avatar Dingo
    Data rejestracji
    2005
    Posty
    34
    Siła reputacji
    0

    Domyślny [8.4+][PHP]Temple change position - zmiana pozycji gracza/graczy

    Witam,
    Zacznę od tego, że jestem początkujący w PHP.
    Skrypt napisałem, bo pomyślałem o takim czymś jak update mapy :]. Fajnie by było, aby po update'ie gracz nie zalogował się na ścianie, czy też nie wylądował robiąc runy pod depo nagle na Demonach :].

    Wszystko edytujemy w samym pliku.

    Możliwości:
    1. Zmiana spawnu wszystkich postaci w grze!
    2. Zmiana spawnu 1 postaci (po podaniu nazwy postaci).
    3. Logowanie, aby nieporządane osoby nie bawiły się i niszczyły nam OTS'a!
    4. 'Integracja' z GesiorACC.


    PAMIĘTAJ! USTAW LOGIN I HASŁO!

    Źródło:
    Kod PHP:
    <?php
    /////////////////////////////////////////CONFIG//////////////////////////////////////////////////
    /////////////////////Wrote by Dingo. U can use and edit everything u want!///////////////////////////////
    //My english is very bad. But if u want any help please write to: [email protected] with Topick like "Pomoc w skrypcie"//
    //////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////
    $mysql['host'] = 'localhost'; // Host adress to MYSQL base | def='localhost'
    $mysql['login'] = ''; // Login to MYSQL | def='root'
    $mysql['pass'] = ''; // Password to MYSQL
    $mysql['db'] = ''; // MYSQL data base | def='ots'
    $mysql['code'] = true; // True=if u use UTF-8 | False=if u don't use UTF-8
    
    $temple['x'] = ''; //Temple position | def='1000'
    $temple['y'] = ''; //Temple position | def='1000'
    $temple['z'] = ''; //Temple position | def='7'
    
    $filename = 'temple_pos.php'; // File name (if u want to change file name u must change this!) | def='temple_pos.php'
    
    /*Only you can change players position! Be carefour!*/
    $login['name'] = ''; //Your login
    $login['pass'] = ''; //Your password
    //////////////////////////////////////////////////////////////////////////////////////////////////
    session_start();
    //////////////////////////////////////////////////////////////////////////////////////////////////
    echo '<!------------------------------------------------
    ------Change position script wrote by Dingo.------
    -If you have any information please edit file and-
    ---------------get my email adress.---------------
    ---It could be integrated with Gesior ACC maker!--
    -----------------Read readme.txt------------------
    ------------------------------------------------->
    ';
    //////////////////////////////////////////////////////////////////////////////////////////////////
    mysql_connect($mysql['host'], $mysql['login'], $mysql['pass']);
    mysql_select_db($mysql['db']);
    if($mysql['code']==true)
    {
    mysql_query("SET NAMES 'utf8'");
    }
    //LOG STARTED
    if($_POST['login']==$login['name'] && $_POST['pass']==$login['pass'])
    {
    //BODY STARED
    echo '<form method=POST>Change all players position? 
    <input type="hidden" name="s" value="update">
    <input type="hidden" name="login" value="'.$login['name'].'">
    <input type="hidden" name="pass" value="'.$login['pass'].'">
    <input type="submit" name="submit" value="Yes">
    </form>';
    
    echo '<form method=POST>
    Change player position (write player name):
    <input type=text name=player>
    <input type="hidden" name="s" value="player_update">
    <input type="hidden" name="login" value="'.$login['name'].'">
    <input type="hidden" name="pass" value="'.$login['pass'].'">
    <input type="submit" name="submit" value="Change">
    </form>';
    
    //BODY ENDED
    
    if($_POST['s']=='update')
    { 
    $update1 = "UPDATE players SET posx = '".$temple['x']."', posy = '".$temple['y']."', posz = '".$temple['z']."'";
    $updated1 = mysql_query($update1);
    echo '<strong>Changed!</strong>';
    }
    if($_POST['s']=='player_update')
    { 
    $player_name = $_POST['player'];
    $ask = "SELECT * FROM players WHERE name = '$player_name'";
    $asked = mysql_query($ask);
    $table = mysql_fetch_row($asked);
    	if($table[1]==$_POST['player'])
    	{
    		if (!empty($_POST['player']))
    		{
    		$update2 = "UPDATE `players` SET posx = '".$temple['x']."', posy = '".$temple['y']."', posz = '".$temple['z']."' WHERE name = '$player_name'";
    		$updated2 = mysql_query($update2);
    		echo '<strong>Changed!</strong>';
    		}
    	}
    	else
    	{
    	echo 'Player '.$player_name.' doesn\'t exist!';
    	}
    }
    echo '<br><br><small><a href="?s=logout">Logout</a></small>';
    }
    //LOG ENDED
    else 
    {
    echo 'Please login:';
    echo '<form method=POST action='.$filename.'>
    <input type=text name=login>
    <input type=password name=pass>
    <input type="submit" name="submit" value="Change">
    </form>';
    }
    if($_GET['s']=='logout')
    {
    session_destroy();
    }
    echo '<small><br><br>Scripted by <a href="http://www.quita.pl">Dingo</a></small>';
    ?>
    README.TXT:
    Kod PHP:
    Change position script wrote by Dingo.
    My english is very bad. But if u want any help please write to: [email protected] with Topick like "Pomoc w skrypcie".
    
    1. Instalation
    - Unrar to website folder.
    - Edit temple_pos.php. Change MySQL login and other things!
    - To use write adress like that: http://quita.pl/temple_pos.php
    2. Integrate with GesiorAcc
    - Edit adminpanel.php
    - Find:
    if($action == "") {
    //wyswietla wszystko mozliwe opcje dla admina takie jak "news", "reload configs", "edit configs","admin players/accounts", "set access rights"
    $main_content .= '<center><h2>News system</h2></center>Here you can add new ticker and new message, edit access rights and set limit of showed <b>Tickers</b> and <b>News</b>.<br/><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><font color="red"><b>Option</b></font></td><td><font color="red"><b>Description</b></font></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div></td><td><b>Press "Submit" to add new ticker.</b></td></tr>
    <tr bgcolor='.$config['site']['darkborder'].'><td><div id="newnewsform"></div><div id="chicken"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddNews" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div></div></td><td><b>Press "Submit" to add new message (news).</b></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=latestnews">Edit/Delete</a></b></td><td><b>Here you can edit and delete news.</b></td></tr>/
    </table>';
    $main_content .= '<center><h2>Load configurations</h2></center>Here you can choose what configuration you want to reload. It load configuration from OTS files.<br/><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><font color="red"><b>Option</b></font></td><td><font color="red"><b>Description</b></font></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>
    </table>';
    }
    - Change it with:
    if($action == "") {
    //wyswietla wszystko mozliwe opcje dla admina takie jak "news", "reload configs", "edit configs","admin players/accounts", "set access rights"
    $main_content .= '<center><h2>News system</h2></center>Here you can add new ticker and new message, edit access rights and set limit of showed <b>Tickers</b> and <b>News</b>.<br/><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><font color="red"><b>Option</b></font></td><td><font color="red"><b>Description</b></font></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div></td><td><b>Press "Submit" to add new ticker.</b></td></tr>
    <tr bgcolor='.$config['site']['darkborder'].'><td><div id="newnewsform"></div><div id="chicken"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddNews" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" onClick="showNewNewsForm()" alt="AddNews" /></div></div></div></td><td><b>Press "Submit" to add new message (news).</b></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=latestnews">Edit/Delete</a></b></td><td><b>Here you can edit and delete news.</b></td></tr>/
    </table>';
    $main_content .= '<center><h2>Load configurations</h2></center>Here you can choose what configuration you want to reload. It load configuration from OTS files.<br/><table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><font color="red"><b>Option</b></font></td><td><font color="red"><b>Description</b></font></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><b>Load information about monsters from directory "your_server_path/data/monsters/". Delete old mosters configuration!</b></td></tr>
    <tr bgcolor='.$config['site']['darkborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><b>Load information about spells from file "your_server_path/data/spells/spells.xml". Delete old spells configuration!</b></td></tr>
    <tr bgcolor='.$config['site']['lightborder'].'><td width="150"><b><a href="?subtopic=adminpanel&action=change_temple">Change temple</a></b></td><td><b>Change player/players spawn (temple position).</b></td></tr>
    </table>';
    }
    //TEMPLE CHANGER!
    if($action == "change_temple") 
    {
    header("Location: temple_pos.php");
    }
    
    
    3. License/Licence:
    - You can edit everything but you haven't to touch:
    -- "/////////////////////Wrote by Dingo. U can use and edit everything u want!///////////////////////////////
    //My english is very bad. But if u want any help please write to: [email protected] with Topick like "Pomoc w skrypcie"//"
    -- "<!------------------------------------------------
    ------Change position script wrote by Dingo.------
    -If you have any information please edit file and-
    ---------------get my email adress.---------------
    ---It could be integrated with Gesior ACC maker!--
    -----------------Read readme.txt------------------
    ------------------------------------------------->"
    4. Thanks
    - Thank to all who wants to use it :].
    - Thank Delekt, rtX and each people from Quita Team!
    - Thank you!
    Download:
    http://rapidshare.com/files/243555610/Temple_script.rar
    http://upek.oz.pl/public/viewset/273


    P.S. Proszę pisać wszelakie błędy!
    P.S.2 Acha. Zapomniałem napisać. Testowane na TFS. Nie wiem czy działa na innych!
    <BRAK>

  2. #2
    Avatar Zloom
    Data rejestracji
    2005
    Położenie
    Kraków
    Posty
    171
    Siła reputacji
    19

    Domyślny

    Jak dla mnie skrypt kompletnie nie przydatny, pozycje temple dla wszystkich graczy można zmienić wykonując 1 zapytanie w bazie danych... ale cóż gratulacje za chęci :)

  3. Reklama
  4. #3
    Avatar fifi209
    Data rejestracji
    2006
    Położenie
    127.0.0.1
    Posty
    52
    Siła reputacji
    18

    Domyślny

    Za dużo konfiguracji etc.
    Jak dla mnie bez sensu użyłeś session_start i session_destroy, po prostu chyba nie wiesz do czego służą.

    Co do logowania - porażka - nie lepiej aby dana grupa mogła się zalogować np. god/owner ? (nie byłby trudno zrobić)

    Nie muszę mówić o zupełnym braku zabezpieczeń? Przesyłanie do użytkownika loginu i hasła jako pole "hidden" jest co najmniej dennym pomysłem.

    Co do podawania pozycji: szczerze to lepiej, gdyby były podawane w formularzu.

    O błędach typu SQLi nie wspominam.

Reklama

Informacje o temacie

Użytkownicy przeglądający temat

Aktualnie 1 użytkowników przegląda ten temat. (0 użytkowników i 1 gości)

Podobne tematy

  1. Odpowiedzi: 2
    Ostatni post: 15-06-2016, 23:28
  2. Odpowiedzi: 5
    Ostatni post: 23-06-2015, 12:47
  3. Skrypt PHP - przesyłanie danych z formularza php do pliku .txt
    Przez Żarówa2SR w dziale Sprzęt i oprogramowanie
    Odpowiedzi: 1
    Ostatni post: 24-10-2012, 17:06
  4. Zmiana świata - Change world
    Przez zizu_kp w dziale Tibia
    Odpowiedzi: 3
    Ostatni post: 02-07-2011, 18:19
  5. Swap position?
    Przez Samouwielbienie w dziale Tibia
    Odpowiedzi: 1
    Ostatni post: 29-10-2010, 18:25

Zakładki

Zakładki

Zasady postowania

  • Nie możesz pisać nowych tematów
  • Nie możesz pisać postów
  • Nie możesz używać załączników
  • Nie możesz edytować swoich postów
  •