Click here to Skip to main content
15,887,676 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Download a file from a link? Pin
huh123423-Sep-09 17:39
huh123423-Sep-09 17:39 
QuestionWeb pages do not display Pin
Steve Holdorf20-Sep-09 5:47
Steve Holdorf20-Sep-09 5:47 
AnswerRe: Web pages do not display Pin
Steve Holdorf20-Sep-09 7:40
Steve Holdorf20-Sep-09 7:40 
GeneralRe: Web pages do not display Pin
Marc Firth28-Sep-09 5:58
Marc Firth28-Sep-09 5:58 
QuestionAnti Frame Breaker Code Pin
stambekar18-Sep-09 1:31
stambekar18-Sep-09 1:31 
AnswerRe: Anti Frame Breaker Code Pin
enhzflep18-Sep-09 5:35
enhzflep18-Sep-09 5:35 
GeneralRe: Anti Frame Breaker Code Pin
stambekar20-Sep-09 19:15
stambekar20-Sep-09 19:15 
GeneralRe: Anti Frame Breaker Code [modified] Pin
enhzflep22-Sep-09 18:24
enhzflep22-Sep-09 18:24 
That's okay Sandeep. Thank-you for introducing me to the whole concept. It's been rather an interesting exercise.
I've had a little play around, and come up with some code that will kill the framebuster in a page that I've been playing with.
It's a two-file approach. There's the html file that makes the request, and the php file that retrieves the requested file
then strips the offending code from it.

In my simple example, I simply replace "top.location=self.location;" with "alert('Framebuster busted!');"

All you'll have to do is to find, download and compress AjaxRequest.js (EDIT: http://www.ajaxtoolbox.com/request/source.php)
[EDIT: No, you don't. I forgot I used a different method. Anyhow, it's still a good library]

Here's some code to play with:

1. getPage.php
<?php
$url = $_GET["tgt"];
if ($url == "")
	die("goddamit");

  
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$data = curl_exec($ch); 
curl_close($ch); 

echo strip_javascript($data, 0);// 0 = allow no javascript

function strip_javascript($filter, $allowed=0)
{
//	if($allowed&1 == 0) // 1 href=...
//		$filter = preg_replace('/href=([\'"]).*?javascript:.*?\\1/i', "'", $filter);

//	if($allowed&2 == 0) // 2 <script....
/*		$filter = preg_replace("/<script.*?>.*?<\/script>/i", "", $filter); */

//	if($allowed&4 == 0) // 4 <tag on.... ---- useful for onlick or onload
//		$filter = preg_replace("/<(.*)?\son.+?=\s*?(['\"]).*?\\2/i", "<$1", $filter);
//	top.location=self.location;
	
	$filter = str_replace("top.location=self.location;", "alert('Framebuster busted!');", $filter);
	return $filter;
}
?>



2. showInIFrame.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript">

function onGoBtn()
{
	var url, ifrm, src;
	url = document.getElementById("urlInput").value;
	ifrm = document.getElementById("tgtFrame");
	src = "getPage.php?tgt="+url+"&rand="+parseInt(Math.random()*100);
	ifrm.src = src;
}
</script>
</head>
<body>
  <label>URL
  <input type="text" name="urlInput" id="urlInput" value="www.freedb.org">
  </label>
  <br>
  <label>Load into IFrame
  <input type="button" name="goBtn" id="goBtn" value="GO!" onclick="onGoBtn();">
  </label>
  <br>
  <iframe id="tgtFrame">Target Frame</iframe>
</body>
</html>


modified on Wednesday, September 23, 2009 1:23 AM

QuestionPython Debugger? [modified] Pin
Joe Woodbury16-Sep-09 11:22
professionalJoe Woodbury16-Sep-09 11:22 
AnswerRe: Python Debugger? Pin
Med7at24-Sep-09 18:51
Med7at24-Sep-09 18:51 
GeneralRe: Python Debugger? Pin
anand mohan12329-Sep-09 14:30
anand mohan12329-Sep-09 14:30 
Questionupload photo Pin
pallavi shrivastava16-Sep-09 3:28
pallavi shrivastava16-Sep-09 3:28 
AnswerRe: upload photo Pin
EliottA16-Sep-09 6:10
EliottA16-Sep-09 6:10 
AnswerRe: upload photo Pin
Marc Firth17-Sep-09 14:37
Marc Firth17-Sep-09 14:37 
Questionsend email Pin
pallavi shrivastava15-Sep-09 2:59
pallavi shrivastava15-Sep-09 2:59 
AnswerRe: send email Pin
fly90415-Sep-09 7:42
fly90415-Sep-09 7:42 
QuestionGridview Pin
jaraldumary15-Sep-09 0:51
jaraldumary15-Sep-09 0:51 
AnswerRe: Gridview Pin
fly90415-Sep-09 7:34
fly90415-Sep-09 7:34 
AnswerRe: Gridview (caution, long answer) Pin
enhzflep15-Sep-09 14:56
enhzflep15-Sep-09 14:56 
GeneralRe: Gridview (caution, long answer) Pin
fly90423-Sep-09 2:21
fly90423-Sep-09 2:21 
QuestionUnable to start yahoo messenger Pin
Vishal Kumar Soni14-Sep-09 10:24
Vishal Kumar Soni14-Sep-09 10:24 
QuestionProblem with PHP IDE Pin
sarang_k11-Sep-09 0:59
sarang_k11-Sep-09 0:59 
AnswerRe: Problem with PHP IDE Pin
Marc Firth11-Sep-09 5:40
Marc Firth11-Sep-09 5:40 
QuestionCURL Post Error [modified] Pin
LazyDragonfist7-Sep-09 4:08
LazyDragonfist7-Sep-09 4:08 
QuestionCreating visual content Pin
Sahir Shah2-Sep-09 23:02
Sahir Shah2-Sep-09 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.