PDA

View Full Version : php help


owensbor
09-16-2006, 03:05 PM
I am tryng to collect or monitor what keywords or phases are typed into my site search. I am trying to do this with php. see below.

filename = "logfile.txt";
text = $_GET['search'];

fp = fopen ($filename, "a");
fwrite ($fp, "$text\n");
fclose ($fp);

it works but when i view the logfile all i see is unreadable symbols...

anyone want to help?

thanks

kenny
09-19-2006, 07:58 AM
This probably has to do with the encoding of the data that you submit. Have you tried changing the character encoding when viewing logfile.txt?

Also, it's a good idea to check the contents of $_GET['search'] before writing it to the file.

I suppose the missing $ symbols in front of the variable names at the beginning of each line are removed by our vBulletin...

darthmouse
09-27-2006, 02:48 AM
thanks for the help. (I lost my other password so i created this new one but it is me one in the same)

and yes i failed to copy the $ symbols in.

I shall try as you suggested.

Thanks again.