Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: SSI/Database questions

by lacertus (Monk)
on Mar 27, 2003 at 02:19 UTC ( [id://246138]=note: print w/replies, xml ) Need Help??


in reply to SSI/Database questions

Using SSI is quite simple, and powerful to boot, since SSI is built into the webserver, it is generally very quick. I have a Perl program that generates website statistics (hits, etc) using the Apache logs. This program takes various arguments, one of which outputs just a simple total/daily hits value. Wit SSI, I can just call this program with the correct argument and have that value placed in the webpage dynamically:
<!--#exec cmd="program -t daily" -->
Really simple, I hope I am clear. Answer to your second question can be done in two words: use CGI.

As for using MYSQL, I generally don't recommend it unless you expect your database to be recieving multiple simultaneous queries - this is where MYSQL shines. It's really a production database. For almost all of my needs, a simple Berkley DBASE works just fine; it is quick and succint, and does not have all the inherent complexities like permissions, etc, that maintaining a MYSQL database has.

Cheers,
John

------------------------------------
"There is more in heaven and earth
than is dreamt of in your philosophy"

Replies are listed 'Best First'.
Re: Re: SSI/Database questions
by simon.proctor (Vicar) on Mar 27, 2003 at 10:46 UTC
    For reasons stated on the apache site (look at the ssi docs here), using the exec option for executing commands is considered dangerous. Heres a reason why:
    <!--#exec cmd="ls" -->
    They recommend that includes are turned on without the exec option available. This is the recommended method:
    <!--#include virtual="/cgi-bin/counter.pl" -->
    You can still pass arguments to your script, though I admit I have only done this using GET style arguments. ie:
    <!--#include virtual="/cgi-bin/counter.pl?offset=1000" -->
    HTH

    Simon
Re: Re: SSI/Database questions
by sulfericacid (Deacon) on Mar 27, 2003 at 02:28 UTC
    Ok, I'll try using that snippet to get my counter to work. Do you have to program around SSI (like do you need to know ahead of time how to write it if you plan on using SSI or would a premade counter just assumidly(wd?) work?).

    Use CGI, lol, I kind of love when people say that. You don't know exactly what you're looking for but they send you to a documentation which is like 100 pages in length :P I'll take a look, it's probably something fairly obvious.

    Awesome, looks like MySQL will never have to be used with any of my scripts then. That's a relief cause I've never even been able to open a MySQL database on my server, I'll definately stick with SDBM as that seems to be working great so far.

    Thanks for your help Lacertus!

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

      If you're having trouble figuring out how to use CGI from its documentation, start here in the Tutorials section. There are several pages that will help you get started with CGI. The most important parts of CGI are its parsing if incoming data, not the HTML generation stuff. My personal opinion is that generation is better handled with templates but CGI is indispensible for retrieving submitted data. For that, about all you need to know is $query->param("fieldname").

      If you can access a real database, I'd recommend it over SDBM files. I think they're much easier to work with and are certainly more flexible.

      --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246138]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found