TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-22-2009, 02:12 PM   #1 (permalink)
The Visitor
 
Join Date: Oct 2009
Posts: 4
Thanks: 2
n1colius is on a distinguished road
Default [ASK] get parent url in iframe

I have a proble in getting parent url address in iframe from my project.

so, i have let's say ads.php located in www.domain1.com/ads.php
it's look like this
Code:
<?php
//iklan.php
if($_GET['klik'] == 'yes')
{
    //klik process
    exit;
}

$some_content = '
	document.write('<iframe src="www.domain1.com/ads.php">
	<a href="www.domain1.com/ads.php&klik=yes">klik_link</a>
	</iframe>');
	';
echo $some_content;
?>
and then i have test.html located in www.domain2.com/test.html that look like this
Code:
<html>
<head>
</head>
<body>
<script type="text/javascript" src="www.domain1.com/ads.php">
</script>
</body>
</html>
my question is, how can i get the value of url address frame parent which is "www.domain2.com/test.html" in my ads.php file.

i already try $_SERVER['HTTP_REFERER'] and $_SERVER['SERVER_NAME'] but i got me "www.domain1.com/ads.php" which is the src of my iframe.

i also try with javascript "parent.location.href" but failed, because it's only work if the domain is the same.

anyone has a solution? been struggling with this in this 2 day.
Send a message via Yahoo to n1colius
n1colius is offline  
Reply With Quote
Old 10-22-2009, 09:54 PM   #2 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

You don't, in PHP you can't grab the outer frame. You can grab it via the DOM (javascript) and then send an XMLHttpRequest (Ajax) to a php script.
__________________
My Site
adamdecaf is offline  
Reply With Quote
The Following User Says Thank You to adamdecaf For This Useful Post:
n1colius (10-23-2009)
Old 10-22-2009, 10:43 PM   #3 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

You can use EasyXDM
__________________
My Blog
Enfernikus is offline  
Reply With Quote
The Following User Says Thank You to Enfernikus For This Useful Post:
n1colius (10-23-2009)
Old 10-23-2009, 10:37 AM   #4 (permalink)
The Visitor
 
Join Date: Oct 2009
Posts: 4
Thanks: 2
n1colius is on a distinguished road
Default

Quote:
Originally Posted by adamdecaf View Post
You don't, in PHP you can't grab the outer frame. You can grab it via the DOM (javascript) and then send an XMLHttpRequest (Ajax) to a php script.
can you show me how to get it done in general maybe?
in my situation, i don't have the access to this www.domain2.com/test.html so how can i write ajax script in their site ("www.domain2.com/test.html")
Send a message via Yahoo to n1colius
n1colius is offline  
Reply With Quote
Old 10-23-2009, 10:44 AM   #5 (permalink)
The Visitor
 
Join Date: Oct 2009
Posts: 4
Thanks: 2
n1colius is on a distinguished road
Default

Quote:
Originally Posted by Enfernikus View Post
You can use EasyXDM
thanks for the info.
gonna try google it...
Send a message via Yahoo to n1colius
n1colius is offline  
Reply With Quote
Old 10-23-2009, 11:03 AM   #6 (permalink)
The Visitor
 
Join Date: Oct 2009
Posts: 4
Thanks: 2
n1colius is on a distinguished road
Default

Quote:
Originally Posted by Enfernikus View Post
You can use EasyXDM
if you don't mind can you explain to me how can i used EasyXDM in my case?
what is the step i have to put in my code?
Send a message via Yahoo to n1colius
n1colius is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
When a parent row is deleted.. Haris MySQL & Databases 3 12-30-2007 01:52 PM


All times are GMT. The time now is 03:29 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design