function set_prop_fields_from_standin() { $roni = 0; foreach ($_POST as $postkey => $postval) { $final_post_val = clean_request_val($_POST[$postkey]); if (is_array($final_post_val)) { continue; } $posted_lookup_field = trim($final_post_val); if (ereg("^standin_pi([0-9]+)epi([0-9]+)ron([0-9]+)\$", $postkey, $regs) and (!empty($posted_lookup_field) or empty($posted_lookup_field) and $regs[2] != 0)) { $prop_id = $regs[1]; $ent_prop_id = $regs[2]; $roni = $regs[3]; LookupTable::get_table_and_field_by_prop_id($prop_id, $lookuptable, $lookupfield); $sql = "SELECT " . $lookuptable . "_id FROM {$lookuptable} WHERE {$lookupfield} = '{$posted_lookup_field}'"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { $_POST[str_replace("standin_", "", $postkey)] = $row[$lookuptable . "_id"]; $_REQUEST[str_replace("standin_", "", $postkey)] = $row[$lookuptable . "_id"]; } else { $sql = "INSERT INTO " . $lookuptable . " SET {$lookupfield} = '{$posted_lookup_field}'"; mysql_query($sql); $inserted_id = mysql_insert_id(); $_POST[str_replace("standin_", "", $postkey)] = $inserted_id; $_REQUEST[str_replace("standin_", "", $postkey)] = $inserted_id; } } } }
function set_lookuptable_xml() { $lookuptable = new LookupTable($_REQUEST["table_name"]); $table_hash = $lookuptable->get_table(); $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $lookup_item_group = $doc->createElement('lookup_item_group'); $lookup_item_group = $doc->appendChild($lookup_item_group); $lookup_item_group->setAttribute('lookup_table_name', $_REQUEST["table_name"]); foreach ($table_hash as $cat_id => $catval_ar) { $lookup_item = $doc->createElement('lookup_item'); $lookup_item = $lookup_item_group->appendChild($lookup_item); $lookup_item->setAttribute('prim_key_col', $cat_id); $lookup_item->setAttribute('lookup_value_col', $catval_ar[0]); $lookup_item->setAttribute('is_disabled', $catval_ar["disabled"]); } $this->lookuptable_xml = $doc->saveXML(); }
function get_value_by_id($id, $prop_id) { LookupTable::get_table_by_prop_id($prop_id, $table_name); if (!$table_name) { die("error: LookupTable 232kdklwk33k3k4"); } $lookuptable = new LookupTable($table_name); $sql = "SELECT " . $lookuptable->lookup_value_col . " FROM " . $lookuptable->tbl_name . " WHERE " . $lookuptable->prim_key_col . " = '" . $id . "'"; $result = mysql_query($sql); if (!mysql_num_rows($result)) { die("Error: LookupTable {$table_name} - no value for id: {$id} "); } return mysql_result($result, 0, $this->lookup_value_col); }
<?php require_once 'LookupTable.php'; $md5 = new LookupTable("words-md5.idx", "words.txt", "md5"); $to_crack = md5("grape"); $result = $md5->crack($to_crack); if ($result !== FALSE) { echo "Cracked: " . $result[0] . "\n"; }
function get_table_DS($table_name) { $lookup_table = new LookupTable($table_name); return $lookup_table->get_table(); }
<?php include_once dirname(__FILE__) . '/../commonfunc.php'; site_setup(); // include_once ($_SERVER['DOCUMENT_ROOT'].'/classes/MainClient/Main.php'); // include_once ($_SERVER['DOCUMENT_ROOT'].'/classes/ClientServerDataOps/LookupTable.php'); // include_once ($_SERVER['DOCUMENT_ROOT'].'/functions/commonfunc.php'); $main = new Main(); //db connection LookupTable::get_table_and_field_by_prop_id(clean_request_val($_GET['prop_id']), $lookuptable, $lookupfield); $sql = "SELECT " . $lookupfield . " FROM " . $lookuptable . " WHERE " . $lookupfield . " LIKE '%" . clean_request_val($_POST[$_GET['postedfield']]) . "%'"; $resource = mysql_query($sql); ?> <ul> <? while($taken = mysql_fetch_assoc($resource)) { ?> <li><? echo stripslashes($taken[$lookupfield]);?></li> <? } ?> </ul>
function get_list() { $lookup_table = new LookupTable("category"); return $lookup_table->get_table(); }
function add_category_list() {//return; //$category_hash = OutputSys_EntityManagementSystems::get_category_list(); $lookuptable = new LookupTable("category"); $category_hash = $lookuptable->get_table(); $category_type_matrix = OutputSys_EntityManagementSystems::get_category_type_mapping(); /* $doc = new DOMDocument('1.0','UTF-8'); $doc->formatOutput = true; $root = $doc->createElement('myedbroot'); $root = $doc->appendChild($root); */ $cats = $this->doc->createElement('categories'); $this->doc_root->appendChild($cats); foreach ($category_hash as $cat_id => $cat_name_ar) { $cat_name = $cat_name_ar[0]; $cat = $this->doc->createElement('category'); $cats->appendChild($cat); $cat->setAttribute("cat_id",$cat_id); $cat->setAttribute("is_disabled",$cat_name_ar['disabled']); //add elements showing which types are associated with this category $types = $this->doc->createElement('cattypes'); $cat->appendChild($types); if (is_array($category_type_matrix[$cat_id]))//if not set, means no records associated with category { foreach($category_type_matrix[$cat_id] as $type_id) { $type = $this->doc->createElement('cattype'); $types->appendChild($type); $type_id_txt = $this->doc->createTextNode($type_id); $type->appendChild($type_id_txt); } } //add category text node $catval = $this->doc->createElement('catval'); $cat->appendChild($catval); $catnm_node = $this->doc->createTextNode($cat_name); $catval->appendChild($catnm_node); } // $rec->glu->prop_ids_num_extra[6] = 1; // $rec->glu->set_prop_ids_num_extra_by_group_id(1); //$rec->glu->set_prop_ids_num_extra_by_group_id(1); // $xslt_file = $_SERVER['DOCUMENT_ROOT']."/XSLTemplates/testrecs.xsl"; //$xml_string = $doc->saveXML(); }