« Previous page
 
If you are interested in a targeted and cost-effective way to promote your brand, product or sale on DealsforDivas.com please contact:

advertising@dealsfordivas.com



Opportunities include: 

» Newsletter
» Dedicated Emails
» Ad Banners and Buttons
#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); ########################################################## # CGInews Xtra 12/April/2004 ########################################################## my $script_name = 'http://www.dealsfordivas.com/cgi/adds.pl'; my $databasefile = "/home/content/N/i/n/NinaSutton/html/cgi/adds.txt"; my $image_dir = "/home/content/N/i/n/NinaSutton/html/templates/adds_images"; my $image_url = "http://www.dealsfordivas.com/templates/adds_images"; my $records_per_page = 500; my $html_template = "/home/content/N/i/n/NinaSutton/html/templates/adds_headline.htm"; my $record_template = "/home/content/N/i/n/NinaSutton/html/templates/adds_details.htm"; my $select_image = 0; my $add_fields = 0; my $hspace = 0; my $vspace = 0; my $Username = ''; my $Password = ''; my $not_found = ''; my $news_up = 0; ########################################################## my $ID_autoincrement_name = "ID"; # autoincrement id-key my @DateFields =('DATE', 'date'); # date fileds, describe for sort function ########################################################## # Page Selector my $textPrevious = ""; my $textNext = "Next"; my $pageSelectorRange = 10; my $records_per_page = 500; ########################################################## # Scrolling News Headlines my $Number_of_headlines_to_scroll = 5; my $speed = 4; my $bgcolor = "#eeeeee"; ########################################################## # News letter my $Number_of_news = 10; my $head_news_separator = "

"; my $news_news_separator = "

