$fh = fopen("../../".$_POST['dir']."/index.php", 'w') or die("Can't create file"); if ($_SESSION['c']) {$line16="echo 'Hi, '.$_SESSION['nick'].' - <a href='acc.php'>My account</a> | <a href='logout.php'>Logout</a>';";} else {$line16="echo '<a href='sup.php'>Sign up</a> or <a href='sin.php'>Sign in</a>';";} fwrite($fh, $line16); fclose($fh);