8 ) { // YYYY?mm?dd // 0123456789 $ret = substr($dt,5,2).$delim.substr($dt,8,2).$delim.substr($dt,0,4); } else { // YYYYmmdd // 01234567 $ret = substr($dt,4,2).$delim.substr($dt,6,2).$delim.substr($dt,0,4); } return $ret; } //chg_Ymd_mdY function chg_mdY_Ymd($dt,$delim) { if (strlen($dt) > 8 ) { // mm?dd?YYYY // 0123456789 $ret = substr($dt,6,4).$delim.substr($dt,0,2).$delim.substr($dt,3,2); } else { // mmddYYYY // 01234567 $ret = substr($dt,4,4).$delim.substr($dt,0,2).$delim.substr($dt,2,2); } return $ret; } //chg_mdY_Ymd function texter($piece,$val,$text) { if (strpos(' '.$piece,$val) > 0 ) { $piece = ereg_replace($val,''.$val.'',$piece); } return $piece; } //texter function comSt($st) { return ''.$st.'   '; } function colHead($colName,$bkgd="#6666cc",$frgd="#FFFFFF") { return colHeads($colName,strtoupper($colName),"",$bkgd,$frgd); } //colHead() function colHeads($colName, $colTitle,$hint="",$bkgd="#6666cc",$frgd="#FFFFFF") { $name = $colName; $title = $colTitle; $title = ereg_replace('_FEE' ,'',$title); $title = ereg_replace('_YN' ,'',$title); $title = ereg_replace('_ST' ,'',$title); $title = ereg_replace('_END' ,'',$title); $title = ereg_replace('_ADMIT','',$title); return '
  '.$title.'  
'; } //colHeads() function colVal($rowv,$col) { return colvName($rowv[$col],$col); } //colVal() function colv($val) { return colvName($val,'unknown'); } //colv() function colvName($val,$name) { if (strpos(strtoupper($name),'_YN') > 0 ) { if ($val == 'Y') $ret = ''; else $ret = ' '; } else { $ret = svl($val,' '); } if ((strpos(strtoupper($name),'_ADMIT') > 0 || strpos(strtoupper($name),'_FEE') > 0 ) && strpos(strtoupper($name),'_YN') == 0 && $ret != ' ') $ret = '$'.$ret; return ''.$ret.''; } //colvName() function get_sel($sel,$val,$dsp) { if ( $sel == $val) $mtch = ' selected'; else $mtch = ''; return ' '; } //get_sel() function get_post($var,$nullval) { if (empty($_POST[$var])) return $nullval; else { return ereg_replace('insert','', ereg_replace('update','', ereg_replace('delete','', ereg_replace('select','', ereg_replace('[;]','', ereg_replace('[/]','', ereg_replace('[?]','', ereg_replace('[@]','', ereg_replace('[&]','', ereg_replace('[#]','', ereg_replace('[%]','', ereg_replace('[<]','', ereg_replace('[>]','', ereg_replace('[,]','', ereg_replace('[$]','', ereg_replace('[;]','', ereg_replace('[*]','', ereg_replace('\'','', ereg_replace('["]','', ereg_replace('[\]','', ereg_replace('[~]','', ereg_replace('[(]','', ereg_replace('[)]','',$_POST[$var]))))))))))))))))))))))); } } // get_post() function chkPostVal($val,$def) { if (!strlen($val) > 0 | $val == "NaN" | is_null($val)) return $def; else return $val; } //chkPostVal() function onvl($TestVar,$ValueIfNull) { if (is_null($TestVar) || strlen($TestVar) == 0) return $ValueIfNull; else return $TestVar; } function old_svl($TestVar,$ValueIfNull) { if (is_null($TestVar) | $TestVar == '') return $ValueIfNull; else return $TestVar; } //old_svl function ifi($pre,$info,$post) { if (strlen($info) > 0 ) return $pre.$info.$post; else return $info; } //ifi() function feature($row,$feature) { if ($row[$feature] == 'Y') return substr($feature,0,strlen($feature)-3); else return ''; } // feature require("../BootStrap/includes/header.php"); require("../BootStrap/includes/navigation.php"); echo '
'; $print = get_post('printYN','no'); $selPrintYN = ''; if ($print == 'yes') $selPrintYN = 'checked'; //echo "printYN: ".$printYN.''; $q = get_post('criteria',''); if ($q == '') $message .= '

Invalid Criteria Value

'; $displayinfo = get_post('displayinfo',''); if ($displayinfo == '') $message .= '

Invalid Display Info Value

'; $displaytype = get_post('displaytype',''); if ($displaytype == '') $message .= '

Invalid Display Type Value

'; $displayrows = get_post('displayrows',''); if ($displayrows == '') $message .= '

Invalid Display Rows Value

'; $displaycnt = get_post('displaycnt',0); if ($displaycnt == '') $message .= '

Invalid Display Cnt Value

'; $displayformat = get_post('displayformat',0); if ($displayformat == '') $message .= '

Invalid Display Format Value

'; $matchAny = get_post('matchAny',''); if ($matchAny == '') $message .= '

Invalid MatchAny Value

'; $def_date1 = date("m/d/Y",mktime(0, 0, 0, date("m"), date("d")-7, date("Y"))); $gm_date1 = get_post('date1',$def_date1); if ($gm_date1 == '') $message .= '

Invalid Date1 Value

'; $def_date2 = date("m/d/Y",mktime(0, 0, 0, date("m"), date("d"), date("Y")+1)); $gm_date2 = get_post('date2',$def_date2); if ($gm_date2 == '') $message .= '

Invalid Date2 Value

'; $orderby = get_post("orderby"," name"); if ($orderby == '') $message .= '

Invalid Order By Value

'; /*************************************************************** * * SET POSTED VALUES INTO VARIABLES * ***************************************************************/ $postedvals = get_post('postedvals',''); $displayname = get_post('displayname',''); $displayrefract = get_post('displayrefract',''); $displayRI = get_post('displayRI',''); $selSpot_YN = get_post('selSpot_YN',''); $displaybiref = get_post('displaybiref',''); $displaypleo = get_post('displaypleo',''); $SGair = get_post('air',''); $SGwater = get_post('water',''); $displaySG = get_post('displaySG',''); $displayoptchar = get_post('displayoptchar',''); $displayoptsign = get_post('displayoptsign',''); $displayrows = get_post('displayrows',''); /* $filterrefract = get_post('filterrefract',''); $filterbiref = get_post('filterbiref',''); $filterpleo = get_post('filterpleo',''); $filtersg = get_post('filtersg',''); $filteropticchar = get_post('filteropticchar',''); $filterAll = get_post('filterAll',''); */ $displaycolor = get_post('displaycolor',''); $displaytransparency = get_post('displaytransparency',''); $displayfracture = get_post('displayfracture',''); $displaycleavages = get_post('displaycleavages',''); $displaycleavage = get_post('displaycleavage',''); $displayLW = get_post('displayLW',''); $displaySW = get_post('displaySW',''); $selphosphorescence_YN = get_post('selphosphorescence_YN',''); $displaymohs = get_post('displaymohs',''); /* $filtercolor = get_post('filtercolor',''); $filtertransparency = get_post('filtertransparency',''); $filterfracture = get_post('filterfracture',''); $filtercleavages = get_post('filtercleavages',''); $filtercleavage = get_post('filtercleavage',''); $filterUV = get_post('filterUV',''); $filtermohs = get_post('filtermohs',''); */ /*************************************************************** * * SET POSTED VALUES INTO VARIABLES * ***************************************************************/ $postedvals = chkPostVal($postedvals,''); $displayinfo = chkPostVal($displayinfo,'all'); $displayname = chkPostVal($displayname,''); $displayRI = chkPostVal($displayRI,''); $selSpot_YN = chkPostVal($selSpot_YN,''); $displaybiref = chkPostVal($displaybiref,''); $displayrows = chkPostVal($displayrows,'10'); $displaytype = chkPostVal($displaytype,'verbose'); $orderby = chkPostVal($orderby ," name,".$mysql_date_Ymd); $displaycnt = chkPostVal($displaycnt ,'0'); $displayrefract = chkPostVal($displayrefract,''); $displaypleo = chkPostVal($displaypleo,''); $SGair = chkPostVal($SGair,''); $SGwater = chkPostVal($SGwater,''); $displaySG = chkPostVal($displaySG,''); $displayoptchar = chkPostVal($displayoptchar,''); $displayoptsign = chkPostVal($displayoptsign,''); $displayrows = chkPostVal($displayrows,''); /* $filterrefract = chkPostVal($filterrefract,''); $filterbiref = chkPostVal($filterbiref,''); $filterpleo = chkPostVal($filterpleo,''); $filtersg = chkPostVal($filtersg,''); $filteropticchar = chkPostVal($filteropticchar,''); $filterAll = chkPostVal($filterAll,''); */ $displaycolor = chkPostVal($displaycolor,''); $displaytransparency = chkPostVal($displaytransparency,''); $displayfracture = chkPostVal($displayfracture,''); $displaycleavages = chkPostVal($displaycleavages,''); $displaycleavage = chkPostVal($displaycleavage,''); $displayLW = chkPostVal($displayLW,''); $displaySW = chkPostVal($displaySW,''); $selphosphorescence_YN = chkPostVal($selphosphorescence_YN,''); $displaymohs = chkPostVal($displaymohs,''); /* $filtercolor = chkPostVal($filtercolor,''); $filtertransparency = chkPostVal($filtertransparency,''); $filterfracture = chkPostVal($filterfracture,''); $filtercleavages = chkPostVal($filtercleavages,''); $filtercleavage = chkPostVal($filtercleavage,''); $filterUV = chkPostVal($filterUV,''); $filtermohs = chkPostVal($filtermohs,''); */ $orderby = ereg_replace("\\\'","'",$orderby); $orderby = ereg_replace("\\'","'",$orderby); $phproot = '/php/'; //----------------------------------------- //----------------------------------------- $thisFile = substr($SCRIPT_FILENAME,strrpos($SCRIPT_FILENAME,'/')+1,strlen($SCRIPT_FILENAME)); $thisFile = substr($thisFile,0,strrpos($thisFile,'.php')); $htmlpos = strpos($SCRIPT_FILENAME,'public_html'); /// /home/pretty4/public_html/php/gem-instruments.php $thisFileAddr ='www.PrettyRock.com'.substr($SCRIPT_FILENAME,strpos($SCRIPT_FILENAME,'public_html')+11,strlen($SCRIPT_FILENAME)); $thisQuery = substr($thisFile,strpos($thisFile,'-')+1,strlen($thisFile)); $thisQuery =substr($thisQuery,strpos($thisQuery,'-')+1,strlen($thisQuery)); $cat = substr($thisQuery,0,strpos($thisQuery,'-')); $catval = substr($thisQuery,strpos($thisQuery,'-')+1,strlen($thisQuery)); $catval = ereg_replace('-',' ',$catval); $phpInventoryType = strtoupper(ereg_replace('-',' ',$thisFile)); $phpfile1 = substr($thisFile,0,strpos($thisFile,'-')); $phpfile2 = substr($thisFile,strpos($thisFile,'-')+1,strlen($thisFile)); $phpfile3 = substr($thisFile,strrpos($thisFile,'-')+1,strlen($thisFile)); $phpfile = $phpfile1."-".$phpfile2; $phpfileInitUpper = strtoupper(substr($phpfile1,0,1)) . substr($phpfile1,1)." ".strtoupper(substr($phpfile2,0,1)) . substr($phpfile2,1); //$phpInventoryType = strtoupper($phpfileInitUpper); //----------------------------------------- //----------------------------------------- $self ="www.prettyrock.com".$phproot.$phpfile."-".$q."-".$val.".php"; $page_title = $phpfileInitUpper.' - '.ucwords($q).' - '.ucwords($val); $dbsearch = strtoupper(ereg_replace('-',' ',$phpfile)); echo ''. $page_title.' - PrettyRock.com'; //include_once ('phptop.htm'); //print_header('Gem Mineral Shows'); echo ''; echo ' '; if ( strlen($postedvals) == 0 ) { echo '

Gem ID Database
PrettyRock.com presents a gemological research database that allows you to quickly find the gemstones that match the properties revealed by using gem identification instruments. The dark blue header shows the instrument used to reveal a specific property. The light blue header shows the properties reveal by the instrument above it. The next row is where you enter in the properties you get from your gemstones. The last row allows you to set how precise the search should be. Click Find Matches to search for gemstones that match the properties you have entered.

'; } else { echo '
Gem ID Database - search provided by PrettyRock.com   Clear Search
'; } if (substr($val,0,4)=='less') { $val = '<'.substr($val,4,10); } if (substr($val,0,4)=='more') { $val = '>'.substr($val,4,10); } if ($q=='%') { $q = ''; } /******************************************************************** ******************************************************************** SEARCH SECTION ********************************************************************* *********************************************************************/ $category_value = strtoupper(substr($val,0,1)) . substr($val,1); if ($category_value == 'Recent') $category_value = 'Recent Listings'; echo '
'; echo '
'; echo ''; /* first set of properties */ echo ''. ' '. ''. ''. ''. ''; echo ''. ' '. ''. ''. ''. ''; echo ''; echo ''; if ($selSpot_YN == 'Yes') $selSpot_YN = 'checked'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
RefractometerDichroscopeSG Kit Cts AirPolariscope / ConoscopeGem Name:
RISpot?BiRefringenceRefractivityPleochroismSG       Cts WtrOptic Char.Optic Sign'. ''. '

'; /* second set of properties */ echo ''; echo ' '. ''. ''. ''; echo ' '. ''. ''. ''; /* eyes - color, transparency, fracture, cleavages, cleavage dichroscope - pleo, refractometer - RI, Birefringence, refractivity, optic char, RI and visual plotting - to get optic sign polariscope - optic char, optic sign =? interference figure specific gravity - SG hardness points - mohs LW / SW , Phosphorescence- UV Light */ echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ($selphosphorescence_YN == 'Yes') $selphosphorescence_YN = 'checked'; echo ''; echo ''; echo ''; //'; /* echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; */ echo '
Visual PropertiesUV LightPicks
ColorTransparencyFractureCleavagesCleavageLWSWPhosphorescenceMohs
'; //findMatches table $filterrefract0='0'; $filterrefract1='.01'; $filterrefract2='.02'; $filterrefract3='.03'; $filterbiref0='0'; $filterbiref1='.3'; $filterbiref2='.7'; $filterbiref3='1'; $filterpleo0='0'; $filterpleo1='1'; $filterpleo2='1'; $filterpleo3='1'; $filtersg0='0'; $filtersg1='.01'; $filtersg2='.05'; $filtersg3='.1'; $filteropticchar0='1'; $filteropticchar1='2'; $filteropticchar2='2'; $filteropticchar3='2'; $filtercolor0='1'; $filtercolor1='1'; $filtertransparency0='1'; $filterfracture0='1'; $filterfracture1='2'; $filterfracture2='2'; $filterfracture3='2'; $filtercleavages0='1'; $filtercleavages1='2'; $filtercleavages2='2'; $filtercleavages3='2'; $filtercleavage0='1'; $filtercleavage1='1'; $filtercleavage2='1'; $filtercleavage3='1'; $filterUV0='1'; $filterUV1='2'; $filterUV2='2'; $filterUV3='2'; $filtermohs0='0'; $filtermohs1='1'; $filtermohs2='2'; $filtermohs3='3'; if (strlen($displaycnt) == 0 ) { $displaycnt = 0; } echo ''; echo ''; $q2 = $q; $w_cnt = 0; $postedvals = ""; $where = ""; $where0 = ""; $where1 = ""; $where2 = ""; $where3 = ""; if (strlen($displayname)>0 ) { $postedvals = $postedvals ."[name:$displayname]"; $where0 = $where0. " and concat(concat(name,','),ifnull(common_names,' ')) like '%$displayname%' "; } if (strlen($displayRI)>0 && $selSpot_YN != 'checked') { $postedvals = $postedvals ."[RI:$displayRI:$filterrefract]"; $where0 = $where0. ' and '.$displayRI.' between trim(ri1)-'.onvl($filterrefract0,'0').' and ifnull(ri2,ri1)+'.onvl($filterrefract0,'0').''; $where1 = $where1. ' and '.$displayRI.' between trim(ri1)-'.onvl($filterrefract1,'0').' and ifnull(ri2,ri1)+'.onvl($filterrefract1,'0').''; $where2 = $where2. ' and '.$displayRI.' between trim(ri1)-'.onvl($filterrefract2,'0').' and ifnull(ri2,ri1)+'.onvl($filterrefract2,'0').''; $where3 = $where3. ' and '.$displayRI.' between trim(ri1)-'.onvl($filterrefract3,'0').' and ifnull(ri2,ri1)+'.onvl($filterrefract3,'0').''; } if (strlen($displayRI)>0 && $selSpot_YN == 'checked') { $postedvals = $postedvals ."[RI:SPOT]"; $where0 = $where0. ' and ri_spot between '.onvl($displayRI,'0').'-'.onvl($filterrefract0,'0').' and '.onvl($displayRI,'0').'+'.onvl($filterrefract0,'0').' '; $where1 = $where1. ' and ri_spot between '.onvl($displayRI,'0').'-'.onvl($filterrefract1,'0').' and '.onvl($displayRI,'0').'+'.onvl($filterrefract1,'0').' '; $where2 = $where2. ' and ri_spot between '.onvl($displayRI,'0').'-'.onvl($filterrefract2,'0').' and '.onvl($displayRI,'0').'+'.onvl($filterrefract2,'0').' '; $where3 = $where3. ' and ri_spot between '.onvl($displayRI,'0').'-'.onvl($filterrefract3,'0').' and '.onvl($displayRI,'0').'+'.onvl($filterrefract3,'0').' '; } if (strlen($displaybiref)>0) { $postedvals = $postedvals ."[BiRef:$displaybiref:$filterbiref]"; $where0 = $where. ' and '.$displaybiref.' between birefringe1-'.onvl($filterbiref0,'0').' and ifnull(birefringe2,birefringe1)+'.onvl($filterbirefringe0,'0').' '; $where1 = $where. ' and '.$displaybiref.' between birefringe1-'.onvl($filterbiref1,'0').' and ifnull(birefringe2,birefringe1)+'.onvl($filterbirefringe1,'0').' '; $where2 = $where. ' and '.$displaybiref.' between birefringe1-'.onvl($filterbiref2,'0').' and ifnull(birefringe2,birefringe1)+'.onvl($filterbirefringe2,'0').' '; $where3 = $where. ' and '.$displaybiref.' between birefringe1-'.onvl($filterbiref3,'0').' and ifnull(birefringe2,birefringe1)+'.onvl($filterbirefringe3,'0').' '; } if (strlen($displayrefract)>0) { $postedvals = $postedvals ."[BiRef:$displayrefract]"; $where0 = $where0 . ' and refract =\''.$displayrefract.'\' '; $where1 = $where1 . ' and refract =\''.$displayrefract.'\' '; $where2 = $where2 . ' '; $where3 = $where3 . ' '; } if (strlen($displaypleo)>0) { $postedvals = $postedvals ."[Pleo:$displaypleo:$filterpleo]"; $pleo_num = trim(substr($displaypleo.' ',0,strpos($displaypleo.' ',' '))); $pleo_pwr = trim(substr($displaypleo.' ',strpos($displaypleo.' ',' ')+1,strlen($displaypleo.' '))); // echo 'filterpleo: ['.$filterpleo.'] pleo: ['.ereg_replace(' ','',$displaypleo).'] num: ['.$pleo_num.'] pwr: ['.$pleo_pwr.']'; //$row['pleo'].' '.$row['pleo_pwr'] // switch(onvl($filterpleo,'0')) { // case '0': // exact --NOTE THAT 1COLOR IN DB IS NULL! $where0 = $where0 . " and ifnull(trim(pleo),'1') like '%$pleo_num%' "; $where0 = $where0 . " and ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' "; // break; // case '1': // strict $where1 = $where1 . " and ifnull(trim(pleo),'1') like '%$pleo_num%' "; switch ($pleo_pwr) { case 'S': $where1 = $where1 . " and ( pleo_pwr like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ". " or pleo_pwr is null ) "; break; case 'M': $where1 = $where1 . " and ( pleo_pwr like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%W%' ". " or pleo_pwr like '%S%' ". " or pleo_pwr is null ) "; break; case 'W': $where1 = $where1 . " and ( pleo_pwr like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ". " or pleo_pwr is null ) "; break; } // case '2': // moderate $where2 = $where2 . " and ( ifnull(trim(pleo),'1') like '%$pleo_num%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)-1)."%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)+1)."%' ) "; switch ($pleo_pwr) { case 'S': $where2 = $where2 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ". " or pleo_pwr is null ) "; break; case 'M': $where2 = $where2 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%W%' ". " or pleo_pwr like '%S%' ". " or pleo_pwr is null ) "; break; case 'W': $where2 = $where2 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ". " or pleo_pwr is null ) "; break; } // break; // case '3': // loose $where3 = $where3 . " and ( ifnull(trim(pleo),'1') like '%$pleo_num%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)-1)."%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)+1)."%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)-2)."%' ". " or ifnull(trim(pleo),'1') like '%".strval(intval($pleo_num)+2)."%' )"; switch ($pleo_pwr) { case 'S': $where3 = $where3 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ) "; break; case 'M': $where3 = $where3 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%W%' ". " or pleo_pwr like '%S%' ". " or pleo_pwr is null ) "; break; case 'W': $where3 = $where3 . " and ( ifnull(trim(pleo_pwr),'Z') like '%".onvl($pleo_pwr,'Z')."%' ". " or pleo_pwr like '%M%' ". " or pleo_pwr is null ) "; break; } // break; // } } if (strlen($displaySG)>0) { $postedvals = $postedvals ."[SG:$displaySG:$filtersg]"; //if ($filtersg == 0) { $where0 = $where0. " and ".$displaySG."=sg"." "; //} else { $where1 = $where1. " and ".$displaySG." between sg-ifnull(abs(sg_dev_neg),0)-".onvl($filtersg1,0). " and sg+ifnull(trim(sg_dev_pos),0)+".onvl($filtersg1,0)." "; $where2 = $where2. " and ".$displaySG." between sg-ifnull(abs(sg_dev_neg),0)-".onvl($filtersg2,0). " and sg+ifnull(trim(sg_dev_pos),0)+".onvl($filtersg2,0)." "; $where3 = $where3. " and ".$displaySG." between sg-ifnull(abs(sg_dev_neg),0)-".onvl($filtersg3,0). " and sg+ifnull(trim(sg_dev_pos),0)+".onvl($filtersg3,0)." "; // } } if (strlen($displayoptchar)>0) { $postedvals = $postedvals ."[OptChar:$displayoptchar:$filteropticchar]"; $where0 = $where0. " and optic_char = '".$displayoptchar."' "; // if (onvl($filteropticchar,1) == 2) { // if (strlen($displayoptsign)>0) { $where1 = $where1. " and optic_char = '".$displayoptchar."' "; // } else { $where2 = $where2. " and optic_char in ('U','B','".$displayoptchar."') "; $where3 = $where3. " and optic_char in ('U','B','".$displayoptchar."') "; // } // } } if (strlen($displayoptsign)>0) { $postedvals = $postedvals ."[OptSign:$displayoptsign:$filteropticchar]"; // if (onvl($filteropticchar,1) == 1) { $where0 = $where0. " and optic_sign = '".ereg_replace('[+][-]','',$displayoptsign)."' and 1=1 "; // } // if (onvl($filteropticchar,1) == 2) { // if (strlen($displayoptchar)>0) { $where1 = $where1. " and optic_sign in ('','+','-','".ereg_replace('[+][-]','',$displayoptsign)."') and 2=2 "; // } else { $where2 = $where2. " and optic_sign in ('','".ereg_replace('[+][-]','',$displayoptsign)."') and 3=3 "; $where3 = $where3. " and optic_sign in ('','".ereg_replace('[+][-]','',$displayoptsign)."') and 3=3 "; // } // } } if (strlen($displaycolor) >0) { $postedvals = $postedvals ."[Color:$displaycolor:$filtercolor]"; $where0 = $where0 . " and ( instr(concat(colors,','),'".$displaycolor.",') > 0 or instr(colors,'".$displaycolor." ') > 0 ) "; } if (strlen($displaytransparency) >0) { $postedvals = $postedvals ."[Transp:$displaytransparency]"; $lst_trans1 = $displaytransparency; $where0 = $where0 . " and instr(concat(',',concat(transparency,',')),',".$displaytransparency.",') > 0 "; } if (strlen($displayfracture) >0) { $postedvals = $postedvals ."[Fracture:$displayfracture:$filterfracture]"; // if (onvl($filterfracture,1) == 1) { $lst_fract1 = $displayfracture; $where0 = $where0 . " and instr(concat(',',concat(fracture,',')),',".$displayfracture.",') > 0 "; // } else { $lst_fract1 = $displayfracture; $lst_fract2 = 'Z'; $lst_fract3 = 'Z'; switch($displayfracture) { case 'G': $list_fract2 = 'C'; $list_fract3 = 'U'; break; case 'C': $list_fract2 = 'SC'; $list_fract3 = 'U'; break; case 'SC': $list_fract2 = 'C'; $list_fract3 = 'U'; break; case 'U': $list_fract2 = 'S'; $list_fract3 = 'C'; break; case 'S': $list_fract2 = 'U'; $list_fract3 = 'C'; break; case 'B': $list_fract2 = 'SC'; $list_fract3 = 'C'; break; } $where1 = $where1 . " and ( instr(concat(',',concat(fracture,',')),',".$list_fract1.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract2.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract3.",') > 0 ) "; $where2 = $where2 . " and ( instr(concat(',',concat(fracture,',')),',".$list_fract1.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract2.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract3.",') > 0 ) "; $where3 = $where3 . " and ( instr(concat(',',concat(fracture,',')),',".$list_fract1.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract2.",') > 0 or instr(concat(',',concat(fracture,',')),',".$list_fract3.",') > 0 ) "; // } } if (strlen($displaycleavages) >0) { $postedvals = $postedvals ."[Cleavages:$displaycleavages:$filtercleavages]"; //if (onvl($filtercleavages,1) == 1) { $where0 = $where0 . " and instr(cleavage,'$displaycleavages') > 0 "; // } else { $lst_cleavages1 = $displaycleavages; $lst_cleavages2 = $displaycleavages-1; $lst_cleavages3 = $displaycleavages+1; $where1 = $where1 . " and ( instr(cleavage,'$lst_cleavages1') > 0 or instr(cleavage,'$lst_cleavages2') > 0 or instr(cleavage,'$lst_cleavages3') > 0 ) "; $where2 = $where2 . " and ( instr(cleavage,'$lst_cleavages1') > 0 or instr(cleavage,'$lst_cleavages2') > 0 or instr(cleavage,'$lst_cleavages3') > 0 ) "; $where3 = $where3 . " and ( instr(cleavage,'$lst_cleavages1') > 0 or instr(cleavage,'$lst_cleavages2') > 0 or instr(cleavage,'$lst_cleavages3') > 0 ) "; //} } if (strlen($displaycleavage) >0) { $postedvals = $postedvals ."[Cleavage:$displaycleavage:$filtercleavage]"; // if (onvl($filtercleavage,1) == 1) { $where0 = $where0 . " and instr(cleavage,'$displaycleavage') > 0 "; // } } if (strlen($displayLW) >0) { $postedvals = $postedvals ."[LW:$displayLW:$filterUV]"; // if (onvl($filterUV,1) == 1) { $where0 = $where0 . " and instr(UW,'$displayLW') > 0 "; // } else { $lst_LW1 = $displayLW; switch ($displayLW) { case 'Inert': $lst_LW2 = 'Weak'; $lst_LW3 = 'ZZZ'; break; case 'Weak': $lst_LW2 = 'Inert'; $lst_LW3 = 'Moderate'; break; case 'Moderate': $lst_LW2 = 'Weak'; $lst_LW3 = 'Strong'; break; case 'Strong': $lst_LW2 = 'Moderate'; $lst_LW3 = 'ZZZ'; break; } $where1 = $where1 . " and ( instr(UW,'$lst_LW1') > 0 or instr(UW,'$lst_LW2') > 0 or instr(UW,'$lst_LW3') > 0 ) "; $where2 = $where2 . " and ( instr(UW,'$lst_LW1') > 0 or instr(UW,'$lst_LW2') > 0 or instr(UW,'$lst_LW3') > 0 ) "; $where3 = $where3 . " and ( instr(UW,'$lst_LW1') > 0 or instr(UW,'$lst_LW2') > 0 or instr(UW,'$lst_LW3') > 0 ) "; // } } if (strlen($displaySW) >0) { $postedvals = $postedvals ."[SW:$displaySW:$filterUV]"; //if (onvl($filterUV,1) == 1) { $where0 = $where0 . " and instr(LW,'$displaySW') > 0 "; //} else { $lst_SW1 = $displaySW; switch ($displaySW) { case 'Inert': $lst_SW2 = 'Weak'; $lst_SW3 = 'ZZZ'; break; case 'Weak': $lst_SW2 = 'Inert'; $lst_SW3 = 'Moderate'; break; case 'Moderate': $lst_SW2 = 'Weak'; $lst_SW3 = 'Strong'; break; case 'Strong': $lst_SW2 = 'Moderate'; $lst_SW3 = 'ZZZ'; break; } $where1 = $where1 . " and ( instr(LW,'$lst_SW1') > 0 or instr(LW,'$lst_SW2') > 0 or instr(LW,'$lst_SW3') > 0 ) "; $where2 = $where2 . " and ( instr(LW,'$lst_SW1') > 0 or instr(LW,'$lst_SW2') > 0 or instr(LW,'$lst_SW3') > 0 ) "; $where3 = $where3 . " and ( instr(LW,'$lst_SW1') > 0 or instr(LW,'$lst_SW2') > 0 or instr(LW,'$lst_SW3') > 0 ) "; // } } if (strlen($selphosphorescence_YN) >0) { $postedvals = $postedvals ."[PHOSPHORESCENCE]"; $where0 = $where0 . " and ( uw like '%phosphoresce%' or lw like '%phosphoresce%' ) "; } if (strlen($displaymohs)>0) { $postedvals = $postedvals ."[Mohs:$displaymohs:$filtermohs]"; $filtermohs = onvl($filtermohs,0); $where0 = $where0 . " and $displaymohs between mohs1-$filtermohs and mohs2+$filtermohs "; } //echo "


".$where.""; //echo "
search order by: ".$orderby."
"; //get rid of the first AND or first OR $where = prepSQL($where); $where0 = prepSQL($where0); $where1 = prepSQL($where1); $where2 = prepSQL($where2); $where3 = prepSQL($where3); if (strlen($orderby) < 2) { $orderby = " name "; } //0 exact green //1 strict light green //2 moderate yellow //3 loose light red // echo ''.$where.'
'; if (strlen($where) > 3) { $query_audit = "SELECT 0 relevance, g.* ". " FROM gemdb g ". " WHERE active_yn = 'Y' and ( ".$where." ) ". " ORDER BY relevance,".$orderby." "; } else { $query_audit = "SELECT 0 relevance, g.* ". " FROM gemdb g ". " WHERE active_yn = 'Y' and ( ".$where0." ) ". "UNION ". "SELECT 1 relevance, g.* ". " FROM gemdb g ". " WHERE active_yn = 'Y' and ( ".$where1." ) ". " AND not ( ".$where0." )". "UNION ". "SELECT 2 relevance, g.* ". " FROM gemdb g ". " WHERE active_yn = 'Y' and ( ".$where2." ) ". " AND not ( ".$where1." )". "UNION ". "SELECT 3 relevance, g.* ". " FROM gemdb g ". " WHERE active_yn = 'Y' and ( ".$where3." ) ". " AND not ( ".$where2." )". " ORDER BY relevance,".$orderby." "; } //echo ''.$query_audit.'
'; $result = mysql_query ($query_audit); /* echo "


xquery ".$query_audit." has ".mysql_num_rows($result)." rows
"; */ /* filterrefract $filterrefract ".strlen($filterrefract)."
filtersg $filtersg ".strlen($filtersg)."
selspot $selSpot_YN ".strlen($selSpot_YN)."
displaypleo [$displaypleo] ".strlen($displaypleo)." filterpleo $filterpleo ".strlen($filterpleo)."
optics [$displayoptchar] [$displayoptsign] [$filteropticchar] ereg [".ereg_replace('[+][-]','',$displayoptsign)."] plural [$displaycleavages] [$filtercleavages] singular [$displaycleavage] [$filtercleavage] selphosphorescence_YN [$selphosphorescence_YN] "; */ echo ''; $query_rows = mysql_num_rows($result); $bottom_rows = intval($displaycnt) + 1; $top_rows = intval($displaycnt) + intval($displayrows); if ($top_rows > $query_rows) { $top_rows = $query_rows; } if ($top_rows < $query_rows | $displayrows < $query_rows ) { echo '
'. ''. '
'; if ($displaycnt > 0) { echo ''; } echo ' << Previous Rows '; if ($displaycnt > 0) { echo ''; } echo '
'. 'Viewing '.$bottom_rows.' - '.$top_rows.' out of '.$query_rows.' results'; echo ''. '
'; if ($query_rows > (intval($displaycnt) + intval($displayrows)) ) { echo ''; } echo ' Next Rows >> '; if ($query_rows > (intval($displaycnt) + intval($displayrows)) ) { echo ''; } echo '
'. '
'; } $cnt = 0; $page_cnt = 0; #echo "

RESULT TYPE: ".$result_type."

"; // 'Christmas ONE DAY ONLY Sale! 50% Off!'. while ($row = mysql_fetch_array ($result)) { $cnt++; if ($cnt < 11) { $results = $results . "[".$row['name']."] "; switch ($row['relevance']) { case 0: $bkgd = ' bgcolor=#66CC66 '; break; case 1: $bkgd = ' bgcolor=#99FF99 '; break; case 2: $bkgd = ' bgcolor=#FFFF99 '; break; case 3: $bkgd = ' bgcolor=#FFCCFF '; break; default: $bkgd = ' bgcolor=red '; break; } //--echo 'cnt: '.$cnt.' displaycnt: '.$displaycnt.' displayrows: '.$displayrows.' pagecnt: '.$page_cnt.' rowip: '.$row['ip']; if ( $cnt > intval($displaycnt) && $cnt <= (intval($displaycnt) + intval($displayrows))) { $page_cnt++; /**************************** display information ****************************/ switch ($row['relevance']) { case 0: $relevance = '100%'; break; case 1: $relevance = '90%'; break; case 2: $relevance = '70%'; break; case 3: $relevance = '50%'; break; } // name info $webID = $row['name'] ; //.$query_rows('colors') //refractometer info $webRI = $row['ri1'].'-'.$row['ri2']; if (strlen($row['ri_dev_pos']) > 0) { if ($row['ri_dev_pos'] == $row['ri_dev_neg'] ) { $webRI = $webRI .' ±'.$row['ri_dev_pos']; } else { $webRI = $webRI . ' +'.$row['ri_dev_pos'].', '.$row['ri_dev_neg']; } } $webRI = 'tr>'; if ( $row['ri_dev_neg'] != 0 & $row['ri_dev_pos'] != 0 ) { $webRI = $webRI . ''; } if ( $row['ri_dev_neg'] != 0 & $row['ri_dev_pos'] = 0 ) { $webRI = $webRI . ''; } if ( $row['ri_dev_neg'] = 0 & $row['ri_dev_pos'] != 0 ) { $webRI = $webRI . ''; } $webRI = $webRI . '
'.$row['ri1']; if (strlen($row['ri2']) > 0 ) $webRI = $webRI . '-'.$row['ri2']; $webRI = $webRI . '
('.$row['ri_dev_neg'].',+'.$row['ri_dev_pos'].')
('.$row['ri_dev_neg'].')
(+'.$row['ri_dev_pos'].')
'; if ($row['refract'] =='SR') {; $webrefract = ''.$row['refract'].''; } else { $webrefract = ''.$row['refract'].''; } $webbiref = '
'.$row['birefringe1']; if (strlen($row['birefringe2']) > 0 ) $webbiref = $webbiref. '-'.$row['birefringe2']; $webbiref = $webbiref . '
'; //dichroscope info $webpleo = $row['pleo'].' '.$row['pleo_pwr']; $ttitle = ereg_replace('S','Strong ',$webpleo); $ttitle = ereg_replace('M','Moderate ',$ttitle); $ttitle = ereg_replace('W','Weak ',$ttitle); $webpleo = ''.$webpleo.''; // sg kit info //$webSG = $row['sg']; $webSG = ''; if (strlen($row['sg_dev_pos']) > 0) { $sg1 = $row['sg']-abs($row['sg_dev_neg']); $sg2 = $row['sg']+$row['sg_dev_pos']; $webSG = $webSG .''. ''. ''. '
'.$sg1.'['.$row['sg'].'] '.$sg2.'
'.$row['sg_dev_neg'].' +'.$row['sg_dev_pos'].'
'; } // polariscope / conoscope info $webopticChar = $row['optic_char'].$row['optic_sign']; $ttitle2 = ereg_replace('B','Biaxial ' ,$webopticChar); $ttitle2 = ereg_replace('U','Uniaxial ',$ttitle2); $ttitle2 = ereg_replace('[+]','Positive',$ttitle2); $ttitle2 = ereg_replace('[-]','Negative',$ttitle2); $webopticChar = ''.$webopticChar.''; $webopticNote = $row['optic_note']; $webopticNote= texter($webopticNote,'ADR','Anamolous Double Refraction'); $webopticNote= texter($webopticNote,'AGG','Aggregate'); // visual properties // C,P,R,O,Y,G,B,Br,Gr,Bl $webcolors = ereg_replace(' ','',$row['colors']); if ( strlen($webcolors) > 12 ) { $comma_pos = strpos($webcolors,',',12); //"[comma pos:$comma_pos]
" if ($comma_pos > 0 ) $webcolors = substr($webcolors,0,$comma_pos+1)."
".substr($webcolors,$comma_pos+1,strlen($webcolors)); } //C,P, R, O, Y, G, B, V, Br, W,Gr, Bl $titleColors = $webcolors; $titleColors = ereg_replace('C','Clear',$titleColors); $titleColors = ereg_replace('P','Purple',$titleColors); $titleColors = ereg_replace('R','Red',$titleColors); $titleColors = ereg_replace('O','Orange',$titleColors); $titleColors = ereg_replace('Y','Yellow',$titleColors); $titleColors = ereg_replace('V','Violet',$titleColors); $titleColors = ereg_replace('W','White',$titleColors); $titleColors = ereg_replace('Gr','Gray',$titleColors); $titleColors = ereg_replace('Br','Brown',$titleColors); $titleColors = ereg_replace('Bl','Black',$titleColors); $titleColors = ereg_replace('B ','Blue',$titleColors.' '); $titleColors = ereg_replace('G ','Green',$titleColors.' '); $titleColors = ereg_replace('B,','Blue,',$titleColors); $titleColors = ereg_replace('G,','Green,',$titleColors); $titleColors = ereg_replace('
','',$titleColors); $webcolors = ''.$webcolors.''; $webtrans = $row['transparency']; $ttitle = $webtrans; $ttitle = ereg_replace('ST','Semi-Transparent',$ttitle); $ttitle = ereg_replace('SL','Semi-Translucent',$ttitle); $ttitle = ereg_replace('O','Opaque',$ttitle); $ttitle = ereg_replace(' T ','Transparent',' '.$ttitle.' '); $ttitle = ereg_replace(' L ','Translucent',' '.$ttitle.' '); $ttitle = ereg_replace(',L,',',Translucent,',$ttitle); $ttitle = ereg_replace(',L ',',Translucent',$ttitle.' '); if (strpos($ttitle,'T,') == 0) { $ttitle = ereg_replace('T,','Transparent,',$ttitle); } if (strpos(trim($ttitle),'L,') == 0) { $ttitle = ereg_replace('L,','Translucent,',$ttitle); } $webtrans = ''.$webtrans.''; $webfract = $row['fracture']; $ttitle = $webfract; $ttitle = ereg_replace(' C ','Conchoidal ',' '.$ttitle.' '); $ttitle = ereg_replace(' C,','Conchoidal,',' '.$ttitle); $ttitle = ereg_replace('S ','Splintery ',$ttitle.' '); $ttitle = ereg_replace('S,','Splintery,',$ttitle); $ttitle = ereg_replace('SC','Semi-Conchoidal',$ttitle); $ttitle = ereg_replace('G','Granular',$ttitle); $ttitle = ereg_replace('U','Uneven',$ttitle); $ttitle = ereg_replace('SB','Step-like Break',$ttitle); $webfract = ''.$webfract.''; $webcleavage = $row['cleavage']; // UV Light info $webuw = ereg_replace('LW-','',ereg_replace('LW:','',ereg_replace('LW ','',$row['uw']))); $weblw = ereg_replace('SW:','',ereg_replace('SW-','',ereg_replace('SW ','',$row['lw']))); // Picks $webmohs = $row['mohs1'].'-'.$row['mohs2']; $webcommon_names = $row['common_Names']; $displayformat = 'grid'; /**************************** DISPLAYFORMAT : GRID location,dates,fees,contacts,features,basics,all if ( strpos(' ,location,dates,fees,contacts,features,basics,all,', ','.$displayinfo.',') > 0) ****************************/ if ($displayformat == 'grid') { if ($page_cnt == 1) { echo ''; echo ''; //show on all pages //if ( strpos(' ,location,all,', ','.$displayinfo.',') > 0) echo colHeads('relevance','Rel','Relevance'); echo colHead('name','#FFCCFF','darkblue'); echo colHeads('ri1','RI','Refractive Index'); echo colHeads('refract','Refract','Refractivity'); echo colHeads('birefringe1','BiRef','BiRefringence'); echo colHeads('pleo','Pleo','Pleochroism',$gray); echo colHeads('sg','SG','Specific Gravity'); echo colHeads('optic_char','OptChar','Optic Character',$gray); echo colHeads('optic_note','OptNote','Optic Note',$gray); echo colHeads('colors','Colors'); echo colHeads('transparency','Transp','Transparency'); echo colHeads('fracture','Fracture'); echo colHeads('cleavage','Cleavage'); echo colHeads('uw','LW','Longwave',$gray); echo colHeads('lw','SW','Shortwave',$gray); echo colHeads('mohs1','Mohs'); echo colHeads('common_names','Common Names','Varieties within Species'); //if ( strpos(' ,dates,basics,all,', ','.$displayinfo.',') > 0) { echo ''; } //page_cnt == 1 echo ''; echo ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; //if ( strpos(' ,location,all,', ','.$displayinfo.',') > 0) { echo ''; } //display format GRID } // if within the multi-page display criteria } //$cnt < 11 } // End of while loop. // echo '
'.$relevance.''.$webID.''.$webRI.''.$webrefract.''.$webbiref.''.$webpleo.''.$webSG.''.$webopticChar.''.$webopticNote.''.$webcolors.''.$webtrans.''.$webfract.''.$webcleavage.''.$webuw.''.$weblw.''.$webmohs.''.$webcommon_names.'
'; if ($cnt > 0) { if ($cnt >= 10) { $results = "[CNT:$cnt] ".$results; } if ($top_rows < $query_rows | $displayrows < $query_rows ) { echo '
'. ''. '
'; if ($displaycnt > 0) { echo ''; } echo ' << Previous Rows '; if ($displaycnt > 0) { echo ''; } echo '
'. 'Viewing '.$bottom_rows.' - '.$top_rows.' out of '.$query_rows.' results'; echo ''. '
'; if ($query_rows > (intval($displaycnt) + intval($displayrows)) ) { echo ''; } echo ' Next Rows >> '; if ($query_rows > (intval($displaycnt) + intval($displayrows)) ) { echo ''; } echo '
'. '
'; } echo ''; echo ''. ''. '
'; } // If no records were displayed... if ($cnt == 0) { if ( $where == '1=2' ) { $no_result_msg = ' >>Please enter search criteria to retrieve information.

>>Thank you! - PrettyRock.com '; $no_result_msg .= '

Common Searches
Quartz
Beryl Topaz Garnet Sapphire
'; } else { $no_result_msg = ' >>Your search returned no matches.

>>Please try a broader search or let us know if a gemstone\'s data is missing!

>>Thank you! - PrettyRock.com '; } echo ''. '

'.$no_result_msg. '

'. '
'; echo '
Gem ID Database - search provided by PrettyRock.com   Clear Search
'; } else { echo '
Gem ID Database - search provided by PrettyRock.com   Clear Search '; if (getenv(HTTP_X_FORWARDED_FOR)) { $ip = getenv(HTTP_X_FORWARDED_FOR); } else { $ip = getenv(REMOTE_ADDR); } $audit = "insert into audit_gemdb(ip,search,display_type,display_rows,query_rows,top_rows,create_date,results) values ". "('".$ip."','".$postedvals."','".$displaytype."','".$displayrows."','".$query_rows."','".$top_rows."',NOW(),'".$results."')"; $result = mysql_query ($audit); } #mysql_close(); // Close the database connection. //include_once ('phpbottom.htm'); $calledFile = substr($SCRIPT_FILENAME,strpos($SCRIPT_FILENAME,'public_html')+11,strlen($SCRIPT_FILENAME)); if ($calledFile == $REQUEST_URI) { echo'
'; require("../BootStrap/includes/footer.php"); } else { print_footer('404: '.$REQUEST_URI); } ?>