User Control Panel
Advertisements

HELP US, HELP YOU!

text box and button, for web site

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Thu Mar 24, 2005 12:03 am    Post subject: Reply with quote

Hey, i havent done much programming of perl in a website but i need to do this...

Basically its to check if a user has got any of the mirrors added...
I've already done the bit where i write the users to a database (txt files Razz ) but not i need to check against it....

i've come up with this script:
Code:
my $email = shift;<br /><br />my $added;<br />my @handles = <./lists/*.txt>;<br />foreach my $handle (@handles){<br />   open(TXT, $handle);<br />   @users = <TXT>;<br />   close TXT;<br /><br />   foreach my $user (@users){<br />  if($user eq $email){<br />     $added = $handle;<br />  }<br />   }<br />   last if defined $added;<br />}<br />if(!defined $added){<br />   $added = "You have not got a mirror added! Add one....";<br />}<br /><br />return $added;<br />


Is that ok?

anyway, now i need to access this and i want a text box and a submit button that calls that script with $email as the data that was in the txt box....

I then need to somehow display the return, Sombody good with working with perl and web help?
Back to top
Mojave
Almost An Agent
Almost An Agent


Joined: 01 Nov 2003
Posts: 1434

Reputation: 66.4

PostPosted: Thu Mar 24, 2005 12:11 am    Post subject: Reply with quote

Well, you need to know how to make HTML forms, I would Google for that or just copy a form from some web site and then modify it to suit you.

Then you need to process the form, probably best to use CGI.pm.
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Thu Mar 24, 2005 12:12 am    Post subject: Reply with quote

Code:
<br />use CGI qw(param);<br />my $email = param('email');<br /><br />if($email){<br />    my $added;<br />    my @handles = <./lists/*.txt>;<br />    foreach my $handle (@handles){<br />    open(TXT, $handle);<br />    @users = <TXT>;<br />    close TXT;<br /><br />    foreach my $user (@users){<br />     if($user eq $email){<br />      $added = $handle;<br />     }<br />    }<br />    last if defined $added;<br />    }<br />    if(!defined $added){<br />    $added = "You have not got a mirror added! Add one....";<br />    }<br />}<br /><br />print qq~<br /><html><br /><form method="POST"><br />email: <INPUT TYPE="text" NAME="email"><br /><INPUT TYPE="submit" value="check"><br><br />$added<br /></form><br /></html><br />~;<br />

_________________
[ matt ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group