| |||||||||||
| |||||||||||
Send variable to another file Posted by anthony (anthony), 9 July 2005 Hi all,I've a problem which I hope anyone of you experts out there can render your expertise to help me provide a solution. I'm a newbie....so pls excuse my ignorance. How would i take a variable from one file and send it to another file. Basicaly all i want to do is get the user code send to uploader.cgi which is inputed through main.pl file. Below is part of the main.pl #!/usr/bin/perl push(@INC, '.'); use CGI qw(:standard); $cgi = CGI->new; $this = "https://www.mysite.com/cgi-bin/main.pl"; $fpath = "https://www.mysite.com"; $hpath = "/var/www/members/reports"; $filepaths = "/var/www/members/reports/todo"; $passfile = "pswd/pass.log.pl"; $fnames[0] = "query1"; $fnames[1] = "query2"; $fdesc[0] = "List"; $fdesc[1] = "Reports"; if (param()) { if (param('cmd') eq "auth") { &authenticate; &load_type_list; } elsif (param('fname')) { $incookie = $cgi->cookie('buscode'); if ($incookie eq "") { &load_login; } else { &do_load_links; } } elsif (param('getfile')) { $incookie = $cgi->cookie('buscode'); if ($incookie eq "") { &load_login; } else { &get_file; } } } else { &load_login; } Now this variable 'buscode' is to be send to uploader.cgi 'Part of uploader.cgi' #!/usr/bin/perl require 'cgi-lib2.pl'; $parent_dir = "/var/www/lamp/reports/upload/"; This is were $parent_dir = "/var/www/lamp/reports/upload/$buscode"; will be send. I'm at wits end and sure appreciate some helps from gurus out there. Thanks Posted by admin (Graham Ellis), 11 July 2005 Hi, Anthony .... I've had several looks at your question and sample code and I don't completely undertstand what you're trying to do ![]() Are you attempting to let your user put some Perl code for a CGI script into a form, and have it uploaded and made runnable on the server? If so, that can be done easily enough (and if you confirm that I have it right I'll give you some tips but it is a very dangerous thing to do since it opens your server to all sorts of malicious code injections Edit to add - Anthony - I'm out of town for a few days; if you can get back on and clarify your question I'll be able to have a look when I get back. If you've got it sorted already / elsewhere, please post a follow up so that I can close the thread. Thanks! Posted by anthony (anthony), 16 July 2005 Hello Graham Ellis,Thanks for the reply. I have e-mail my files. I will wait for the reply. Its not sorted, take your time. Awaitng favourable reply. Thanking you in advance. Posted by admin (Graham Ellis), 17 July 2005 Anthony, I haven't received any email that I can see from you - perhaps you sent it to someone else, or perhaps the email fitted the profile of spam and got rejected. Between a team of just 3 staff here, we receive around 1000 emails a day, three quarters of which are automatically rejected as bulk unsolicited emails.I can help you best if you follow up and answer the extra questions I have asked here on the forum. You can be much more certain that your message will be read, and it will be read by others who may have some ideas / suggestions too at times that I'm not around ... I'm back briefly this weekend, but within 24 hours I'll be away again. There's another reason that I'm asking you to carry on with this thread rather than mailing too. By asking in public, you're also helping us to provide a resource which may be useful later on to others ... questioning me in an email, and you're asking me to spend my free time helping you, and only you, without it providing any benefit to me (building this web site up) or anyone else. Posted by anthony (anthony), 19 July 2005 Hi Graham Ellis,Ok i agree with you and i shall post my query in the forum. I would like to mention that i am not going to take any user input. I already have them in my $passfile = "pswd/pass.log.pl"; This is how pass.log.pl john{tab}xyz{tab}001 username is john and password is xyz and 001 is the code which is fixed and no external input is taken. This script is working very nicely and my boss wants a upload faculty in this. Now this uploader.cgi is downloaded by me from http://www.cnctek.com/bizdb-html/uploader.html which fits best for my working. Help will be highly appreciated. Posted by admin (Graham Ellis), 21 July 2005 Anthony, I've had a look at the URL you've given ... it points to a freeware script that comprises three files that's offered from there without support. I'm sure they've tested it ... so that any problem you have will be a minor one unless you're trying to make substantive tailoring to it. But I admit to being at something of a loss as to not really following what you're asking here, so I really can't come up with any good suggestions / ideas to help you based on what I have. Are you saying "Help - how do I install this?"? If so, there are instructions / details on the page from which you did the downlaod. Are you saying "I tried the instructions but it failed at point xxx with error yyy". If that's the case, please tell us what "xxx" and "yyy" are so that we have a question to answer. Are you saying "it works fine as downloaded but I'm having trouble modifiying it". If that's the case, please post up a few lines of changes that introduced the problem (and the original alternative to those few lines) and I'll have a look and see if there's anything obvious. Posted by admin (Graham Ellis), 25 July 2005 From further email correspondence, I've learnt that the immediate question being asked here relates to the uploading of a file onto a server ... and I can can provide pointers to examples:A form from which an upload can be instigated The Perl script that receives and handles that example file However, I still think that there's much more to the question than this; I get the feeling that Anthony will need a lot more support to achieve what he wishes and I think he'll do far better getting this support in another way (e.g. from studying books, attending courses, reading articles, finding a local mentor) than by using this forum which is ideally suited for solving specific single difficult issues rather than learning / writing / debugging complete systems via talkback. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |