You cannot rely on HTTP REFERER because users can manipulate it and browsers may refuse to send it.
The only “safe” way would be to set the session variable to register.php and check if this variable is set to confirm.php. Something like that:
register.php:
session_start();
$_SESSION['valid_user'] = true;
confirm.php:
session_start();
if(!isset($_SESSION['valid_user'])) {
die("You did not come from the page i specified!");
}
, register.php, register.php.
HTTP , . , , . ?