Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-05-2004, 07:01 PM   #1
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
How do I do this using CGI ?

I have a web page that generates a string of hexadecimal characters when the surfer is browsing and I want to store them in a text file.

EG. http://mydomain.com/cgi.pl?AAC7EE

What I want to do is append a text file and add the "AAC7EE" or any other string after the ? to the file.

Any help is appreciated.
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:06 PM   #2
hyper
Confirmed User
 
Join Date: Mar 2002
Location: Mass Ass
Posts: 5,294
store the query string in a $variable
open a txt file and write the $variable in it
__________________
hyper is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:12 PM   #3
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
Quote:
Originally posted by hyper
store the query string in a $variable
open a txt file and write the $variable in it
cool but how, I don't know jack about CGI

I already have the webpage that generates the text string I just need to know how to save all the info after the ? to a file when they click the link.
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:18 PM   #4
NetRodent
Confirmed User
 
Join Date: Jan 2002
Location: In the walls of your house.
Posts: 3,985
Which language are you trying to write it in?
__________________
"Every normal man must be tempted, at times, to spit on his hands, hoist the black flag, and begin slitting throats."
--H.L. Mencken
NetRodent is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:18 PM   #5
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
Quote:
Originally posted by AssFairy


cool but how, I don't know jack about CGI

I already have the webpage that generates the text string I just need to know how to save all the info after the ? to a file when they click the link.
yo...you need to learn perl than...not so hard
hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:24 PM   #6
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
Quote:
Originally posted by NetRodent
Which language are you trying to write it in?
Whatever is quickest and easiest

It used to be stored in a mysql database but this is no longer possible.

Whilst the surfer is browsing a string of data is generated and appears after the ? in their browser, I don't care how its done but I need to store that information in a plain asci file.

I was hoping this to be just 3 or 4 lines of CGI code
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:26 PM   #7
icedemon
Confirmed User
 
Join Date: Jun 2003
Location: Lutz, FL
Posts: 1,022
Code:
#!/usr/bin/perl

print "Content-type: text/plain\n\n";
if ($ENV{'QUERY_STRING'}) {
	open(FILE, ">>file.txt") || die (print "$!\n");
	print FILE $ENV{'QUERY_STRING'} . "\n";
	close(FILE);
}
Here is some perl code you can use.
__________________
Clips4Sale.com
icedemon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:30 PM   #8
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
Quote:
Originally posted by icedemon
Code:
#!/usr/bin/perl

print "Content-type: text/plain\n\n";
if ($ENV{'QUERY_STRING'}) {
	open(FILE, ">>file.txt") || die (print "$!\n");
	print FILE $ENV{'QUERY_STRING'} . "\n";
	close(FILE);
}
Here is some perl code you can use.
Many thanks I'll have a go at getting this to work
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:33 PM   #9
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
Quote:
Originally posted by icedemon
Code:
#!/usr/bin/perl

print "Content-type: text/plain\n\n";
if ($ENV{'QUERY_STRING'}) {
	open(FILE, ">>file.txt") || die (print "$!\n");
	print FILE $ENV{'QUERY_STRING'} . "\n";
	close(FILE);
}
Here is some perl code you can use.
you can add to the code after the first print statement...for example:


print "<b>hello there</b>";

to print to the browser....just remember the semicolon to terminate the statement and to "escape" things like a quotation mark:

print "<a href=\"./dir/index.html\">home</a>";

see... add a backslash before the quotation mark: \"

Last edited by hudson; 01-05-2004 at 07:37 PM..
hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:47 PM   #10
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
It don't appear to be working, for some reason when I click the link I get redirected to my 404 page!!!

I used unix format when I uploaded the script and set the test.pl file and the file.txt to 666 (chmod)
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:53 PM   #11
icedemon
Confirmed User
 
Join Date: Jun 2003
Location: Lutz, FL
Posts: 1,022
You need to chmod the test.pl to 755 if it's not set to that already. Show the link and I'll see what might be happening. You can also check your error log files to see what might be happening to.
__________________
Clips4Sale.com
icedemon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 07:56 PM   #12
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
probably has something to do with your directory not allowing a cgi type file. so it rejects the file and redirects you a la .htaccess

well, that's my guess...any others?
hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:00 PM   #13
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
Quote:
Originally posted by icedemon
You need to chmod the test.pl to 755 if it's not set to that already. Show the link and I'll see what might be happening. You can also check your error log files to see what might be happening to.
Yeeeeeeeeeeeeeeeeeeeeah baby that works FINE

Thanks for the help peeps I can get on with saving the world now
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:02 PM   #14
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
Quote:
Originally posted by AssFairy
Yeeeeeeeeeeeeeeeeeeeeah baby that works FINE

Thanks for the help peeps I can get on with saving the world now
cool beans...now you have experienced the life of a programmer

hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:06 PM   #15
AssFairy
Confirmed User
 
Join Date: Jun 2003
Location: AssTown
Posts: 674
Quote:
Originally posted by hudson


cool beans...now you have experienced the life of a programmer

I don't know about that but I think I had a small orgasm when I saw it work (at last)
__________________
I sale lube
AssFairy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:08 PM   #16
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
Quote:
Originally posted by AssFairy
I don't know about that but I think I had a small orgasm when I saw it work (at last)
yep...that's it...absolute terror followed by a small orgasm
hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:24 PM   #17
Rorschach
So Fucking Banned
 
Join Date: Aug 2002
Posts: 5,579
and that aching feeling in your nuts like you can't sit still when it just won't fucking work
Rorschach is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-05-2004, 08:58 PM   #18
hudson
Confirmed User
 
Join Date: Jul 2003
Location: Grand Central
Posts: 2,948
Quote:
Originally posted by Rorschach
and that aching feeling in your nuts like you can't sit still when it just won't fucking work
hudson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.