ok trovato, mi autorispondo:

if ($flag==0)
header("Location: nonce.php");
else
header("Location: ce.php");

lo sapevo che era semplice