Jump to content

Recommended Posts

try this

<?php
$html = '<script LANGUAGE="JavaScript"><!--
document.write(unescape("%3C%53%43%52%49%50%54%20%4C%41%4E%47%55%41%47%45%3D%22%4A%61%"));//--></SCRIPT>';
if (preg_match('/unescape\((["\'])([\da-f%]*?)\1\)/i', $html, $regs)) {
echo urldecode($regs[2]);
}
?>

that's not what you asked and from the first question you haven't given any details i can work with!

 

Sorry i was tired, for example:

 

I have this code:

 

$file = file_get contents($upload);

echo $file;

 

 

Its an upload form where i echo whats directally uploaded, the uploaded file always contains urlencoded data which is wrapped in script tags, but the trouble is i want to only echo the code after the first </SCRIPT> end tag.

 

 

So lets say i have uploaded:

 

<script LANGUAGE="JavaScript"><!--
document.write(unescape("%3C%53%43%52%49%50%54%20%4C%41%4E%47%55%41%47%45%3D%22%4A%61%"));//--></SCRIPT>

<SCRIPT>
text etc.

</script>

<script LANGUAGE="JavaScript">
more js...

</script>

<html>

 

 

It will only echo:

 


<SCRIPT>
text etc.

</script>

<script LANGUAGE="JavaScript">
more js...

</script>

<html>

 

I thought it can possibly be done by preg_match but not intially sure

 

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.