Beh.. http_referer non funziona facendo la redirect tramite header. Penso che userò i cookie. Grazie a tutti