Texis Web Script source code for: /texis/site/demos/mysearch.vs
Note: Click on links to view the documentation for HTML tags which are special to the Vortex compiler.
<SCRIPT LANGUAGE=vortex>

<db=/usr1/demo/ns>
<export $myurls userok>
<timeout=-1></timeout>
<uses demonav=demonav><!--simple look and feel module-->

<!---------------------------------------------------------------------------->

<a name=hdr>
  <demolook title="Thunderstone Personal Search Page Builder">
</a>

<!---------------------------------------------------------------------------->

<a name=ftr>
  <h6 align=right>Copyright © 1997 <a href="/">Thunderstone</a> Software</h6>
  </demolook>
</a>

<!---------------------------------------------------------------------------->

<A NAME=main>
<hdr>
<listform>
<hr>
<dl>
<dt>

<b>Explanation:</b>
<dd>
This code example builds a personal search page consisting of the forms from 
as many search engines as you wish.<p>
Enter the Urls to the pages that have the forms on them in the box above,
or select engines from the Category list. Once you have all the engines
you want click "Make Search Page". It may take several seconds per
engine to retrieve the forms.<p>
This script extracts the forms from each page and displays the
internal CGI name for each variable. It will also display any hidden 
variables that are present.
</dl>
<ftr>
</a>


<!---------------------------------------------------------------------------->

<a name=grabform>
<sandr ">><!--=!-->+-->" "" $pg>
<sandr '>>onsubmit\="=[^"]*"' '' $ret>
<$pg=$ret>
<rex $match $pg />
<$vars=$ret>
<if $debug neq "">
   <loop $vars>
     $vars<br>
   </loop>
</if>
</a>

<!----------------------------------------------------------------------------
Check to see if its a radio or checkbox, and extract the value from it.
----------------------------------------------------------------------------->

<a name=radiocheck>
<$rcmatch= 'radio' 'checkbox'>
<rex $rcmatch $vars />
<if $ret neq "">
   <rex '>>value\==\"?\P=[^>\"]+' $vars />
   $ret
</if>
</a>

<!----------------------------------------------------------------------------
Send the extracted form data back to the browser
------------------------------------------------------------------------------>

<a name=sendform>
<table>
<$hidden=>
<loop $vars>
   <rex 'hidden' $vars />
   <$hide=$ret>
   <if $hide neq "">
      <$hidden= $hidden $vars>
   <else>
     <tr>
     <td>
     <rex '>>name\=\P=[^ >]+' $vars />
     <if $ret neq "">
        <sandr '"' '' $ret>
        <b>$ret <radiocheck>: </b>
     </if>
     </td>
     <td>
     
     <send $vars>
     </td>
     </tr>
   </if>
</loop>
<if $hidden neq "">
   <tr><td>Hidden Variables:</td><td>
   <loop $hidden>
      <send $hidden>
      $hidden <send $hidden><br> 
   </loop>
   </td></tr>
</if>
</table>
</form>
<flush>
</a>

<!---------------------------------------------------------------------------
Look at the engines database for the available categories
---------------------------------------------------------------------------->

<a name=enginecats>
   <table><tr>
   <td align=left colspan=5>Or select Urls from these categories:
   </tr><tr>
   <sql "select distinct Category from engines">
      <if $loop nmod 5 ></tr><tr></if>
      <td><a href=$url/enginelist.html?cat=$Category>$Category</a></td>
   </sql>
   </tr>
   </table>
</a>

<!---------------------------------------------------------------------------
List all the engines in the database for a given category
---------------------------------------------------------------------------->

<a name=enginelist PUBLIC>
<html><head><title>Engine list</title></head><body>
<form method=post action=$url/>
    <input type=submit value="Add Selected Engines">
    <dl>
    <sql  "select Url,Caption from engines where Category = $cat and Rating > -1 order by Rating desc">
      <dt><input type=checkbox name=u value="$Url"><a href=$Url>$Url</a>
      <dd><send $Caption><p>
    </sql>
    </dl>
    <input type=submit value="Add Selected  Engines">
</form>
</body>
</a>

<!---------------------------------------------------------------------------
Reset the user interface
---------------------------------------------------------------------------->

<a name=Clear PUBLIC>
<$u=>
<$myurls=>
<main>
</a>

<!---------------------------------------------------------------------------
Display the search form 
---------------------------------------------------------------------------->

<a name=listform>
<center>
<if $u neq "">
   <sum "%s " $u>
   <sandr " " "\x0d\x0a" $ret>
   <sum "%s" $ret $myurls>
   <$myurls=$ret> 
</if>
<form method=post action=$url/>
<table cellpadding=0 cellspacing=0>
<tr><td align=left>Enter Url(s) containing the forms:</td></tr>
<tr><td align=right>
<textarea name=myurls rows=4 cols=50>
$myurls
</textarea><br>
<input type=submit name=cmd value="Clear">
<input type=submit name=cmd value="Make Search Page">
</td></tr></table>
</form>
<enginecats>
</center>
<flush>
</a>

<!---------------------------------------------------------------------------
Fetch and extract the forms from the selected Urls
----------------------------------------------------------------------------->

<a name="Make Search Page" PUBLIC>
<hdr>
<small><b>Note:</b> Save this page with your browser's Save-As menu option.</small>
<$match= "<form=!>+>" ">><input=!>+>" ">><select=!</select>+</select>=" ">><textarea=!</textarea>+</textarea>" "</form>">
<if $myurls neq "">
   <urlcp maxpgsize "1MB">
   <!-- extract urls from random user input -->
   <rex ">>http=s?://=[^.]+\.=[^/\space]+[^\space]*" $myurls />
   <$u=$ret>
   <loop $u>
       <fetch urls=$u />
       <$pg=$ret>
       <rex ">><title>\P=!</title>+" $pg />
       <$title=$ret>
       <rex ">><form=!</form>+" $pg />
       <$forms=$ret>
       <loop $forms>
          <$pg=$forms>
          <hr>
          <base href=$u>
          <b>$title</b> (<a href=$u>$u</a>)
          <grabform>
          <sendform>
       </loop>
       <if $loop eq 0>
         <hr>
         <b>No form located at: </b> <a href=$u>$u</a><br>
       </if>
   </loop>
</if>
<if $loop eq 0>
   <listform>
</if>
<ftr>
</a>

</script>

Back to the Code Example List

The Source Viewer is also a Code Example.
Click Here to see its source.
Copyright © 1992-1999 Thunderstone Software
Copyright © 2024 Thunderstone Software LLC. All rights reserved.