CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

PHP - smartSolver 0.1 - Pre-Approval


[Replies] [Reply] [View by Thread] [Help]
[Back To SNEAK Development Forum]

Posted by Mar Tacheon On 2005-02-15 20:56:13
In Reply to Smart Solver Posted by CinC snarkles On 2005-02-15 17:18:56

Mar
Mar Tacheon


Was playing with some old code I wrote a while ago.
It splits the text entered into words, then checks against the supplied word.
Very basic, but it's a start. Will look at validating from a text file next.

Tach
<?php

/*******************************************
 * smartSolver.php.			   *
 *   					   *
 * Version: 0.1 			   *
 *					   *
 * Date: 15th Feb 2005		           *
 *                                         *
 * Author: Tacheon                         *
 *					   *
 * Purpose: To validate text that has been *
 *          decrypted or decoded           *
 *					   *
 *******************************************/

?>

<html>
 <head>
  <title>smartSolver 0.1</title>
 </head>
 <body bgcolor="#dddddd" text="#000000">
  <br /><center><h2><b>SmartSolver 0.1</b></h2></center>

<?php

if (isset($submit)) 
{
  echo "<table width=\"450\" border=\"1\" align=\"center\" cellspacing=\"0\" cellpadding=\"10\">\n";
  echo " <tr valign=\"top\">\n";
  echo "  <td>\n";

  if ($text == '' || $stringToVerify == '') 
  { 
    echo "<br /><font color=\"#ff0000\"><b>Error:</b> You must enter text into both boxes!</font><br /><br />\n"; 
  } 
  else 
  { 
    echo "<b>Text Entered:</b><br /><br />$text<br /><br />\n"; 
    $showResults = 'yes';
  }

  echo "  </td>";
  echo " </tr>";
  echo "</table>";
  echo "<br />";

  if ($showResults == 'yes')
  {
    // Validate...

    echo "<table width=\"450\" border=\"1\" align=\"center\" cellspacing=\"0\" cellpadding=\"10\">\n";
    echo " <tr valign=\"top\">\n";
    echo "  <td>\n";
    echo "   <b>Results:</b><br /><br />\n"; 

    $words = explode(' ', $text);
    for($i=0;$i<count($words);$i++)
    { 
      if ($words[$i] == $stringToVerify)
      { 
        echo "<b>VERIFIED</b> - Text contines the test string '$stringToVerify'.<br /><br />\n";
        break;
      } 
    }
    echo "  </td>\n";
    echo " </tr>\n";
    echo "</table>\n";
    echo "<br />\n";
  }

} 
else 
{
  // Input Form...

?>

 <center>
  <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post">
   <table width="450" border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <b>Text Entry:</b><br /><br />
      <input type="text" name="text" size="64"><br /><br />
     </td>
    </tr>
   </table>
   <br />
   <table width="450" border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <b>Verification:</b><br /><br />
      Verify With: &nbsp; &nbsp; <input type="text" name="stringToVerify" size="42"><br /><br />
     </td>
    </tr>
   </table>
   <br />
   <table border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <input type="submit" name="submit" value=" Submit " /> &nbsp; &nbsp;
      <input type="reset" value=" Clear " />
     </td>
    </tr>
   </table>
  </form>
 </center>

<?php 

}  // End Submit Check. 

echo " </body>\n";
echo "</html>\n";

?>
Mar. Tacheon
Brigade Coordinator

Projects: ChalDev, IT News, CA-History, SNEAK

Crypto-Net




Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02727 seconds


About Us | Privacy Policy | Mission Statement | Help