News:

Join the Facebook Fan Page.

Main Menu

Smart Redirect

Started by Shoeb Omar, July 30, 2004, 03:36:59 PM

Previous topic - Next topic

Shoeb Omar

Hey guys..

I wanted to know if it's possible to redirect to a script filling in it's post values in the redirect code..

As in:

$_POST['user'] = 'bob';
$_POST['pass'] = 'pass';
header("Location: http://www.mysite.com/forum/index.php?action=login2");

I tried a variation of that but it didn't work.

Any help would be greatly appreciated.

TIA

[Unknown]

You can't use Location, but yes.

When you use the admin login thing, it actually does this ;).  It basically dumps the form data into a form.

Using javascript, you can auto submit it too... but this is usually bad practice.

-[Unknown]

Spaceman-Spiff

you can temporarily save it in session variable or cookies...
or make a temporary database table...

Shoeb Omar

#3
Quote from: [Unknown] on July 30, 2004, 04:18:43 PM
You can't use Location, but yes.

When you use the admin login thing, it actually does this ;).  It basically dumps the form data into a form.

Using javascript, you can auto submit it too... but this is usually bad practice.

-[Unknown]

so.. with a diff redirect it would work? And if so, what type would you suggest that you know works?

[Unknown]

I would suggest avoiding redirects whenever possible, except when they are necessary.  If you can redirect the data internally, or even pipe it manually, it might go better.

-[Unknown]

z3r0_un0

#5
A javascript:


<script>
function redireccionar(pagina){location.href=pagina} setTimeout (redireccionar('?'), 1000);
</script>


But do this:


echo "<script>";
echo "function redireccionar(pagina){location.href=pagina} setTimeout (redireccionar('?'), 1000);</script>";


Why? well, because if you want see this in your explorer, it's not going to work, just work in the server, because is a php instruccion.  ;)


[Unknown]

That won't do post data.  What I referenced involved outputting an entire html form, and then using document.formName.submit().

-[Unknown]

Advertisement: