Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old May 7th, 2006, 3:39 PM   #1
dunowhodoyou
Newbie
 
Join Date: May 2006
Posts: 5
Rep Power: 0 dunowhodoyou is on a distinguished road
Storing passed information into a text file

Im doing an project and im not the best at php at all so really need your help, I'm trying to send user data to another location and store it to a text file, so i pass the information over and catching it with this code

<?php
$colorpreference = $_GET['userinformation'];
$ip = getenv ('REMOTE_ADDR');
$date=date("j F, Y, g:i a");;
$referer=getenv ('HTTP_REFERER');
$fp = fopen('colorpreference.txt', 'a');
fwrite($fp, 'Data: '.$colorpreference.'<br> IP: ' .$ip. '<br> Date and Time:
' .$date. '<br> Referer: '.$referer.'<br><br><br>');
fclose($fp);
header ("Location: /thankyou.html");
?>


This is the data being passed is

http://www.myserver.com/test2.php?us...olour=#FFFFFF;

but once the script gets to saving the # symbol it stops and all i get
in the text file is

Data: Email=myemail@gmail.com; Username=correctusername;
Colour=<br> IP: correct ip here<br> Date and Time: 4 May,
2006, 4:30 pm<br> Referer: <br><br><br>

Is there anyway i could just tell the script to convert everything to
a string and save it or maybe since i know whats being passed could i
just set it up to expect the colour field to be characters, or take out the # character before i store the answer and put it in later when i need it?

But actually when i check the file before it gets sent over sometimes it has two hash symbols like ##FFFFFF I cant help this but maybe it will help the solution.

any ideas?

other code ive tried with it is

<?php
$colorpreference = $HTTP_GET_VARS["userinfo"];
$ip = getenv ('REMOTE_ADDR');
$file = fopen('colorpreference .txt', 'a');
fwrite($file, $colorpreference . "\n\n");
header ("Location: /index.php"); //<-------After it redirects to another page.
?>

<?php
$f = fopen(“colorpreference .txt”, “a”);
fwrite($f, “IP: {$_SERVER[‘REMOTE_ADDR’]} Ref: {$_SERVER
[‘HTTP_REFERER’]} Data: {$HTTP_GET_VARS[‘userinfo’]}\n”);
fclose($f);
?>

But yet again the same problem it doesnt store anything after the #
dunowhodoyou is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC