To check a URL:
unless ($url =~ /^http:\/\//) {
&error("Invalid URL");
}
That will just check that it starts with http:// - what did you want to check for exactly?
To stop duplicates....change:
open(FILE,">>$file") || die &error("Couldn't open file : $!");
print FILE "$username|$image";
close FILE;
to...
open(FILE,">>$file") || die &error("Couldn't open file : $!");
@data = <FILE>;
close FILE;
foreach (@data) {
chomp $_;
($user,$img) = split(/\|/, $_);
if (($username eq $user) or ($image eq $img)) {
&error("Duplicate entry.");
}
else {
open(FILE,">>$file") || die &error("Couldn't open file : $!");
print FILE "$username|$image";
close FILE;
}
}
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/
unless ($url =~ /^http:\/\//) {
&error("Invalid URL");
}
That will just check that it starts with http:// - what did you want to check for exactly?
To stop duplicates....change:
open(FILE,">>$file") || die &error("Couldn't open file : $!");
print FILE "$username|$image";
close FILE;
to...
open(FILE,">>$file") || die &error("Couldn't open file : $!");
@data = <FILE>;
close FILE;
foreach (@data) {
chomp $_;
($user,$img) = split(/\|/, $_);
if (($username eq $user) or ($image eq $img)) {
&error("Duplicate entry.");
}
else {
open(FILE,">>$file") || die &error("Couldn't open file : $!");
print FILE "$username|$image";
close FILE;
}
}
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/