Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Nov 19, 2009 11:03 pm 
Offline
Junior Member
User avatar

Joined: Thu Sep 03, 2009 10:47 pm
Posts: 35
Website: http://www.kavoir.com/
There's a login form on page A: http://www.example.com/A.html

The 'action' attribute of which is: action="/B.html"

So when someone logs in with the form on A.html, the data will be submitted to / visitor redirected to B.html.

Now what I want is: there's an <iframe></iframe> on /C.html, framing B.html, is there any way so that when someone logs in with the form on A.html, the visitor is redirected to C.html and the login details is submitted to B.html that's framed on C.html in the <iframe></iframe>? So after the person logs in from A.html, he arrives at C.html with the actual CP dashboard framed in an <iframe>.

I have absolutely no clue in achieving this. Maybe the form will be submitted to C.html first and C.html submits the login details to B.html (framed in C.html) via JavaScript? How?

_________________
I have a passion for building websites. I love Usable Databases.


Top
   
 Post subject:
PostPosted: Fri Nov 20, 2009 10:01 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
This has little to do with PHP or any other server-side programming.

1) Avoid iframes like the plague.

2) Ever heard of the fancy word, AJAX? It's javascript, and it will do approximately what you want (and more).

3) If you want it quick and dirty:

- Submit your form to B.html / B.php / whatever.
- Make B.html redirect the client immediately to C.html. This can be done with an HTML <meta refresh="..."> header, a PHP function header('Location="..."), or by javascript window.location = "...";
- In C.html, <iframe src="/B.html"></iframe>
- In order to prevent an infinite loop, you'll need to tell B.html NOT to redirect again if it finds itself inside an iframe.

And of course, it's up to you to make sure that the whole thing is secure.


Top
   
 Post subject:
PostPosted: Mon Dec 07, 2009 9:04 am 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
The whole design is wrong to begin with. Here are some guidelines:

1. Separate form processors in individual .php files, those should only and always redirect upon success and accept only POST.

2. If you need to track login data in an iframe (or with AJAX), have a separate script that reads such info from session or database. Naturally, have the login form processor put any relevant data into the session.


BTW, never redirect with meta tags or javascript, HTTP has redirection functionality with Locatio nheader and 302 or 303 (preferred for POST form processors redirecting to a GET) response codes. Check php.net/header for more info.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group