Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

General Guidence

by Legg83 (Novice)
on Jul 17, 2001 at 00:18 UTC ( [id://97162]=perlquestion: print w/replies, xml ) Need Help??

Legg83 has asked for the wisdom of the Perl Monks concerning the following question:

I'm just looking for someone to point me in the correct direction on a few things. I don't need an explination of functions, I just need to know where to begin looking.

1) How can I redirect a user to a different website.
2) How can I create a website which revolves around users, and passwords. I know how to work with .htaccess, and .htpasswd, but is this necessary, if I am going to be doing the whole site in CGI?
3) I need to create a searchable database, but know nothing about SQL, or Oracle, or any databases. Whats to stop me from creating a piped text file, and search and minipulate using that file? Under what circumstances would I need to stop using a clear text file, and switch to an actual database?

If you have any functions, modules, documentation that you think might help me out any at all, I'd apprechiate it.

Thanks monks.

Replies are listed 'Best First'.
Re: General Guidence
by pmas (Hermit) on Jul 17, 2001 at 00:48 UTC
    re #1: To redirect: CGI.pm is your friend, read use CGI or die;.
    re #2: Yes, you are... :^)
    re #3: excellent web site which will allow you to learn SQL by submitting queries. They will run them and show you results. Really cool: http://sqlcourse.com/

    pmas

    To make errors is human. But to make million errors per second, you need a computer.

Re: General Guidence
by Starky (Chaplain) on Jul 17, 2001 at 02:09 UTC
    Something that hasn't been mentioned thus far but I think bears mentioning about (3): If you rely on flat files to store data, then you've got to worry about file locking; that is, two CGI processes fighting over or otherwise munging a flat file in a very bad way because each doesn't know the other is doing something to the data.

    Frankly, it's easier just to learn about how to put together a simple database than to deal with all the issues that arise from working from flat files. (By easier, I mean maybe not to get the thing running at first depending on your level of familiarity with databases, but over the life of the project, in terms of maintenance and upgrades etc., the time savings will be considerable.)

    I'll reiterate what the earlier poster said for emphasis: Only good things will come of learning SQL and some basic database skills. You'll use them over and over (and over and over ...) again in your career. Furthermore, with the advent of high-quality open source databases (I have used MySQL quite extensively for things that don't require the big iron approach of Oracle and am very impressed), your learning curve is not very steep, the learning environment is free and very easy to install (based on my experience with Linux), and the production environment is super-cheap (assuming you're a good citizen and donate a few hundred bucks to the open source group :-).

    Hope this helps!

      I agree here... I co-manage something like 10,000 users with DB_File. It's a nightmare. I've been working on the SQL version for the past few months, and now that I have the basics working I can safely and clearly say that managing users with flat files is just plain stupid ( if you have a choice between flat files and a relational database )

      If you have some spare time, definitely go with mySQL or Postgres.... they rock

Re: General Guidence
by Cubes (Pilgrim) on Jul 17, 2001 at 01:00 UTC
    1) Meta-tags, as previously mentioned, are one solution. What meta tags actually do is mimic HTTP headers (hint, hint), which is probably what you want to delve into because...

    2) Using .htaccess and .htpassword is not necessary if you're doing the whole thing with CGI, but why not let the web server do the authentication work for you? OK, so it's not the most flexible or secure method in the world, but it's a start. If you're going to get into using cookies, be sure to read this. Understanding the HTTP headers involved in either method is a good idea.

    Also, if you are doing the whole thing in CGI, and you have appropriate access to the server, take a look at mod_perl -- with this you can get at the authentication and access control phases of the web server process directly, as well as getting better performance for your CGI scripts (content handlers).

    3) As has already been said, nothing is stopping you except performance. Databases and simple SQL aren't very hard to learn, and MySQL or PostgreSQL cost nothing -- not a bad investment even if you aren't sure you want to use them.

      The reason I don't want to use .htaccess, and .htpassword, is because I don't want to have the permissions set to 0666. I need to just sit down and read a chapter on CGI security, or something of the like.
Re: General Guidence
by dragonchild (Archbishop) on Jul 17, 2001 at 00:25 UTC
    The answer to #1 is using meta-tags. It's been 5 years since I did anything like that, but that's what you want to look for.

    As for #3, the reason is scalability - you want to use a database once your performance degrades. Using a piped text file is good for, generally, under 1000 records in under 10 tables. Get beyond that and you really want to go to a relational database. It's worth the time and effort to learn how to use them, as you'll find yourself using them over and over in your programming career.

    In addition, a RDBMS will help with your security questions, too. :)

      Thanks.

      For the redirection, I was hoping that there would be some sort of operator that would redirect the user, instead of having to load a blank html page which would redirect the user.
        Think about it this way - the browser has to get something to know to do something. That something has to be HTML, JAVA, or something similar. Generally, what people do is create a page containing "You are being redirected to XYZ URL. This should take place in 5 seconds." That way, they know they're being redirected.

        Anything else beyond that, like what happens at Yahoo or whatever, needs to be done at the HTTP server level, which is out of my league.

        Set the "Location" header in the HTTP headers:

        Location: http//www.redirect-targetsite.com/;
Re: General Guidence
by Jonathan (Curate) on Jul 17, 2001 at 19:38 UTC
    I agree with the previous couple of postings. For user access I'd recommend writing a Perl Apache module ( a PerlAuthenHandler). It's easy to do and well documented in The Eagle
Re: General Guidence
by mlong (Sexton) on Jul 18, 2001 at 10:31 UTC
    I just want to make one thing clear in case there's any confusion. If you're concerned about security at all, no method of writing CGIs or using an .htaccess file is going to keep a would-be cracker from gaining information unless you are using SSL (Secure Socket Layer). If you don't see https:// at the front of your URL, you're sending data in the clear. Just FYI.

    It's late. I'm going to bed!

    -Matt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-16 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found