"; ########################################################## # EZscripting.co.uk © 1999 - 2004 Copyright Darren Deans # The scripts are available for private and commercial use. # You can use the scripts in any website you build. # It is prohibited to sell the scripts in any format to anybody. # The scripts may only be distributed by EZscripting.co.uk # The redistribution of modified versions of the scripts is prohibited. # EZscripting.co.uk accepts no responsibility or liability # whatsoever for any damages however caused when using our services or scripts. # By downloading and using this script you agree to the terms and conditions. ########################################################## use CGI qw/:standard/; $FORM{mode}=param('mode'); $FORM{record}=param('record'); $FORM{login}=param('login'); $FORM{password}=param('password'); $FORM{action}=param('action'); $FORM{new_field}=param('new_name'); $FORM{action}="default" if !$FORM{action}; $FORM{headlines} = param('headlines'); $FORM{order_by} = param('order_by'); $FORM{order} = param('order'); $FORM{display} = param('display'); $page=param('page')+1; $default_mode=1 if param('mode') eq 'shtml'; $default_mode=2 if param('mode') eq 'newsletter'; $default_mode=3 if param('mode') eq 'scrollingnews'; if($Username && $FORM{mode} eq 'admin'){ %COOKIES = get_cookie('Manager'); if($FORM{login}){ if($FORM{password} eq $Password && $FORM{login} eq $Username){ print "Set-Cookie: Manager=login&$FORM{login}&pass&$FORM{password}; path=/\n"; print "Location: $script_name?mode=admin\n\n"; exit; } else{print "Content-type: text/html\n\n"; error("Incorrect account!");} } elsif(!$COOKIES{login}){ promt();} elsif($COOKIES{pass} ne $Password or $COOKIES{login} ne $Username){ promt();} } if($FORM{action} eq 'logout'){ print "Set-Cookie: Manager=login&pass&; path=/\n"; print "Location: $script_name\n\n"; } print "Content-type: text/html\n\n"; create_db() unless -f $databasefile; my $txt; %SUB = ( default=> \&default, main => \&main, add => \&add, save => \&save, logout => \&logout, delete => \&delete, update => \&update, view => \&view, show => \&show, feature => \&feature, add_field => \&add_field ); $SUB{$FORM{action}}->(); html_text($txt); exit; #################################################################################################################### sub read_file{ open(F, $_[0]) || error("Can't open file $_[0]!"); my @data = ; close F; return @data; } sub read_base{ my @content; my @data = read_file("$databasefile"); for(@DateFields){$DateFields{$_}=1;} chomp $data[0]; @field_name=split('\|',$data[0]); my $p=0; $show_position = -1; $keyPosition = -1; foreach(@field_name){ $show_position=$p if $_ eq 'show'; $keyPosition = $p if $_ eq $ID_autoincrement_name; $p++; } error("Can't find key in db-file") if $keyPosition==-1; error('Bad database file') if @field_name<1; $word = param('search'); my @keys; $method = param('method'); @fields = param('field'); foreach $field (@field_name){ $position{$field}=-1; $p=0; foreach(@field_name){if($_ eq $field){$position{$field}=$p; last;}$p++;} } for(@fields){error("Can't find $field-position in db-file") if $position{$_}<0;} for (@field_name){ $searchByField{$_} = param($_) if param($_); } $exPression = param('exPression'); $value = param('value'); error("Can use exPression only with search in ONE field!") if ($exPression or $value) and @fields>1; if($word=~m/\A"(.*)"\Z/){$keys[0]=$1;} elsif(!$action and ($method eq "perfect" or $method eq "exact")){$keys[0]=$word;} else{@keys= split(" ", $word);} my $b =0; $Total =0; $Found =0; for(1..@data-1){ chomp $data[$_]; @line=split('\|',$data[$_]); my $a=0; if($_[0] == 1){ if($line[$show_position] eq 'Yes'){ if($exPression and $value){ error("Please select field") unless $fields[0]; $field=$fields[0]; if ($DateFields{$field}){ $tmpLine= modify_date($line[$position{$field}]); $values = modify_date($value); } else{$values = $value;} my $found=0; if ($exPression eq ">="){if ($tmpLine >= $values){ $found++; }} elsif ($exPression eq "<"){if ($tmpLine < $values){ $found++; }} elsif ($exPression eq ">"){if ($tmpLine > $values){ $found++; }} elsif ($exPression eq "<="){if ($tmpLine <= $values){ $found++; }} elsif ($exPression eq "=="){if ($tmpLine == $values){ $found++; }} elsif ($exPression eq "!="){if ($tmpLine != $values){ $found++; }} elsif ($exPression eq "!!"){if ($tmpLine != $values){ $found++; }} elsif ($exPression eq "ne"){if ($tmpLine ne $values){ $found++; }} else{error("Incorrect exPression - $exPression")} if($found){ $Found++; $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } } elsif(%searchByField){ my $found=0; my $length=0; for $field (keys %searchByField){ if($method eq "perfect"){if ($line[$position{$field}] eq $searchByField{$field}){ $found++; } } elsif($line[$position{$field}] =~m/$searchByField{$field}/i){$found++;} $length++; } if($found == $length){ $Found++; $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } } elsif(@keys){ if(@fields){ my $found=0; for $field (@fields){ foreach $word (@keys){ if($method eq "perfect"){if ($line[$position{$field}] eq $word){$found++; last;} } elsif($line[$position{$field}] =~m/$word/i){$found++;} } } if(($method eq "all" && $found>=@keys) or ($method ne "all" && $found)){ $Found++; $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } } else{ my $found=0; foreach $word (@keys){ foreach $value (@line){ if($method eq "perfect"){if($value eq $word){$found++; last;}} elsif($value=~m/$word/i){$found++;} } } if(($method eq "all" && $found>=@keys) or ($method ne "all" && $found)){ $Found++; $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } } } else{ $Found++; $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } $Total++; } } else{ $content->{$line[$keyPosition]}->{'record'} = $line[$keyPosition]; foreach $name (@field_name){$content->{$line[$keyPosition]}->{$name} = $line[$a++];} } } return $content; } sub get_record{ my $text = $_[0]; $text =~ s{<<(.*?)>>}{exists($INSERT{$1}) ? $INSERT{$1} : ""}gsex; return $text; } sub get_html{ my @txt = read_file($_[0]); foreach(@txt){$txt.=$_;} $txt=~/(.*)