PDA

View Full Version : php linking


invitezone
06-28-2008, 09:38 PM
Hi there,
I have a simple php login script but need to change something slightly


$msg = 'Password incorrect.';



<form action="" method="POST">
<p>
<input type="password" name="password" size="20">
&nbsp;
<input type="submit" value="Login">
<input type="hidden" name="sub" value="sub">
</p>
<div class=error><?=$msg?></div>



instead of displaying the password incorrect message i would like to send the user to a url with their whatever they put as the password on the end

eg. www.mysite.com/1.php?substring=XXXX

where XXXX is their input


could some explain how I could do that please

thanks a lot

MoT3rror
06-29-2008, 03:02 AM
You can use the function exec_header_redirect (http://members.vbulletin.com/api/vBulletin/_includes---functions.php.html#functionexec_header_redirect) when the login is invalid but I suggest highly not to redirect with the password already input. Sending a password in plain text is not a good thing to do. Also some browsers have problems with forms that have blank as the action or no action.

invitezone
06-29-2008, 04:00 AM
thankyou for your answer but would you be able to show me how to use it? im new to this and I cant seem to make it work.

Do I do something like....

$msg = exec_header_redirect("www.mysite.com/1.php?substring=");

and also how do I add the incorrect password on the end?

thanks for your help.

MoT3rror
06-29-2008, 04:30 AM
exec_header_redirect is a function that does the redirect, I don't believe it returns anything.


if() //invalid login
{
exec_header_redirect("1.php?substring=" . $password);
}

But like I said it is not good security wise to send the password in plain text or in any encryption that can easily be unencrypted.

invitezone
06-29-2008, 04:57 AM
ok thanks i'll give that a try.

ps. im not using this to create a secure login or anything, im just adapting a login script to fit my needs. There will be the proper vbulletin login after this.

--------------- Added 1214721236 at 1214721236 ---------------

hmmm im getting the error
Fatal error: Call to undefined function exec_header_redirect() in /home/invitezo/public_html/home.php on line 388

line 388 is

exec_header_redirect("1.php?substring=" . $password);

Opserty
06-29-2008, 10:11 AM
Use the header (http://uk3.php.net/manual/en/function.header.php)() function.

invitezone
06-29-2008, 10:36 AM
ahhh working perfectly now, thanks very much to both of you for helping me

Dismounted
06-29-2008, 12:55 PM
exec_header_redirect() is a vBulletin function and will only work if its files are included.