grandman Posted December 3, 2008 Share Posted December 3, 2008 hello, I have a small script which is called when members log-in. if they are a new member, the script should create a new area for them, if and existing member, it should direct them to their own area. My problem comes from trying to check if the area exists, here's the script: <?php $dirname = $_POST["username"]; $filename = "/home/vars/public_html/main/se/pass/pat/join/on/control/{$dirname}/"; if (file_exists($filename)) { header ( "Location: " . "$filename" . $_POST["username"]); } else { mkdir("/home/vars/public_html/main/se/pass/pat/join/on/control/{$dirname}", 0777); echo "welcome " . $_POST["username"] . "Your Area Is Being created."; } ?> Error message: Warning: Cannot modify header information - headers already sent by (output started at /home/vars/public_html/main/se/pass/pat/join/crete.php:1) in /home/vars/public_html/main/se/pass/pat/join/crete.php on line 6 I don't understand, is it saying there are two scripts? i only have one script. also what is being sent anywhere? or is there a way of achieving this? DG Link to comment https://forums.phpfreaks.com/topic/135407-solved-problems-with-mkdir-and-headers/ Share on other sites More sharing options...
dirtyfrenchman Posted December 3, 2008 Share Posted December 3, 2008 When redirecting via location() it's has to be the first thing that's displayed on the page. Make sure there is no content or whitepace being output before it. Link to comment https://forums.phpfreaks.com/topic/135407-solved-problems-with-mkdir-and-headers/#findComment-705271 Share on other sites More sharing options...
grandman Posted December 3, 2008 Author Share Posted December 3, 2008 When redirecting via location() it's has to be the first thing that's displayed on the page. Make sure there is no content or whitepace being output before it. Hello, thank you for that, it must have been the white spaces, all I did was close everything up. I have another problem now though, which is with mkdir, do I have to start a new thread for that? DG Link to comment https://forums.phpfreaks.com/topic/135407-solved-problems-with-mkdir-and-headers/#findComment-705287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.