Reply to Re: How to open another page by PHP

Your name:

Reply:


Posted by feudalac on 02/03/06 00:21

Stefan Mueller wrote:

> > No, PHP is executed from top to bottom, it will only include those
> > pages it's told to include depending on the condition. In your
> > switch example, there would be at most one file included (no
> > default, so there can be time no file is included).
>
>
> You're right. 'Include' in PHP is not like 'Include' in C++. The file
> gets only loaded if the 'include' command gets executed. Therefore it
> also works with dynamic filenames. Wow, that's exactly what I was
> looking for.
>
> Many thanks to all of you
> Stefan

if (condition){
header("Location: login.php");
}
else{
do something
}


this works fine but there must not be anything printed out by the php
because header will be automaticly generated and this one that
redirects the browser will not work

ofcourse you can pass _GET variables this way if needed...

since you don't know if the user has js enabled - this is the best way
to do this

example


when username and password are entered and 'logon' button is pressed,
the process.logon.php page loads

->

read data from mysql
if (resultset has entryes) {
if (password from db = entered password){
header("Location: index.php?uid=somedata&another_var=another_val");
}
else {
// redirect to logon again - counting retryes is a good idea
header("Location: logon.php?uid=3&tryes=n"); }
// or print out something
print "wrong password" //better to exit to html and write something
nice looking
}
else {
// No souch user, redirect to 'register.php'
header("Location: register.php");
}

--

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация