[MaNGOS] php portal creator menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    p4lmi3r's Avatar Member
    Reputation
    3
    Join Date
    Jan 2007
    Posts
    6
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [MaNGOS] php portal creator

    This php script has been created to make the creation of the portal a little easier.


    You need to change "your_db_user" and "your_db_password". the other infos should be ok

    the db infos
    PHP Code:
    // We get the DB login infos
    define('DB_HOST',       'localhost');
    define('DB_USER',       'your_db_user');
    define('DB_PASSWORD',   'your_db_password');
    define('DB_NAME',       'mangos'); 
    This script will get the values needed for a portal creation (teleport location, visual id, name and in game ID of the portal)


    when all the requierd field are fill, press the "send" button, it will check if the teleport ID you choose is ok (you can't have the same id twice)
    If it's ok, the infos will send to your DB

    Somes times the spell ID that you choose will not work (don't know why), that's why there is a search field. search the id that didn't work, and edit it with a new one.

    The complete script
    PHP Code:
    <?php
    /*
    + ---------------------------------------------------------------------------- +
    |
    |                    Portal Creator for MaANGOS
    |
    |     © p4lmi3r - 2010
    |
    |    This program is free software: you can redistribute it and/or modify
    |    it under the terms of the GNU General Public License as published by
    |    the Free Software Foundation, either version 3 of the License, or
    |    (at your option) any later version.
    |
    |    This program is distributed in the hope that it will be useful,
    |    but WITHOUT ANY WARRANTY; without even the implied warranty of
    |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    |    GNU General Public License for more details.
    |
    |    You should have received a copy of the GNU General Public License
    |    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    |
    + ---------------------------------------------------------------------------- +
    */


    // We get the DB login infos
    define('DB_HOST',       'localhost');
    define('DB_USER',       'your_db_user');
    define('DB_PASSWORD',   'your_db_password');
    define('DB_NAME',       'mangos');


    // We define every variable
    if(isset($_REQUEST['Button'])) $Button=$_REQUEST['Button'];
    else 
    $Button='';

    if(isset(
    $_REQUEST['search']))      $search=$_POST['search'];

    if(isset(
    $_POST['id']))      $id=$_POST['id'];
    else      
    $id="";

    if(isset(
    $_REQUEST['newid']))    $newid=$_POST['newid'];

    if(isset(
    $_POST['target_map']))      $target_map=$_POST['target_map'];
    else      
    $target_map="";

    if(isset(
    $_POST['target_position_x']))      $target_position_x=$_POST['target_position_x'];
    else      
    $target_position_x="";

    if(isset(
    $_POST['target_position_y']))      $target_position_y=$_POST['target_position_y'];
    else      
    $target_position_y="";

    if(isset(
    $_POST['target_position_z']))      $target_position_z=$_POST['target_position_z'];
    else      
    $target_position_z="";

    if(isset(
    $_POST['target_orientation']))      $target_orientation=$_POST['target_orientation'];
    else      
    $target_orientation="";

    if(isset(
    $_POST['entry']))      $entry=$_POST['entry'];
    else      
    $entry="";

    if(isset(
    $_POST['displayId']))      $displayId=$_POST['displayId'];
    else      
    $displayId="";

    if(isset(
    $_POST['name']))      $name=$_POST['name'];
    else      
    $name="";

    //this function is used to check the id entry which have to be unique
    function checkId($id){
                        
    // we check if the id already exist
                    
    $sql "SELECT id FROM spell_target_position WHERE id='$id'";
                    
    $req mysql_query($sql) or die('SQL error !'.$sql.'<br>'.mysql_error()); 
                    
                    
    // we count the number of results
                    
    $res mysql_num_rows($req);
                
                    return 
    $res;       
                }
                
                

        
    $db mysql_connect(DB_HOSTDB_USERDB_PASSWORD);  // connection to the base
        
    mysql_select_db(DB_NAME,$db);                  // selection of the base

    if($Button=='Send'){

    // we check if the field are empty
    if(empty($id) OR empty($target_map) OR empty($target_position_x) OR empty($target_position_y) OR empty($target_position_z) OR empty($target_orientation) OR empty($entry) OR empty($displayId)    )
        {
        echo 
    '<font color="red">Warning you have to fill all the fields!</font>';
        }
    // No field is empty, we can write them in the table
    //but
    //here is our id checker!
    elseif(checkId($id))
        {
            echo 
    '<font color="red">Sorry this id already exist, try another spell</font>';
        }
                        
       
        else  
    // the id does not exist, we insert the informations in the table
            
    {   
            
    $sql1 "INSERT INTO spell_target_position(id, target_map, target_position_x, target_position_y, target_position_z, target_orientation) VALUES('$id','$target_map','$target_position_x','$target_position_y','$target_position_z','$target_orientation')";
            
    mysql_query($sql1) or die('Erreur SQL !'.$sql1.'<br>'.mysql_error()); 
            
            
    $sql2 "INSERT INTO gameobject_template (entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10, data11, data12, data13, data14, data15, data16, data17, data18, data19, data20, data21, data22, data23, ScriptName) VALUES ('$entry','22','$displayId','$name','','','','0','0','1','0','0','0','0','0','0','$id','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','')";
              
    mysql_query($sql2) or die('Erreur SQL !'.$sql2.'<br>'.mysql_error()); 
            
            echo 
    '<font color="orange">Your portal have been added</font><br />';
            echo 
    '<font color="orange">Restart your server (.server restart 10)</font><br />';
            echo 
    '<font color="orange">Type .gobject add '.$entry.' where you want to put your portal</font>';
            }    
    }


    // the searching part, because some times the spell id you choosed will not work for somes reasons...
    if($Button=='Search'){
        
        
    $sqlsearch "SELECT `id`
                FROM `spell_target_position`
                WHERE `id` LIKE '%"
    .mysql_escape_string($search)."%'";
        
    $sqlResult mysql_query($sqlsearch);
        
    // if an id was found, we show the edit form
            
    while(list($id)=mysql_fetch_array($sqlResult)){
                echo 
    $id;
                echo 
    '<form method="post" action="">';
                echo 
    '<table>';
                echo 
    '<tr>';
                echo 
    '<td><label for="newid">Teleport spell ID</label> :</td> <td><input type="text" name="newid" id="newid" /></td>';
                echo 
    '</table>';
                echo 
    '<input type="submit" value="Edit" name="Button" />';
                echo 
    '<input type="hidden" value='.$id.' name="id" />';
                echo 
    '</form>';
            }
    }




    if(
    $Button=='Edit'){
            
            
    //here is our id checker again!
        
    if(checkId($id))
            {
                echo 
    '<font color="red">Sorry this id already exist, try another spell</font>';
            }
        
        else  
    // the id does not exist, we insert the informations in the table
            
    {       
        
    $sqlupdate="UPDATE spell_target_position SET id='$newid' WHERE id='$id'";
        
    $sqlquery mysql_query($sqlupdate);
        
        
    $sqlupdate2="UPDATE gameobject_template SET data0='$newid' WHERE data0='$id'";
        
    $sqlquery2 mysql_query($sqlupdate2);
        
    error_log($sqlupdate2);
        }
    }
    ?> 




    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
            <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />

            <title>Mangos portal creator</title>
            
            <style type="text/css">
            body {margin:auto; width: 800px; background-color:#333333; color:#ffffff;}
            .hint {color:#999999;}
            a {color:#666666;}
            h1 {color:green; text-align:center;}
            </style>
            
      </head>
      
      <body>
          
        <h1>MaNGOS portal creator</h1>
        
          <form method="post" action="">
          <!-- spell_target_position form-->
              <table>
                  <tr>
                      <td><label for="id">Teleport spell ID</label> :</td> <td><input type="text" name="id" id="id" tabindex="1" /></td> <td><span class="hint">you can find somes IDs on <a href="http://www.wowhead.com/?search=teleport#uncategorized-spells" target="_blank">wowhead.com</a> search for effect #1 "Teleport units"</span></td>
                  </tr>
                  <tr>
                      <td><label for="target_map">Map ID</label> :</td> <td><input type="text" name="target_map" id="target_map" tabindex="2" /></td> <td><span class="hint">This value can be found using .gps ingame</span></td>
                  </tr>
                  <tr>
                      <td><label for="target_position_x">Position X</label> :</td> <td><input type="text" name="target_position_x" id="target_position_x" tabindex="3" /></td> <td><span class="hint">This value can be found using .gps ingame</span></td>
                  </tr>
                  <tr>
                      <td><label for="target_position_y">Position Y</label> :</td> <td><input type="text" name="target_position_y" id="target_position_y" tabindex="4" /></td> <td><span class="hint">This value can be found using .gps ingame</span></td>
                  </tr>
                  <tr>
                      <td><label for="target_position_z">Position Z</label> :</td> <td><input type="text" name="target_position_z" id="target_position_z" tabindex="5" /></td> <td><span class="hint">This value can be found using .gps ingame</span></td>
                  </tr>
                  <tr>
                      <td><label for="target_orientation">Orientation</label> :</td> <td><input type="text" name="target_orientation" id="target_orientation" tabindex="6" /></td> <td><span class="hint">This value can be found using .gps ingame</span></td>
                  </tr>
              </table>
          
          <!-- spell_target_position end form-->     
          
          <!-- gameobject_template start form -->
              <table>
                  <tr>
                      <td><label for="entry">Entry</label> :</td> <td><input type="text" name="entry" id="entry" tabindex="7" /></td> <td><span class="hint">This have to be unique, take a high number like 900001</span></td>
                  </tr>
                  <tr>
                      <td><label for="displayId">Display ID for the object</label> :</td> <td><input type="text" name="displayId" id="displayId" value="7146" tabindex="8" /></td> <td><span class="hint">Darnassus : 4393    Ironforge : 4394    Stormwind : 4396<br />
                  Orgrimmar : 4395    Thunder Bluff : 4397    Undercity : 4398<br />
                  Exodar : 6955    Silvermoon : 6956    Shattrath : 7146    Quel'Danas : 7826</span></td>
                  </tr>
                  <tr>
                      <td><label for="name">Name (will be displayed on mouse over)</label> :</td> <td><input type="text" name="name" id="name" tabindex="9" /></td> <td><span class="hint">. . .</span></td>
                  </tr>
                  <tr>
                      <td><input type="submit" value="Send" name="Button" tabindex="10" /></td>
                  </tr>
              </table>
          
        </form>
        <!-- gameobject_template end form -->

        <!-- search form -->
        <form method="post" action="">
            <table>
                <tr>
                    <td><label for="search">Search</label> :</td> <td><input type="text" name="search" id="search" tabindex="11" /> Search a spell that didn't worked</td>
                </tr>
                <tr>
                    <td><input type="submit" value="Search" name="Button" tabindex="12" /></td>
                </tr>
            </table>
            
        </form>

      </body>
    </html>
    Copy the code and save it as portal.php for exemple and putt it on your server, i guess that if you are hosting a mangos server your have wamp/lamp/mamp or any other thing that can run web pages



    Feel free to edit this script, to make it work for an other emulator or modify his desing.
    Last edited by p4lmi3r; 04-08-2010 at 10:43 AM.

    [MaNGOS] php portal creator
  2. #2
    iotech's Avatar Active Member
    Reputation
    28
    Join Date
    May 2008
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice work, thanks for sharing! I'll check this out.

    +rep x2

Similar Threads

  1. [Mangos] Custom portal creator.
    By bobbafett in forum WoW EMU General Releases
    Replies: 1
    Last Post: 05-14-2009, 07:07 AM
  2. SiPex Portal Creator
    By SiPex in forum WoW EMU Programs
    Replies: 53
    Last Post: 09-20-2008, 01:36 PM
  3. [REQUEST]Need a MaNGOS Custom Portal Maker
    By Yamajee in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 08-11-2008, 10:25 AM
  4. Help with MaNGOS portal creator
    By gregzoid in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 03-10-2008, 02:13 PM
  5. [Tool] MaNGOS Portal Creator
    By Creeps in forum World of Warcraft Bots and Programs
    Replies: 28
    Last Post: 04-30-2007, 06:37 PM
All times are GMT -5. The time now is 12:56 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search