Advertisement
Guest User

Untitled

a guest
Jan 25th, 2013
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Developed By Robin Kumar Paul
  4.  * Email: robin@ieee.org
  5.  * */
  6. if (isset($_REQUEST['input'])) {
  7.     $ins = $_REQUEST['input'];
  8.     $ins = explode("\n", $ins);
  9.     $output = "";
  10.     print_r($ins);
  11.     foreach ($ins as $key => $char) {
  12.         if ($key == 0) continue;
  13.  
  14.         $bal = "NO";
  15.         if ($char == "" || strpos($char, " ") || strpos($char, ":)") || strpos($char, ":(") || strpos($char, ":") || preg_match("/[A-Za-z]/", $char)) {
  16.             $bal = "YES";
  17.         }
  18.  
  19.         if ($bal == "NO") {
  20.             $n = 0;
  21.             for ($i = 0; $i < strlen($char); $i++) {
  22.  
  23.                 if ($char[$i] == ")") {
  24.                     $n--;
  25.                 }
  26.                 if ($char[$i] == "(") {
  27.                     $n++;
  28.                 }
  29.  
  30.                 if ($n < 0) {
  31.                     break;
  32.                 }
  33.             }
  34.  
  35.             if ($n == 0) {
  36.                 $bal = "YES";
  37.             }
  38.         }
  39.  
  40.         $output = $output . "Case #" . $key . ": " . $bal . "<br>";
  41.  
  42.  
  43.     }
  44.     echo "<h3>Output</h3>";
  45.     echo $output;
  46.  
  47. }
  48.  
  49. ?>
  50.  
  51. <h2>Input</h2>
  52. <form action="" method="post">
  53.     <textarea rows="10" cols="100" name="input"></textarea>
  54.     <input type="submit" value="Submit To Hack"/>
  55. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement