Jump to content

Recommended Posts

[!--sizeo:2--][span style=\"font-size:10pt;line-height:100%\"][!--/sizeo--][code]<html>
<head>
<?php

$test1="exploit.rules";
$test2="exploit.rules";
$lines = file("./snortconf.txt");
$count = count($lines);
$i = 0;

?>
</head>
<body>
<form name ="snort" method="get" action="<?=$_SERVER['PHP_SELF']?>">

<?php
if(isset($_REQUEST['btnsubmit'])) {
      //echo "entered submit request";
      
      if(isset($_REQUEST['chk2'])) {
          //echo "entered chkbox request";
          $rule = $_REQUEST['chk2']." ";
          
          while($i<$count){
              //echo $lines[$i]."<br>";
              //echo "<br>Dit staat ier juist voor de if functie<br>";
              
              if(ereg("^include",$lines[$i])){
                  //echo "jet gezien dat nen include is<br>";
                  //$breaker = explode("/",$lines[$i]);
                  //echo "<br>----------<br>";
                  //echo "\"".$breaker[1]."\"<br>"
                $breaker2 = str_replace("include \$RULE_PATH/","",$lines[$i]);
                //echo "\"".$breaker2."\"";
                  
                  
                  //echo "\"".$rule."\"";
                  //echo "<br>----------<br>";    
                  if ($rule==$breaker2) {
                      echo "TIS WERE GELUKT";
                  }
              }
              
          $i++;
          }
      }
}

echo "<input type='checkbox' name='chk2' value='".$test1."'>";
?>
<input type="submit" name="btnsubmit" value="Disable">
</form>
</body>
</html>[/code][!--sizec--][/span][!--/sizec--]



This is my code above.
I read a sentence that begins with include from a txt file(snortconf.txt) . Then I seperate the sentence and keep the last part of it with str_replace(). An other value, the value from a checkbox is submitted to its own page and the value is used for a Comparation with the value from the txt file.

When I echo both the values between quotes, so invisible spaces are revealed if they're there, they are
exactly the same. However, in the last if-loop where I compare $rule with $breaker2 I get false.
How is this possible ????? I have no clue.

snortconf.txt contains this:
[code]TEST
TEST
TESTNUMMERDRIE
include $RULE_PATH/exploit.rules
TESTJE[/code]

A little help would be great.

PS: the comments are test-echo's, so I can see where the script goes and where it doesn't go, etc.

Thx
Grande
Link to comment
https://forums.phpfreaks.com/topic/5501-comparation-of-two-variables/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.