Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Permissions and Headers! Urgent! Posted by ashoka323 on 24 Oct 2004 at 6:06 AM
Hello everyone, first post!
Well, after a year and a half indulging in PHP & Flash my perl has gotten rusty.
Anyway, I have 2 problems
1. On a unix system how do I set permissions so that a script can only be executed by the server but still print output to the browser?
Basically I want the server to be able to call a page (with variables intact) and print output to the browser but I dont want users to be able to call the page directly since when it is executed it performs routines that without the adequate input can throw off the whole program. Please help before I pull my hair out!!!!
2. I want to set a cookie and then immediately jump to a new page but am having some problems with formatting the header. Any suggestions on how I can combine the following code into 1 header function?:

##################code starts here#############
my $cookie1 = cookie(-name => 'admin',
-value => 'true');
print header(-cookie => $cookie1);
print "Location:../admin/brycePrint.cgi\n\n";
################# ends here ##################

Again, any help would be appreciated. Im overloaded w/ stuff to do right now and am becoming frustrated trying to track down the answers to these little problems! God bless he/she who can lend a hand!


Report
Re: Permissions and Headers! Urgent! Posted by Weirdofreak on 25 Oct 2004 at 3:55 AM
: Hello everyone, first post!
Incoming Slashdotter!

: 1. On a unix system how do I set permissions so that a script can only be executed by the server but still print output to the browser?
: Basically I want the server to be able to call a page (with variables intact) and print output to the browser but I dont want users to be able to call the page directly since when it is executed it performs routines that without the adequate input can throw off the whole program. Please help before I pull my hair out!!!!
I think the server runs as a user in its own right. Change the owner to apache (assuming that's what the server's username is) and chmod 700 or something (if you run it with perl program instead of ./program you only need read permissions). I haven't actually got a server or anything, but I think that's how it works.

: 2. I want to set a cookie and then immediately jump to a new page but am having some problems with formatting the header. Any suggestions on how I can combine the following code into 1 header function?:
:
: ##################code starts here#############
: my $cookie1 = cookie(-name => 'admin',
: -value => 'true');
: print header(-cookie => $cookie1);
: print "Location:../admin/brycePrint.cgi\n\n";
: ################# ends here ##################
:
: Again, any help would be appreciated. Im overloaded w/ stuff to do right now and am becoming frustrated trying to track down the answers to these little problems! God bless he/she who can lend a hand!
I think you can do it with
header(-cookie => cookie(-name => 'admin', -value => 'true'),
-Location => '../admin/brycePrint.cgi');
But I'm not sure.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.