GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How do I do this using CGI ? (https://gfy.com/showthread.php?t=217402)

AssFairy 01-05-2004 07:01 PM

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.

hyper 01-05-2004 07:06 PM

store the query string in a $variable
open a txt file and write the $variable in it

AssFairy 01-05-2004 07:12 PM

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.

NetRodent 01-05-2004 07:18 PM

Which language are you trying to write it in?

hudson 01-05-2004 07:18 PM

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

AssFairy 01-05-2004 07:24 PM

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

icedemon 01-05-2004 07:26 PM

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.

AssFairy 01-05-2004 07:30 PM

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

hudson 01-05-2004 07:33 PM

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: \"

AssFairy 01-05-2004 07:47 PM

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)

icedemon 01-05-2004 07:53 PM

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.

hudson 01-05-2004 07:56 PM

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?

AssFairy 01-05-2004 08:00 PM

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 :thumbsup :thumbsup :thumbsup

Thanks for the help peeps I can get on with saving the world now :)

hudson 01-05-2004 08:02 PM

Quote:

Originally posted by AssFairy
Yeeeeeeeeeeeeeeeeeeeeah baby that works FINE :thumbsup :thumbsup :thumbsup

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

:thumbsup

AssFairy 01-05-2004 08:06 PM

Quote:

Originally posted by hudson


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

:thumbsup

I don't know about that but I think I had a small orgasm when I saw it work (at last) :1orglaugh

hudson 01-05-2004 08:08 PM

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) :1orglaugh
yep...that's it...absolute terror followed by a small orgasm

Rorschach 01-05-2004 08:24 PM

and that aching feeling in your nuts like you can't sit still when it just won't fucking work

hudson 01-05-2004 08:58 PM

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
:thumbsup :glugglug


All times are GMT -7. The time now is 07:07 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123