Hello,
I'm dabbling with a CGI login page for the first time so I can learn a bit about CGI and I am using a simple flat file to write data to for the moment. When I open the file and try to print the users information to the flat text file it doesn't seem to print the information only the variable divider. Can someone tell me what I'm doing wrong?
Thanks
#!c:/perl/bin/Perl.exe
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use Fcntl qw(:flock :seek);
use CGI;
use CGI::Cookie;
use XML::Simple;
use strict;
my $passfile = "userfile.txt";
print header;
print start_html("New User");
my $q = CGI->new;
my $self = $q->url; # the path to this script
my $username = $q->param('username') ;
my $first = $q->param('first') || '';
my $last = $q->param('last') || '';
my $pass1 = $q->param('pass1') || '';
my $pass2 = $q->param('pass2') || '';
#new user signup page
print <<End_of_HTML;
</head><body bgcolor="#ffffff">
<form action="http://localhost/newuser.cgi?action=newuser?first?last"
+method="post">
<h2>New User Form</h2>
First name? <input type="text" name="first" value="">
<br />Last name? <input type="text" name="last" value="">
<br />Username (2-12 characters)? <input type="text" name="username"
+value="">
<br />Password <input type="password" name="pass1">
<br />Password (verify) <input type="password" name="pass2">
<input type="hidden" name="action" value="validate_newuser">
<br />
<br />
<input type="submit" value="Go!">
</form>
<br />
<br />
<i>Thank you for signing up. </i>
End_of_HTML
open(FILE, ">>$passfile") or die "can't open password file";
print FILE "$first:$last:$username";
close(FILE);
2006-05-02 Retitled by GrandFather, as per Monastery guidelines Original title: 'Wondering why this doesn't work'
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|