Include or Header PHP

Soldato
Joined
30 Nov 2005
Posts
3,084
Location
London
Very basic question but, when would one use the following:

header("location: destination_url.php");

over

include "destination_url.php";

Is a header safer over include, in terms of POST values.

Thanks,

James
 
Im developing user registration in php.

There are checks in place that looks to see if a username already exists, if so then so far I have
Code:
die include(something.php)

Is this the right way or should it be header?
 
Here is what I have:

Code:
$userexist = mysql_query("mysql query here");

$username_exist = mysql_num_rows($userexist);

if($username_exist > 0){ 
die(include "regerrorusername.php");
}

If a user does not exist the rest of the code (not shown) is run, such as checking whether the email is a valid email address, check two passwords are the same etc.

Is the include suitable?
 
Perhaps I've got the wrong understanding of the Die function, thought it would just terminate and thus stopping anything else from running.

And before the pre-optimization police come sniffing around :p I have the MySQL real escape and string replace for whitespace.

Edit: Just need something to remove all Characters other than numbers or letters.
 
Last edited:
Back
Top Bottom