<?php session_start(); $username = $_POST['username']; $password = $_POST['password']; $_SESSION['username'] = $username; $_SESSION['password'] = $password; Print_r($_SESSION); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <link rel ="stylesheet" type="text/css" /> <head> </head> <?php include "connect2.php"; ?> <form method="post" action="<?php echo $PHP_SELF; ?> "> <table border="0"> <tr> <td> <p><a href="http://acadweb1.salisbury.edu/~br2214/Project2/Project2Home.php">
return sprintf("%d days, %02d:%02d:%02d", $days, $hour, $minute, $second); } $SortType = array("`char_wstats`.`score`", "`char_wstats`.`kill_count`", "`char_wstats`.`death_count`", "`char_wstats`.`top_damage`", "`char_wstats`.`damage_done`", "`char_wstats`.`damage_received`", "`char_wstats`.`emperium_damage`", "`char_wstats`.`barricade_damage`", "`char_wstats`.`gstone_damage`", "`char_wstats`.`guardian_damage`", "`char_wstats`.`emperium_kill`", "`char_wstats`.`barricade_kill`", "`char_wstats`.`gstone_kill`", "`char_wstats`.`guardian_kill`", "`char_wstats`.`support_skills_used`", "`char_wstats`.`wrong_support_skills_used`", "`char_wstats`.`healing_done`", "`char_wstats`.`wrong_healing_done`", "`char_wstats`.`hp_heal_potions`", "`char_wstats`.`sp_heal_potions`", "`char_wstats`.`yellow_gemstones`", "`char_wstats`.`red_gemstones`", "`char_wstats`.`blue_gemstones`", "`char_wstats`.`zeny_used`", "`char_wstats`.`ammo_used`", "`char_wstats`.`acid_demostration`", "`char_wstats`.`poison_bottles`"); if (!isset($_GET['myClass'])) { $myClass = "All"; } else { $myClass = $_GET['myClass']; } if (!isset($_GET['myTypeSort'])) { $myTypeSort = "0"; } else { $myTypeSort = $_GET['myTypeSort']; } if (!isset($_GET['mySort'])) { $mySort = "DESC"; } else { $mySort = $_GET['mySort']; } $bind = array(); $sql = "SELECT\n\t\t\t`char`.`name`, `char`.`class`, `char`.`base_level`, `char`.`job_level`, `char`.`playtime`, `char`.`max_hp`, `char`.`max_sp`, `char`.`str`, `char`.`int`, `char`.`vit`, `char`.`dex`, `char`.`agi`, `char`.`luk`, `char`.`char_id`,\n\t\t\t`login`.`sex`,\n\t\t\t`guild`.`name` AS `gname`, `guild`.`guild_id`, `guild`.`emblem_data`, `guild`.`emblem_len`,\n\t\t\t`char_wstats`.`score`, `char_wstats`.`kill_count`, `char_wstats`.`death_count`,\n\t\t\t`char_wstats`.`top_damage`, `char_wstats`.`damage_done`, `char_wstats`.`damage_received`,\n\t\t\t`char_wstats`.`emperium_damage`, `char_wstats`.`guardian_damage`, `char_wstats`.`barricade_damage`, `char_wstats`.`gstone_damage`,\n\t\t\t`char_wstats`.`emperium_kill`, `char_wstats`.`guardian_kill`, `char_wstats`.`barricade_kill`, `char_wstats`.`gstone_kill`,\n\t\t\t`char_wstats`.`sp_heal_potions`, `char_wstats`.`hp_heal_potions`, `char_wstats`.`yellow_gemstones`, `char_wstats`.`red_gemstones`, `char_wstats`.`blue_gemstones`,\n\t\t\t`char_wstats`.`poison_bottles`, `char_wstats`.`acid_demostration`, `char_wstats`.`acid_demostration_fail`, `char_wstats`.`support_skills_used`, `char_wstats`.`healing_done`, `char_wstats`.`ammo_used`,\n\t\t\t`char_wstats`.`wrong_support_skills_used`, `char_wstats`.`wrong_healing_done`, `char_wstats`.`sp_used`, `char_wstats`.`zeny_used`, `char_wstats`.`spiritb_used`\n\t\tFROM\n\t\t\t`char` JOIN `char_wstats` ON `char_wstats`.`char_id` = `char`.`char_id` JOIN `login` ON `login`.`account_id` = `char`.`account_id` JOIN `guild` ON `guild`.`guild_id` = `char`.`guild_id`\n\t\tWHERE\n\t\t\t`char_wstats`.`char_id` > '0' AND `login`.`level` < '1' AND `login`.`state` = '0' "; if ($myClass != "All") { $sql .= "AND `char`.`class` = '" . $myClass . "' "; } $sql .= "ORDER BY " . $SortType[$myTypeSort] . " " . $mySort; $sql .= " LIMIT 0, 20"; if ($myClass == "catj0bclass") { Print_r($server->connection); } $sth = $server->connection->getStatement($sql); $sth->execute($bind); $playerLadder = $sth->fetchAll();
/** * method onSave * Executed whenever the user clicks at the save button */ function onSave() { try { // open a transaction with database 'samples' TTransaction::open('db_crmbf'); new TSession(); $this->form->validate(); // read the form data and instantiates an Active Record $crm = $this->form->getData('Registro'); $crm->usuarioalteracao = TSession::getValue('login'); var_dump($crm); Print_r($_SESSION); // exit(); // if ($customer->contacts_list) { // foreach ($customer->contacts_list as $contact) { // // add the contact to the customer // $customer->addContact($contact); // } // } // // if ($customer->skill_list) { // foreach ($customer->skill_list as $skill_id) { // // add the skill to the customer // $customer->addSkill(new Skill($skill_id)); // } // } // stores the object in the database $crm->store(); $this->form->setData($crm); // shows the success message new TMessage('info', 'Registro Salvo'); TTransaction::close(); // close the transaction } catch (Exception $e) { // in case of exception $this->form->setData($crm); // shows the exception error message new TMessage('error', '<b>Error</b>' . $e->getMessage()); // undo all pending operations TTransaction::rollback(); } }
function index_search($text) { if (strstr($text, "debugmeplease")) { $debug = 1; $text = str_replace("debugmeplease", "", $text); } else { $debug = ""; } $db = new clsDBNetConnect(); if ($debug) { print $_POST["search"] . "<br>"; } $text = str_replace("\n", " ", $text); $text = " " . $text . " "; $text = preg_replace("/[^A-Z,^a-z,^\\',^0-9,^\\+,^\",^\\-,^\\*]/", " ", $text); if ($debug) { print $text . "<br>"; } preg_match_all("/\\s\"([A-Z,a-z,0-9,\\',\\s]+?)\"\\s/", $text, $quotedtext); if ($debug) { echo ($count = count($quotedtext[1])) . " Quoted delimited strings:"; Print_r($quotedtext[1]); } $text = preg_replace("/\\s\"([A-Z,a-z,0-9,\\',\\s]+?)\"\\s/", " ", $text); $text = str_replace(" ", " ", $text); $text = " " . $text . " "; if ($debug) { print "<br>" . $text . "<br>"; } preg_match_all("/\\s([A-Z,a-z,0-9,\\']+?)\\s/", $text, $ortext); if ($debug) { echo ($count = count($ortext[1])) . " space delimited strings:"; Print_r($ortext[1]); print "<br>"; } preg_match_all("/\\s\\+([A-Z,a-z,\\',0-9]+?)\\s/", $text, $includetext); if ($debug) { echo ($count = count($includetext[1])) . " included strings:"; Print_r($includetext[1]); print "<br>"; } preg_match_all("/\\s\\-([A-Z,a-z,\\',0-9]+?)\\s/", $text, $excludetext); if ($debug) { echo ($count = count($excludetext[1])) . " excluded strings:"; Print_r($excludetext[1]); print "<br>"; } preg_match_all("/\\s\\*([A-Z,a-z,\\',0-9]+?)\\s/", $text, $wildtext1); if ($debug) { echo ($count = count($wildtext1[1])) . " wild1 strings:"; Print_r($wildtext1[1]); print "<br>"; } preg_match_all("/\\s([A-Z,a-z,\\',0-9]+?)\\*\\s/", $text, $wildtext2); if ($debug) { echo ($count = count($wildtext2[1])) . " wild2 strings:"; Print_r($wildtext2[1]); print "<br>"; } preg_match_all("/\\s\\*([A-Z,a-z,\\',0-9]+?)\\*\\s/", $text, $wildtext3); if ($debug) { echo ($count = count($wildtext3[1])) . " wild3 strings:"; Print_r($wildtext3[1]); print "<br>"; } $i = 0; $x = 1; // Now for the Queries // Regular text, 'or' query if (count($ortext[1]) > 0) { $where = " where"; $i = 0; while ($ortext[1]["{$i}"]) { $where .= " value = '" . mysql_escape_string($ortext[1]["{$i}"]) . "'"; $i++; if ($ortext[1]["{$i}"]) { $where .= " or"; } else { $where .= ""; } } $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Or Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $ItemArray = ""; $OrItemNumbers = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } $i = 0; $ItemWhere = ""; while ($ItemArray["{$i}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$i}"]) . "'"; $i++; if ($ItemArray["{$i}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } if ($debug) { print_r($ItemArray); } } // Require Include if (count($includetext[1]) > 0) { if ($debug) { print "<hr><b>Required Include Section!</b><br>"; } //$where = " where ("; $i = 0; while ($includetext[1]["{$i}"]) { //$where .= "value = '" . mysql_escape_string($includetext[1]["$i"]) . "'"; //if ($includetext[1]["$i"] && $includetext[1]["$i"] != "") // $where .= " or "; //else // $where .= ""; //} if ($ItemWhere) { $ItemWhere = " and (" . $ItemWhere . ")"; } $query = "select distinct(ItemNum) from listing_index where value = '" . mysql_escape_string($includetext[1]["{$i}"]) . "'" . $ItemWhere; $db->query($query); if ($debug) { print "<b>Query for: </b>" . $includetext[1]["{$i}"] . "<br>" . $query . "<br>"; } $ItemArray = ""; $IncludeItemNumbers = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } $x = 0; $ItemWhere = ""; while ($ItemArray["{$x}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$x}"]) . "'"; $x++; if ($ItemArray["{$x}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } $i++; } if ($debug) { print_r($ItemArray); } } // Pre-Wild Text if (count($wildtext1[1]) > 0) { $where = " where ("; $i = 0; while ($wildtext1[1]["{$i}"]) { $where .= "value like '%" . mysql_escape_string($wildtext1[1]["{$i}"]) . "'"; $i++; if ($wildtext1[1]["{$i}"] && $wildtext1[1]["{$i}"] != "") { $where .= " or "; } else { $where .= ""; } } $where .= ")"; if ($ItemWhere) { $where = $where . " and ({$ItemWhere})"; } $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Pre-Wild Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $ItemArray = ""; $Wild1ItemNumbers = ""; $i = 0; $ItemWhere = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } while ($ItemArray["{$i}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$i}"]) . "'"; $i++; if ($ItemArray["{$i}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } if ($debug) { print_r($ItemArray); } } // Post-Wild Text if (count($wildtext2[1]) > 0) { $where = " where ("; $i = 0; while ($wildtext2[1]["{$i}"]) { $where .= "value like '" . mysql_escape_string($wildtext2[1]["{$i}"]) . "%'"; $i++; if ($wildtext2[1]["{$i}"] && $wildtext2[1]["{$i}"] != "") { $where .= " or "; } else { $where .= ""; } } $where .= ")"; if ($ItemWhere) { $where = $where . " and ({$ItemWhere})"; } $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Post-Wild Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $ItemArray = ""; $Wild2ItemNumbers = ""; $i = 0; $ItemWhere = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } while ($ItemArray["{$i}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$i}"]) . "'"; $i++; if ($ItemArray["{$i}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } if ($debug) { print_r($ItemArray); } } // Pre-Post-Wild Text if (count($wildtext3[1]) > 0) { $where = " where ("; $i = 0; while ($wildtext3[1]["{$i}"]) { $where .= "value like '%" . mysql_escape_string($wildtext3[1]["{$i}"]) . "%'"; $i++; if ($wildtext3[1]["{$i}"] && $wildtext3[1]["{$i}"] != "") { $where .= " or "; } else { $where .= ""; } } $where .= ")"; if ($ItemWhere) { $where = $where . " and ({$ItemWhere})"; } $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Pre-Post-Wild Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $ItemArray = ""; $Wild3ItemNumbers = ""; $i = 0; $ItemWhere = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } while ($ItemArray["{$i}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$i}"]) . "'"; $i++; if ($ItemArray["{$i}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } if ($debug) { print_r($ItemArray); } } // Require exclude if (count($excludetext[1]) > 0) { $where = " where ("; $i = 0; while ($excludetext[1]["{$i}"]) { $where .= "value = '" . mysql_escape_string($excludetext[1]["{$i}"]) . "'"; $i++; if ($excludetext[1]["{$i}"] && $excludetext[1]["{$i}"] != "") { $where .= " or "; } else { $where .= ""; } } $where .= ")"; if ($ItemWhere) { $where = $where . " and ({$ItemWhere})"; } $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Required Exclude Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $DiffArray = ""; $ExcludeItemNumbers = ""; while ($db->next_record()) { if (!$DiffArray || !in_array($db->f("ItemNum"), $DiffArray)) { $DiffArray[] = $db->f("ItemNum"); } } if ($DiffArray && $ItemWhere) { $i = 0; $temp = ""; while ($ItemArray["{$i}"]) { if (!$ItemArray || !in_array($ItemArray["{$i}"], $DiffArray)) { $temp[] = $ItemArray["{$i}"]; } $i++; } $ItemArray = $temp; } if (!$ItemWhere) { $where = " where ("; $i = 0; while ($DiffArray["{$i}"]) { $where .= "ItemNum != '" . mysql_escape_string($DiffArray["{$i}"]) . "'"; $i++; if ($DiffArray["{$i}"] && $DiffArray["{$i}"] != "") { $where .= " and "; } else { $where .= ""; } } $where .= ")"; $query = "select distinct(ItemNum) from listing_index" . $where; $db->query($query); if ($debug) { print "<hr><b>Required Exclude (No Other Matches) Section!</b> Items matching: <br><b>" . $query . "</b><hr>"; } $ExcludeItemNumbers = ""; while ($db->next_record()) { if (!$ItemArray || !in_array($db->f("ItemNum"), $ItemArray)) { $ItemArray[] = $db->f("ItemNum"); } } } $i = 0; $ItemWhere = ""; while ($ItemArray["{$i}"]) { $ItemWhere .= " ItemNum = '" . mysql_escape_string($ItemArray["{$i}"]) . "'"; $i++; if ($ItemArray["{$i}"]) { $ItemWhere .= " or"; } else { $ItemWhere .= ""; } } if ($debug) { print_r($ItemArray); } } // Quoted Comment Search if (count($quotedtext[1]) > 0) { if ($debug) { print "<hr><b>Quoted Match Section!</b><hr>"; } $i = 0; $finalmatch = ""; while ($quotedtext[1]["{$i}"]) { $quoteword = explode(" ", $quotedtext[1]["{$i}"]); $x = 0; $match = ""; while ($quoteword[$x]) { if ($where1 != " ") { if ($ItemWhere && !$where1) { $query = "select * from listing_index where `value` = '" . mysql_escape_string($quoteword[$x]) . "' and (" . $ItemWhere . ")"; } elseif ($where1 && $where1 != " ") { $query = "select * from listing_index where `value` = '" . mysql_escape_string($quoteword[$x]) . "' and ({$where1})"; } else { $query = "select * from listing_index where `value` = '" . mysql_escape_string($quoteword[$x]) . "'"; } if ($debug) { print $query . " - " . $ItemWhere; } $db->query($query); $where1 = " "; while ($db->next_record()) { $pos = $db->f("pos"); if ($match[$x - 1]) { $prevpos = $pos - 1; if ($match[$x - 1][$db->f("ItemNum")]["{$prevpos}"]) { $match[$x][$db->f("ItemNum")][$pos] = $pos; if (!stristr($where1, $db->f("ItemNum"))) { if ($where1 != " ") { $where1 .= " or "; } $where1 .= " ItemNum = '" . mysql_escape_string($db->f("ItemNum")) . "'"; } } } else { $match[$x][$db->f("ItemNum")][$pos] = $pos; if (!stristr($where1, $db->f("ItemNum"))) { if ($where1 != " ") { $where1 .= " or "; } $where1 .= " ItemNum = '" . mysql_escape_string($db->f("ItemNum")) . "'"; } } } $where1 .= ""; if ($debug) { print "<br><br> values: "; print $quoteword[$x] . "<br><br>"; print_r($match[$x]); print "<br><br>" . $where1; print "<hr>"; } } $x++; } $i++; } $ItemWhere = $where1; } if ($debug) { print "<br><br><b>FINAL WHERE Statement</b>: " . $ItemWhere; } return $ItemWhere; }
/** * Run script * */ public function run() { // Init GP Soap client $api = new Gorilla_Greatplains_Model_Soap(); // Initialize GP update model as used in hourly cron $model = Mage::getSingleton('greatplains/product'); $model->setGroupIds(); $model->startTime = date ("Y-m-d H:i:s", time() + ( 60 * 60) ); // Override starttime filter so we get all applicable skus $model->processEnabledOnly = true; $skus = array(); $update = (int)$this->getArg('update'); $min = $this->getArg('step'); $min = !empty($min) ? (int)$min : 0; echo "\nSKU=".$this->getArg('sku'); if($sku = $this->getArg('sku')) { $skus[] = $sku; } elseif ($attrSet = $this->getArg('attrset')) { // Get Skus for attr set switch(strtolower($attrSet)) { case 'downloadable': $arrAttrSet = array( 'attribute_set_id' => 15, 'attribute_set_name' => 'Downloadable' ); break; case 'event': $arrAttrSet = array( 'attribute_set_id' => 11, 'attribute_set_name' => 'Event' ); break; } if(isset($arrAttrSet) && is_array($arrAttrSet)) { $skus = $model->getProductSkusByAttributeSet($arrAttrSet); } } echo "Processing " . count($skus) . PHP_EOL; Print_r($skus); if(count($skus)) { $max = ($min + 1)*self::RANGE; if($max > count($skus)) $max = count($skus); //foreach($skus as $sku) { for($i = $min*self::RANGE ; $i < $max; $i++){ echo "Getting Product by SKU: " . PHP_EOL; //$data = $api->getProductBySku($sku); $data = $api->getProductBySku($skus[$i]); //$data->mySku = $sku; $data->mySku = $skus[$i]; // Dump API response print_r($data); // update data in Magento. if($update) { //echo "\nUpdating SKU $sku\n"; echo "\nUpdating SKU $sku\n"; //$model->_updateProductData($data, $sku); $model->_updateProductData($data, $skus[$i]); echo "\nDone.\n"; } } } }
$m = FILE($_FILES['userfile']['tmp_name']); // haalt het bestand op uit Input.php $hash = array(); print "<pre>"; print_r($m); print "</pre>"; $array = []; foreach ($m as $zinnen) { //per rij van $m $zinnen = trim($zinnen); $woorden = preg_split("/[ .!?,1234567890()\t_=+><-]+/", $zinnen); //haalt de woorden uit elkaar if (($woord = array_search('', $woorden)) !== false) { unset($woorden[$woord]); } foreach ($woorden as $c) { $x = strlen($c); $array[$x] = $c; } // nu nog in een doublylinkedlist maar dan moet ik dat eerst snappen // slaOpInHash($woorden); print "<pre>"; print_r($woorden); print_r(array_count_values($woorden)); // laat zien welke woorden hoevaak voorkomen print "</pre>"; $aantal = $aantal + count($woorden); // voegt woorden uit huidige zin aan $aantal toe binnen de functie } Print_r($aantal);