Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- $db = new PDO('sqlite:dotd.db3');
- $t = "equipment";
- $j = "";
- $v = array();
- $o = "ID DESC";
- switch ($type) {
- case "mh":
- array_push($v,"equipType=1");
- break;
- case "oh":
- array_push($v,"(equipType=2 OR equipType=9)");
- break;
- case "helmet":
- array_push($v,"equipType=3");
- break;
- case "chest":
- array_push($v,"equipType=4");
- break;
- case "glove":
- array_push($v,"equipType=5");
- break;
- case "pant":
- array_push($v,"equipType=6");
- break;
- case "boot":
- array_push($v,"equipType=7");
- break;
- case "ring":
- array_push($v,"equipType=8");
- break;
- case "neck":
- array_push($v,"equipType=10");
- break;
- default:
- $t = $type;
- }
- if ($type != "magic" && $type != "consumable" && $type != "rune" && $type != "raid" && $type != "familiar") { $j = "LEFT JOIN {$type}_proc ON {$t}.name={$type}_proc.name"; }
- if (count($_POST) > 1) {
- foreach ($_POST as $key => $value) {
- $value = esc($value);
- if ($key != "t") {
- if ($key == "name") {
- $value = explode(",",$value);
- $items = array();
- foreach ($value as $i) {
- $i = preg_replace('/^\s/',"",$i);
- array_push($items,"{$t}.{$key} LIKE '%{$i}%'");
- }
- array_push($v,"(".implode(" OR ",$items).")");
- }
- else if ($key == "bonusText") { array_push($v,"{$t}.{$key} LIKE '%{$value}%'"); }
- else if ($key == "proc_desc") {
- if ($value == "Leveling") {
- array_push($v,"({$t}.{$key} LIKE '%Increas%Energy%' OR {$t}.{$key} LIKE '%Increas%Stamina%' OR {$t}.{$key} LIKE '%Increas%Honor%')");
- }
- else if ($value == "PvP") { array_push($v,"{$t}.{$key} LIKE '%PvP bonus%'"); }
- else if ($value == "Attack" || $value == "Defense") { array_push($v,"{$t}.{$key} LIKE '%Increas%Player''s%{$value}%'"); }
- else if ($value == "Perception") { array_push($v,"{$t}.{$key} LIKE '%Increas%{$value}%'"); }
- else if ($value == "Critical") { array_push($v,"{$t}.{$key} LIKE '%{$value}%'"); }
- else { array_push($v,"({$t}.{$key} LIKE '%against {$value}%' OR {$t}.{$key} LIKE '% vs {$value}%' OR {$t}.{$key} LIKE '% or {$value}%' OR {$t}.{$key} LIKE '% and {$value}%')"); }
- }
- else {
- if ($key == "race") { $value = $race[$value]; }
- if ($key == "role") { $value = $role[$value]; }
- if ($key == "source") { $value = $source[$value]; }
- array_push($v,"{$t}.{$key}='{$value}'");
- }
- }
- }
- }
- if (!empty($v)) { $q = "SELECT * FROM {$t} {$j} WHERE ".implode(" AND ", $v)." ORDER BY {$o}"; }
- else { $q = "SELECT * FROM {$t} {$j} ORDER BY {$o}"; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement