Guest User

Untitled

a guest
Dec 6th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.52 KB | None | 0 0
  1. <?PHP
  2. $allowed_order_by = array('name', 'spell', 'spell_type', 'mana', 'lvl', 'mlvl', 'soul');
  3. $vocation_id = $_REQUEST['vocation_id'];
  4. $order = $_REQUEST['order'];
  5. if(in_array($order, $allowed_order_by))
  6.     $orderby = $order;
  7. else
  8.     $orderby = 'name';
  9.  
  10. $spells = $SQL->query('SELECT * FROM z_spells WHERE hide_spell != 1 ORDER BY '.$orderby.', lvl');
  11. $main_content .= '<FORM ACTION="?subtopic=spells" METHOD=post>
  12. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
  13. <TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Spell Search</B></TD></TR>
  14. <TR BGCOLOR='.$config['site']['darkborder'].'><TD>Only for vocation: <SELECT NAME="vocation_id">';
  15. $main_content .= '<OPTION VALUE="a:a" ';
  16. if('a:a' == $vocation_id)
  17.     $main_content .= 'SELECTED';
  18. $main_content .= '>All';
  19.  
  20. foreach($vocation_name[0] as $prom => $arr)
  21.     foreach($arr as $voc_id => $voc_name)
  22.     {
  23.         $main_content .= '<OPTION VALUE="'.$prom.';'.$voc_id.'"';
  24.         if($prom.';'.$voc_id == $vocation_id && $vocation_id != "a:a" && $vocation_id != '')
  25.             $main_content .= ' SELECTED';
  26.         $main_content .= '/>'.$voc_name;
  27.     }
  28. $main_content .= '</SELECT><input type="hidden" name="order" value="'.$orderby.'">&nbsp;&nbsp;&nbsp;<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD><TR>
  29. </TABLE></FORM>';
  30.  
  31. $main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=name"><font CLASS=white>Name</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=spell"><font CLASS=white>Sentence</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=spell_type"><font CLASS=white>Type<br/>(count)</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=mana"><font CLASS=white>Mana</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=lvl"><font CLASS=white>Exp.<br/>Level</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=mlvl"><font CLASS=white>Magic<br/>Level</a></B></TD><TD CLASS=white><B><a href="?subtopic=spells&vocation_id='.$vocation_id.'&order=soul"><font CLASS=white>Soul</a></B></TD><TD CLASS=white><B>PACC</B></TD><TD CLASS=white><B>For<br/>Vocations:</B></TD></TR>';
  32. if($vocation_id != 'a:a' && $vocation_id != '')
  33. {
  34.     foreach($vocation_name[0] as $prom => $arr)
  35.         foreach($arr as $voc_id => $voc_name)
  36.             if($prom.';'.$voc_id == $vocation_id)
  37.                 $voc_n = $voc_name;
  38.     foreach($spells as $spell)
  39.     {
  40.         $spell_vocations = explode(",", $spell['vocations']);
  41.         if(in_array($vocation_id, $spell_vocations) || empty($spell['vocations']))
  42.         {
  43.             if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['darkborder']; } $number_of_rows++;
  44.             $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>'.$spell['name'].'</TD><TD>'.$spell['spell'].'</TD>';
  45.             if($spell['spell_type'] == 'conjure')
  46.                 $main_content .= '<TD>'.$spell['spell_type'].'('.$spell['conj_count'].')</TD>';
  47.             else
  48.                 $main_content .= '<TD>'.$spell['spell_type'].'</TD>';
  49.             $main_content .= '<TD>'.$spell['mana'].'</TD><TD>'.$spell['lvl'].'</TD><TD>'.$spell['mlvl'].'</TD><TD>'.$spell['soul'].'</TD><TD>'.$spell['pacc'].'</TD><TD>'.$voc_n.'</TD></TR>';
  50.         }
  51.     }
  52. }
  53. else
  54. {
  55.     foreach($spells as $spell)
  56.     {
  57.         $spell_vocations = explode(",", $spell['vocations']);
  58.         $showed_vocations = 0;
  59.         $vocs = '';
  60.         foreach($spell_vocations as $voc)
  61.         {
  62.             $voc_info = explode(";", $voc);
  63.             if(!empty($vocation_name[0][$voc_info[0]][$voc_info[1]]))
  64.             {
  65.                 $vocs .= $vocation_name[0][$voc_info[0]][$voc_info[1]];
  66.                 if($showed_vocations != count($spell_vocations))
  67.                     $vocs .= '<br/>';
  68.             }
  69.         }
  70.         if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['darkborder']; } $number_of_rows++;
  71.         $main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD>'.$spell['name'].'</TD><TD>'.$spell['spell'].'</TD>';
  72.         if($spell['spell_type'] == 'conjure')
  73.             $main_content .= '<TD>'.$spell['spell_type'].'('.$spell['conj_count'].')</TD>';
  74.         else
  75.             $main_content .= '<TD>'.$spell['spell_type'].'</TD>';
  76.         $main_content .= '<TD>'.$spell['mana'].'</TD><TD>'.$spell['lvl'].'</TD><TD>'.$spell['mlvl'].'</TD><TD>'.$spell['soul'].'</TD><TD>'.$spell['pacc'].'</TD><TD><font size="1">'.$vocs.'</font></TD></TR>';
  77.     }
  78. }
  79.  
  80. $main_content .= '</TABLE>';
  81. ?>
Advertisement
Add Comment
Please, Sign In to add comment