Jump to content

Recommended Posts

Not even sure if this is possible, I know nothing about programming!! Basically our developer disappeared mid job, never good but hey. Anyway, I've bungled my way through most of the issues that were outstanding with help from others which in a way has been good fun :) On to the problem, we have a payment page which takes users details such as address etc. When the user clicks "make payment" the page changes to the payment screen where the card data appears in an iFrame (it's a Pay Pal Hosted solution). The issue is the cart progress is reported in our admin section, the line of code I can see is as follows :-

 

$sql = "UPDATE carts SET progress='19' WHERE cartid='".$_SESSION['cartid']."'";

mysql_query($sql);

 

I can see the set progress number is pulled from another file which features code such as :-

 

elseif ( $row['progress'] == '19' )

{

echo 'iFrame Payment Page';

 

This works all well & good. The problem is the iFrame has two stages, the first stage is card data like number & expiry, once this is submitted the iFrame changes to 3D Secure (Mastercard Secure code or Verfied by Visa). What I don't know how to do is get the progress to report this? It seems it is possible as the code is there ready & waiting :-

 

elseif ( $row['progress'] == '15' )

{

echo '3Ds iframe Page';

 

I "just" don't know how to get the sql output? I tried adding :-

 

$sql = "UPDATE carts SET progress='15' WHERE cartid='".$_SESSION['cartid']."'";

mysql_query($sql);

 

Below the iFrame code but of course that just chages the progress status when the iFrame loads NOT when the iFrame changes. I guess I need some way of detecting the iFrame refresh or page change? Any help would be great, or if someone can fix this for some beer money then feel free to contact me. A web design company say they can do it but it would take around 4 hours @ £25 PH, not really worth me spending £100 to get a status changed in an admin system!(especially as this is the back up payment method that rarely gets used, it's just me wanting to fix the "bugs"!!)

 

Thanks for any help :)

Link to comment
https://forums.phpfreaks.com/topic/271677-detecting-iframe-status/
Share on other sites

It's not possible to monitor the status of an iframe when the content it is showing is not yours, due to a security policy browsers implement called the same-origin policy.  The most you can do is tell if they have entered the iframe, and then update the status to complete or failed when paypal notifies you of the result.

 

 

Oh well, that's a shame. Seems strange the programmer did not know this :( The status updates once the payment is complete as it redirects to another page, shame the 3DS does not have that ability as we could then fix this issue. I do have another problem(!). We also have JS validation on one of the entry pages(hosted on our server this time), it uses a script called Fvalidator which has been modified so we can switch the JS on & off from our back end system. I'd like to add this to another page for an email entry text box, if anyone fancies earning some beer money please drop me a message! TIA :)

hmm, back to the iFrame issue. Looking at the process further what happens is the card payment info opens in an iFrame, once that stage is complete the 3DS info opens another iFrame, so an iFrame in an iFrame! Is there a way to detect that happeing? We don't need to know what the URL is or anything like that just the fact a second iFrame has opened in the iFrame(!!). Or does the fact that this happens in an iFrame mean we can't detect anyhting? Sorry if these are dumb questions but I know nothing about this, just trying to finish what a pro started.

I found this code when looking around :-

 

function iframeClickHandler() {
   alert("Iframe clicked");
}
var iframe = document.getElementById("myIframe");
var iframeDoc = iframe.contentDocument || iframe.contentwindow.document;
if (typeof iframeDoc.addEventListener != "undefined") {
   iframeDoc.addEventListener("click", iframeClickHandler, false);
} else if (typeof iframeDoc.attachEvent != "undefined") {
   iframeDoc.attachEvent ("onclick", iframeClickHandler);
}

 

Which claims it can detect a click in an iFrame? If that is correct then if this could be made to detect the click then call the sql function this would work??

I found this code when looking around :-

 

Which claims it can detect a click in an iFrame? 

 

It'll only work if the frame is from the same origin as the parent script.  If they are different, it is blocked by the same-origin policy, and you'd just get an error along the lines of

 

Unsafe Javascript attempt to access frame with URL http://example.net/ from frame with URL http://example.com/. Domains, protocols and ports must match.

Edited by kicken
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.