homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Automatic posting varibles to another page while doing a redirect
fintan




msg:1304440
 10:36 am on Aug 26, 2004 (gmt 0)

Hi I'm trying to automacticly post 2 varibles from one script to another. I have a form with an email & password field. I pass that to another page which has to redirect and post the varibles it collected to a final page where the user will be logged in. It's going from two php scripts to a propioraty system. I know it's a round about way to do it but it's the only way I can think of. How would I go about doing this? Thanks

fintan.

 

ethan




msg:1304441
 12:30 pm on Aug 26, 2004 (gmt 0)

You could do this in several ways...

Let's say that page1 sends usr+psw to page2
Page 2 will to whatever, and this page will call the
page3 passing the usr+psw+whatever to page3.

(at least that's what I have understood on your request)

So page2 could call page3 in:

. JavaScript onLoad="..." function that will submit your form. But this makes no javascript people away. (hotmail does too)

. <META HTTP-EQUIV=Refresh CONTENT="0; URL=http://site.com/page3.php?var1=123&var2=123">
The bas side of this is that variables are then seen in the url field. But a hashing of them, or even encrytion can solve that issue.

. header("Location: [site.com...] This will work in all browsers, but has the same problem as above.

And finally, another sollution is to use cookies. Then page 3 will read them. This makes the use to have cookies support.

Hope it helps.
Regards, Ethan.

fintan




msg:1304442
 12:55 pm on Aug 26, 2004 (gmt 0)

Thanks for the responce. Thats what I mean but the thing is I have no control over page 3. It's a lotus mail account and it doesn't use cookies. I don't have access to it and the varibles have to be post not get. Basically I substituting the lotus mail login for my own login page. Do you see what I'm getting at.

I was thinking of using a header redirect or something similar so I could avoid the whole javascript issue and I can't use get method because the thrid page won't accept the varibles. Is there another way?

ethan




msg:1304443
 3:54 pm on Aug 26, 2004 (gmt 0)


Then the best method I can think to make the user browser send the variables to page3 with POST method is a javascript onLoad event to body, that will send a form with hidden fields. Then also have support for no javascript users so let them see a "continue button" that would be the submit button for the form...

something like...

<form name="gateway" action="page3.php" method="POST">

<input type="hidden" name="var1" value="123">
<input type="hidden" name="var2" value="123">
<input type="hidden" name="var3" value="123">

<noscript>
<input type="submit" value="continue to login">
</noscript>
</form>

add the event to body.. onLoad="document.gateway.submit();"

And this should run transparently for javascript users, and still usable for non javascript ones.

Good luck ;)

fintan




msg:1304444
 4:18 pm on Aug 26, 2004 (gmt 0)

Thanks. I'm going to see if I can come up with something. Although javascript seems the only way.

coopster




msg:1304445
 1:18 pm on Aug 28, 2004 (gmt 0)

You could use PHP session handling [php.net] to store the userid and pwd info server-side, then make your own POST to the mail login with PHP's header() [php.net] function.

JasonHamilton




msg:1304446
 11:50 pm on Aug 29, 2004 (gmt 0)

I hate using javascript for anything.

I make use of header("Location: newpage.php")

as well as making calculations in a php page, then including() another page within it. My php.ini is setup to buffer everything so that I can set cookies/sessions at any time during the process.

fintan




msg:1304447
 8:49 am on Aug 30, 2004 (gmt 0)

Thanks for the replies. So using a header redirect would be the best thing. Then how do I go about sending the post info. I'm going to have a look at url_rewriter.tags and see if that would work.

For the time being I was going to write some javascript to do the redirect and see how that goes.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved