Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Best way to differentiate accounts with one set of scripts?

Reply
Thread Tools

Best way to differentiate accounts with one set of scripts?

 
 
Vinnie Murdico
Guest
Posts: n/a
 
      08-17-2004
Hi,

I'm creating a series of Perl scripts that make up an entire web site.
It works fine, but now I'd like to change it such that I can "replicate"
this entire web site for multiple accounts for various customers.

I don't want to make copies of the scripts for each hosted account,
because errors and enhancements will then need to be replicated across
multiple copies -- a maintenance nightmare.

I thought about requiring users to "log in" first, and creating a cookie
that contains their account name. Then when each script runs, it looks
at the cookie and gets the account name and uses that to set variables
for unique directories and files where that account's data would be
stored, thus giving each account a unique data area.

Is there a better way to do this that doesn't involve using cookies such
that the scripts could determine which user account was in effect when
it was run so it could look at the correct data location for that
account?

Thanks in advance for any ideas...

-- Vinnie


 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      08-17-2004
Vinnie Murdico wrote:
> I'm creating a series of Perl scripts that make up an entire web
> site. It works fine, but now I'd like to change it such that I can
> "replicate" this entire web site for multiple accounts for various
> customers.
>
> I don't want to make copies of the scripts for each hosted account,
> because errors and enhancements will then need to be replicated
> across multiple copies -- a maintenance nightmare.
>
> I thought about requiring users to "log in" first, and creating a
> cookie that contains their account name. Then when each script
> runs, it looks at the cookie and gets the account name and uses
> that to set variables for unique directories and files where that
> account's data would be stored, thus giving each account a unique
> data area.
>
> Is there a better way to do this that doesn't involve using cookies
> such that the scripts could determine which user account was in
> effect when it was run so it could look at the correct data
> location for that account?


I'm assuming that the scripts are running as CGI scripts. Provided
that suEXEC or a CGI wrap is enabled, the home directory can be
grabbed via the getpwuid() function:

my $homedir = (getpwuid $<)[7];

But how do you ensure that the scripts are accessed via the 'right'
URL? Maybe not a usable idea, after all...

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
ctcgag@hotmail.com
Guest
Posts: n/a
 
      08-17-2004
"Vinnie Murdico" <> wrote:
> Hi,
>
> I'm creating a series of Perl scripts that make up an entire web site.
> It works fine, but now I'd like to change it such that I can "replicate"
> this entire web site for multiple accounts for various customers.


I think you first need to decide on a security model, then only once you
have done that does it make sense to worry about this type of detail.

> I don't want to make copies of the scripts for each hosted account,
> because errors and enhancements will then need to be replicated across
> multiple copies -- a maintenance nightmare.


Where is the nightmare?

foreach (@foo) {
system "rm /blah/blah/$_/*.cgi";
system "cp *.cgi /blah/blah/$_/";
}

I don't see how this solves anything, but I also don't see how it
causes any problems.

> I thought about requiring users to "log in" first, and creating a cookie
> that contains their account name. Then when each script runs, it looks
> at the cookie and gets the account name and uses that to set variables
> for unique directories and files where that account's data would be
> stored, thus giving each account a unique data area.


Cookies are easy to spoof. Would your customers be happy with the
fairly low level of security that this would provide?

> Is there a better way to do this that doesn't involve using cookies such
> that the scripts could determine which user account was in effect when
> it was run so it could look at the correct data location for that
> account?


First you need to make the policy decision of how to authenticate users.
Once you have them authenticated, it probably won't be all that hard to do
the rest.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Differentiate between static and dynamic allocated objects Jo C++ 7 12-28-2006 11:19 AM
How to differentiate between click event of multiple server buttons mayur_hirpara@hotmail.com ASP .Net 5 06-06-2006 03:42 PM
Char to visually differentiate folders from some live bookmarks/feeds. Splibbilla Firefox 0 04-19-2005 11:25 PM
A Plea: Differentiate between Lens Chromatic Aberration and Sensor Chromatic Abbertion digiboy Digital Photography 3 12-06-2004 07:25 AM
How to differentiate between <XX></XX> and <XX/> with SAX dpj5754@yahoo.fr XML 13 08-11-2004 12:02 AM



Advertisments