Jump to content

[SOLVED] preg_match problems


newbtophp

Recommended Posts

I've got some code like:

 

$_F=__FILE__;$_X="STRING1";$_D=strrev('edoced_46esab');eval($_D("STRING2"));

 

Note: The code always is the same, except its not allways like the above, sometimes it may contain other phpcode surrounding the above line.

 

How would i grab and echo the two strings using regex?. Im only looking to get the 2 strings,

 

the strings are base64 (letters [some with caps and some not], numbers and plus signs)

 

 

I'm new to regex and I've come up with:

 

 

if (preg_match('/="[^"]+"/Umis', $string1)) { 

echo $string1[1]

 

 

if (preg_match('/="([^"]+)"/Umis', $string2)) { 

echo $string2[1]

 

 

But still no luck  :-\

 

 

Link to comment
https://forums.phpfreaks.com/topic/173273-solved-preg_match-problems/
Share on other sites

Maybe this may give you a better understanding of what im trying to do:

 

<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="file" name="Upload" value="Upload" /> 
<input type="submit" name="submit" value="Upload" />
<br />

</form>
<br>
<?php
if (isset($_FILES['Upload'])) {
$file = file_get_contents($_FILES['Upload']['tmp_name']);
$submit = $_POST['submit'];
if($file == "") echo "";
else {
    if($submit == "Upload") {
if (preg_match('~"([^"]+)"~', $file, $match)) { 

//The first string gets echo'd here
echo "<textarea>$match[1]</textarea>";

if (preg_match('/="([^"]+)"/Umis', $file, $match)) {

//Second strings get echo'd here
echo "<textarea>$match2[1]</textarea>";

        
}
}
}
}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.