Topic: redirect after succesful registration.php??? (Read 3385 times)
What a dork
Posts: 17
110 credits Members referred : 0
« on: Aug 24, 2006, 06:33:05 pm »
Hello Olaf,
As I am a newby this must be a laughable to you. I am applying your class and everything works great!
But after the registration.php page I want to redirect to a new page. Ofcourse I know that the form in registration.php posts to itself validate the form and process the registration. So I can't put a url in action="http://" (is now action=$_POST['PHP_SELF']). So I put in a If statement to redirect to an other page if the registration was successfull by using header("Location: ").
Now I think I found that header( ) doesn't work together with $_POST? Is this true and is there an other way to redirect after succesful registration? - scooter
« Last Edit: Aug 24, 2006, 08:56:54 pm by scooter »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
Re: redirect after succesful registration.php
« Reply #1 on: Aug 24, 2006, 09:07:31 pm »
Hello,
The problem is only that you can't output data from a page and redirect together but you can create a "registration success" page within the register.php
$new_member = new myRegister; //$new_member->language = "nl"; // use this selector to get messages in other languages
if (isset($_POST['Submit'])) { if ($new_member->register_user($_POST['login'], $_POST['password'], $_POST['confirm'], $_POST['name'], $_POST['info'], $_POST['email'])) { echo "redirect wordt gestart <br>"; header("Location: ". $_SERVER['PHP_SELF']. "/register_success.php"); } } $error = $new_member->the_msg; // error message echo "hier komt the_msg: " .$new_member->the_msg; ?>
« Last Edit: Aug 25, 2006, 05:47:38 pm by scooter »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #4 on: Aug 25, 2006, 06:19:46 pm »
its not allowed to output data before sending a header you did this twice...
I debug this kind of things without sending a header and only if everthing is working I send the header.
What a dork
Posts: 17
110 credits Members referred : 0
« Reply #5 on: Aug 29, 2006, 01:39:49 am »
Thanks Olaf. It took a few days, but I got it all nipped now. No output before header(). This was a good lesson on an interesting subject!!!
What a dork
Posts: 17
110 credits Members referred : 0
« Reply #6 on: Dec 09, 2006, 05:26:39 am »
Step 1: I have an input form on page 1 (asks for only an e-mail address). I use this e-mail address to lookup the username, password and redirect to page 2. <form name="form1" method="post" action=<?PHP echo "/page_1/"; ?>> <label for="login">E-mail:</label> <input type="text" name="login" size="30" value="<?php echo (isset($_POST['login'])) ? $_POST['login'] : $my_access->user; ?>"> <input type="submit" name="Submit" value="Login"> </form> Step 2: On page 2 the user needs only to click on a second Submit-button (see below) with two hidden form-fields. These hidden fields already contain the username, password (from Step 1) so the user can automatically login to the external web-application (for example http://url.web-application.net). <form name="form1" method="post" action="http://url.web-application.net" <input type="hidden" name="login" size="30" value="<?php echo (isset($_POST['login'])) ? $_POST['login'] : $my_access->user; ?>"> <input type="hidden" name="password" size="8" value="<?php echo (isset($_POST['password'])) ? $_POST['password'] : $my_access->user_pw; ?>"> <input type="submit" value="Begin web-application" > </form>
Above procedure is a way to automatically login to an external web-application, with only your e-mail address and it works fine.
My question is how can I let the user: enter an e-mail address(1), lookup the username password in a database(2) and send them to the external web-application where to user is logged-in automatiacally(3) all on one page. I tried it with methodes like: $_POST['login'] = $login; $_POST['password'] = $password; heaser("location: ")
But I had no luck yet. Hope you have an idea?
« Last Edit: Dec 09, 2006, 05:29:05 am by scooter »
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #7 on: Dec 09, 2006, 09:01:05 am »
Quote
My question is how can I let the user: enter an e-mail address(1), lookup the username password in a database(2) and send them to the external web-application where to user is logged-in automatiacally(3) all on one page. I tried it with methodes like: $_POST['login'] = $login; $_POST['password'] = $password; heaser("location: ")
But I had no luck yet. Hope you have an idea?
I think that can be done cURL, but I'm sure that this more difficult than what you have done until now. btw. posting the login and password to a form is very unsafe...
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #8 on: Dec 09, 2006, 11:24:42 am »
I had the same problem before some time.
cURL will be difficult as implementation, and it may have some security risks - it can be buggy with this implementation.
SOAP is the best way to do that if you want a server implementation, but it will need a lot of development time.
The best and easiest way to do that, is to create a form for the user and automatically submit it with javascipt to the other site