Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Permissions and Headers! Urgent!

ashoka323ashoka323 Posts: 1Member
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

";
################# 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!


Comments

  • WeirdofreakWeirdofreak Posts: 439Member
    : 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 [grey]perl program[/grey] instead of [grey]./program[/grey] 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

    ";
    : ################# 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.
Sign In or Register to comment.