I used the following Last-5-Records script for 2.03 , but now at 2.10 it does not longer run.
I changed the paths to the new installation, but there must be something with db-structure ?!
Maybe one expert can tell me what I need to change?
#!/usr/bin/perl
use strict;
# The full path to admin directory of linksql 2.0.3
use lib '/home/mydomain/public_html/sql/links/admin';
use Links qw/$DB $CFG/;
use CGI qw/:standard/;
&main;
sub main {
print header();
print qq~<style>
.navmain { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold;text-decoration: none; color: 006600}
.italic { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style:italic ;text-decoration: none; color: 006600}
.normal { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal ;text-decoration: none; color: 000000}
</style>
~;
my $html=&link_validated;
print $html;
# print link_validated();
}
sub link_validated {
# The full path of the image file.
my $image = "message.gif";
my @data;
my $limit = 5;
my $colortablebody = '#FFCC33';
my $odd_row_color = '#B3B36F';
my $even_row_color = '#C8C896';
my $html = qq|<table width=\"100%\" cellspacing=\"0\">|;
my ($link_catlink,$category, $sth, @data, $clean_name, $catID, $catName, $count, $url);
#handle db
$link_catlink = $DB->table ('Links','CatLinks');
$category = $DB->table ('Category');
# count records in Links table.
$count = $link_catlink->count();
#display records number.
$link_catlink->select_options("order by ID DESC limit $limit");
my $sth = $link_catlink->select ( {isValidated=>'Yes'}, ['Title','LinkOwner','URL','Links.ID']);
my $i=0;
while (@data = $sth->fetchrow_array) {
# get category ID
my $catLinks = $link_catlink->select ( {LinkID=>$data[3]}, ['CategoryID'] );
$catID = $catLinks->fetchrow;
# get category name
my $cat_name = $category->select ({ID=>$catID},['Full_Name']);
$catName = $cat_name->fetchrow;
# set url for each Category
$clean_name = $category->as_url($catName);
$url = $CFG->{build_root_url} . "/" . $clean_name . "/" . $CFG->{build_index};
#display result.
$colortablebody = ( $i++ % 2 ) ? $odd_row_color : $even_row_color;
$html .= qq|
<tr bgcolor=$colortablebody>
<td><img src="$image"> </td>
<td><A HREF="http://mydomain.com/sql/links/page.cgi?g=$clean_name/index.html&d=1" class="navmain">$data[3] $data[0]</a>
<br>
<span class=normal>($catName) </span></td>
</tr>|;
#print "$i $data[0]\n";
}
$html .= qq|</table>|;
return $html;
}
--
Michael Skaide
http://www.cycle24.de
I changed the paths to the new installation, but there must be something with db-structure ?!
Maybe one expert can tell me what I need to change?
#!/usr/bin/perl
use strict;
# The full path to admin directory of linksql 2.0.3
use lib '/home/mydomain/public_html/sql/links/admin';
use Links qw/$DB $CFG/;
use CGI qw/:standard/;
&main;
sub main {
print header();
print qq~<style>
.navmain { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold;text-decoration: none; color: 006600}
.italic { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style:italic ;text-decoration: none; color: 006600}
.normal { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal ;text-decoration: none; color: 000000}
</style>
~;
my $html=&link_validated;
print $html;
# print link_validated();
}
sub link_validated {
# The full path of the image file.
my $image = "message.gif";
my @data;
my $limit = 5;
my $colortablebody = '#FFCC33';
my $odd_row_color = '#B3B36F';
my $even_row_color = '#C8C896';
my $html = qq|<table width=\"100%\" cellspacing=\"0\">|;
my ($link_catlink,$category, $sth, @data, $clean_name, $catID, $catName, $count, $url);
#handle db
$link_catlink = $DB->table ('Links','CatLinks');
$category = $DB->table ('Category');
# count records in Links table.
$count = $link_catlink->count();
#display records number.
$link_catlink->select_options("order by ID DESC limit $limit");
my $sth = $link_catlink->select ( {isValidated=>'Yes'}, ['Title','LinkOwner','URL','Links.ID']);
my $i=0;
while (@data = $sth->fetchrow_array) {
# get category ID
my $catLinks = $link_catlink->select ( {LinkID=>$data[3]}, ['CategoryID'] );
$catID = $catLinks->fetchrow;
# get category name
my $cat_name = $category->select ({ID=>$catID},['Full_Name']);
$catName = $cat_name->fetchrow;
# set url for each Category
$clean_name = $category->as_url($catName);
$url = $CFG->{build_root_url} . "/" . $clean_name . "/" . $CFG->{build_index};
#display result.
$colortablebody = ( $i++ % 2 ) ? $odd_row_color : $even_row_color;
$html .= qq|
<tr bgcolor=$colortablebody>
<td><img src="$image"> </td>
<td><A HREF="http://mydomain.com/sql/links/page.cgi?g=$clean_name/index.html&d=1" class="navmain">$data[3] $data[0]</a>
<br>
<span class=normal>($catName) </span></td>
</tr>|;
#print "$i $data[0]\n";
}
$html .= qq|</table>|;
return $html;
}
--
Michael Skaide
http://www.cycle24.de