View Full Version : cgi question
cliffski
10-26-2004, 02:53 PM
Hi, I know nothing about perl or php or cgi, but i just need to do this one thing...
i have a webpage which all my various buynow buttons go to like this:
www.mysite.com/regsiter.html
thats fab, but i want to track the data better. i get the impression that cgi is what i need, so something like this:
www.mysite.com/register.cgi?button=front?dayssinceinstall=0
(the syntax is probably crap...)
I'm guessing I can then have the cgi code write those varaibles and maybe a date stamp to a text file, or maybe send me an email with that data...
my question is...
Am i barking up the wrong tree? is cgi the right way to do this? is it a simple thing to do, and can anyone recommend sample code or tutorials handling that kind of thing.
Any advice much appreciated.
keethrus
10-26-2004, 03:34 PM
I'd definately suggest going with PHP. Your webhost more than likely has it, and it's a breeze to learn! Just goto php.net and look up anything, PHP probably has it in just one function call. You can do what you're talking about with PHP really easily. If you need any help, don't hesitate to ask! :)
- Jeremiah
Sillysoft
10-26-2004, 05:12 PM
Yeah, I would also suggest using PHP if your webhost supports it. It's a C-like language that you can use to stick some code inside of html files. It has built-in functions to send email and read/write/append to files, etc. If you want to go a little more complex then you can hook it up to a database pretty easily to store the results.
An easy way to see if your webhost supports PHP already: create a file called foo.php on the server and put this inside of it:
<?php
phpinfo();
?>
Then load it in a browser. If it prints out a lot of information then PHP is already installed.
Indiepath
10-26-2004, 10:39 PM
PHP (+ MySQL) is my suggestion too.
www.php.net
There are good starter books on php (+mysql). Buy one of those too.
...or hire somebody who knows PHP+MySQL
Another vote for php.
from this thread (http://forums.indiegamer.com/showthread.php?t=787)
Oh I forgot to mention xampp.
http://www.apachefriends.org/en/xampp.html
It's a complete (free) package. Apache, php, mysql and perl. After running the installer you have a nicely configurated running webserver, which you can use for "toying" around (did that the whole day long... duh) ;)
Without a local server testing such stuff would be quite painfull. [On a second thought... most likely you already have one, but I still think it's good to post that for the guys who don't have one]
Just grab/install that package and try it for yourself :)
>(the syntax is probably crap...)
Yes, it is. There should be onle one questionmark (marking the start of the so called querystring). It's always key=value and these pairs are seperated with '+', ';' or '&' (with php it's usually '&').
"Days since install" would be stored in a cookie anyways (and it would be infact days since download ;)).
mahlzeit
10-26-2004, 11:20 PM
If you send requests like http://site/page.html?foo=bar, then the web server already stores this in a datestamped text file: the web logs. If you just want to count the number of these requests, all you need is a simple (offline) script to parse the log files. The page doesn't have to be named .cgi, it is still a regular HTML page. Everything after the ? is now extra data that the web server ignores, but it does put the full request in the logs.
andyb
10-27-2004, 12:44 AM
Yes, it is. There should be onle one questionmark (marking the start of the so called querystring). It's always key=value and these pairs are seperated with '+', ';' or '&' (with php it's usually '&').
The CGI standard uses and '&' to partition parameters, nothing else.
With PHP or Perl, or any other language, you can use what ever you like, but you'll need to parse the string yourself, whereas most languages have ready built or built in libraries to pick up properly terminated and partitioned CGI query strings.
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.