D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Apache directory cgi mapping



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 05 July 2002 9:58 am, jody salt wrote:
I run an apache web server on RedHat 7.1 what I want
to know is:

Is there any way of mapping directorys to cgi
programs?
e.g
I want http://foo.bar.com/info/ to access real
documents in my /foobar/info/ directory

Alias /info/ /real/path/to/foorbar/info/

BUT!!
I want http://foo.bar/dynamic/ to access my
dynamic.cgi script.

DirectoryIndex dynamic.cgi

What this dynamic.cgi script will do is output
formated records etc.. from my MYSQL database as
webpages.

EG
lets say I have a record structure thus:
userdata(username, webpage_data)
we will treat user name the key field

the following url:
http://foo.bar.com/dynamic/james/
will output the webpage_data field were username
equals 'james'.

somethign like this then:

*snip code fom the top of my head*
my ($data, $UserName, $dbh);
($UserName) = ($ENV{PATH_INFO} =~ /^([a-z0-9]+)/);
$dbh = DBI->connect(dsn, un, pwd);
$data = ($dbh->selectrow_array(sprintf("SELECT webpage_data from userdata 
where username = %s", $dbh->quote($UserName)))) if ($UserName);
print ($data eq undef) ? "User not found\n" : $data;
exit;
*end snip*

or such will work with apache, as it's kind and sets PATH_INFO for you.

(In a couple of months time I will have server that
needs hardening to hackers, which I will give as a
hacking project to people who want to test there
skills; providing they tell me how they got in etc so
I make the nessarserry patches)

you mean a honeypot, or shell access for people to launch attacks from your 
box from?

~ Theo, being a lazy bitch and just waking up ;)

- -- 

Theo Zourzouvillys
http://zozo.org.uk/

Increased knowledge will help you now.  Have mate's phone bugged.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9JYED448CrwpTn6YRAn50AJ9ZPpgtkEek9I88wgw4W+oM2w4jKQCdHr4Z
VlGgn1Z/LY432c3W8nP5RKI=
=D1Yi
-----END PGP SIGNATURE-----


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly