sub save_entry
{
my $params = shift;
my $entryID = $$params{id};
my $text= $$params{text};
#Added entry for the title here:
$movie_title = $$params{movie_title};
$img_file = $$params{img_file};
print "1073 ********************************* $img_file **************
";
my $user= $$params{user};
my ($mon, $year) = ();
$entryID ? (($mon, $year) = (localtime($entryID))[4,5])
: (($mon, $year) = (localtime(time))[4,5]);
$mon += 1;
$year += 1900;
mkdir("$user/$year", 0700);
mkdir("$user/$year/$mon", 0700);
#J:\ia\images\claims.gif
$text =~ s/\n/
/g;
$movie_title =~ s/\n/
/g;
if($img_file =~/(.*?)(\w+|\W+)(\.)(\w+)/ig){
print "
##### 1=$1 - 2=$2 - 3=$3 - 4=$4 #####
";
$img_file = "$2$3$4";
print "
&&&& $img_file &&&&";
}else{print "**** NO *****";}
print "
1096&&&&$img_location$img_file&&&&$user/$year/$mon&&&\$entryID=$entryID^^\$text=$text^^"; #exit;
if ($entryID) {
if (open(update, "+<$user/$year/$mon/update.pl")) {
local $/ = '@:';
my @entries = ;
seek(update, 0, 0);
truncate(update, 0);
foreach (@entries) {
chomp;
next unless $_;
my ($header) = split(/\n/, $_, 2);
my ($ptime) = split(/:/, $header, 2);
($ptime eq $entryID)
? print update '@:', $ptime, ':', time, ':', $$params{show} ? 1 : 0,"\n", $text, "\n", $movie_title, "\n", $img_file, "\n"
: print update '@:', $_;
}
close update;
}
else {
print_title({}, "Saving Problem");
print_note("Modifying entry: $!");
print_footer();
}
}
else {
print "
1128 &&&& $img_file &&&&$$params{show} ? 1 : 0 , \$text=$text , $movie_title, $img_file,****";
if (open(update, ">>$user/$year/$mon/update.pl")) {
# I tried here but it doesn't work, but here is where the uncessary update is, I know I just need to open the DB file that looks like the sample below, and if any part of it match don't update, but how?
#unless($text=~/$text/ig){
print update '@:', time, '::', $$params{show} ? 1 : 0, "\n", $text, "\n", $movie_title, "\n", $img_file, "\n";
#}
close update;
}
else {
print_title({}, "Saving Problem");
print_note("Writing entry: $!");
print_footer();
}
}
}
####
@:1107293018::1
Careus
Joe
careers.gif
@:1107442029::1
Title
content
arrow.gif
@:1107442514::1
My new title
the content goes here
arrow.gif
@:1107442517::1
test
more text for check
arrow.gif