~;
$template = $d_template;
# END ALL THE FUN CODE
#$logintitle = "Logged In As: $fullname";
$template =~ s/xTITLEx/$album_owner/g;
$template =~ s/xBODYx/$new_body/g;
$template =~ s/xTITLE1x//g;
$template =~ s/xPAGEx/Photographer Storefront/g;
#} else {
# NOT LOGGED IN
#if ($loginstatus eq 2) {
#$logintitle = "Incorrect Username and Password combination."
#}
#if ($loginstatus eq 1) {
#$logintitle = "No such username on file.";
#}
#$template = $d_template;
#$template =~ s/xTITLEx/Error Logging Into DigiPrints!/g;
#$template =~ s/xBODYx/$logintitle/g;
#}
} else {
#invalid gallery
$new_body = qq~
Invalid Photographer ID
~;
$template = $d_template;
# END ALL THE FUN CODE
#$logintitle = "Logged In As: $fullname";
$template =~ s/xTITLEx/ Invalid Photographer ID/g;
$template =~ s/xBODYx/$new_body/g;
$template =~ s/xTITLE1x/ /g;
$template =~ s/xPAGEx/Invalid Photographer/g;
}
#######3
} else {
$d_template = &default_template($type);
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from clients where Level=2 ORDER BY `Fullname` ASC");
$tth->execute();
my $theoutput;
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{c_exp} != 1) {
if (&count_public_albums($entry->{ID}) != 0) {
$theoutput .= qq~
~;
}
}
}
#invalid gallery
$new_body = qq~
~;
$template = $d_template;
# END ALL THE FUN CODE
#$logintitle = "Logged In As: $fullname";
$template =~ s/xTITLEx//g;
$template =~ s/xBODYx/$new_body/g;
$template =~ s/xTITLE1x/ /g;
$template =~ s/xPAGEx/Photographer Storefronts/g;
}
forgetit:
if ($pecial eq 0) {
print "Content-type: text/html\n\n";
print "
This account has been disabled.";
}
print $template;
# ALL DONE #
sub is_authorized {
my $user = $_[0];
my $code = $_[1];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Username LIKE '$user'");
$ttg->execute();
my $allowed = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($entry->{Username} eq $user) {
if ($entry->{Password} eq $code) {
if ($entry->{Level} eq 0){
$allowed = 3;
# logged in as client
} else {
$allowed = 4;
# logged in as printer
}
} else {
$allowed = 2;
# bad pass
}
} else {
$allowed = 1;
# bad login
}
}
return $allowed;
}
sub is_hashed{
my $code = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Hash LIKE '$code'");
$ttg->execute();
my $allowed = 2;
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($entry->{Level} eq 0){
$allowed = 3;
# logged in as client
} else {
$allowed = 4;
# logged in as printer
}
}
return $allowed;
}
sub full_name {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Hash LIKE '$user'");
$ttg->execute();
my $newname = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
$newname = "$entry->{'Fullname'}";
# retrieved login
}
return $newname;
}
sub user_name {
my $user = $_[0];
my $mope = $_[0];
if ($mope eq "HPA") {
$mope = "_hpa";
} elsif ($mope eq "OCC") {
$mope = "";
} else {
$mope = "";
}
my $tbg = DBI->connect("dbi:mysql:digiprint$mope:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where ID=$user");
$ttg->execute();
my $newname = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
$newname = "$entry->{'Username'}";
# retrieved login
}
return $newname;
}
sub full_id {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Hash LIKE '$user'");
$ttg->execute();
my $newname = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
$newname = "$entry->{'ID'}";
# retrieved login
}
return $newname;
}
sub real_photographer {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where id=$user");
$ttg->execute();
my $newname = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($entry->{Level} eq 2) {
$newname = 1;
# retrieved login
}
}
return $newname;
}
sub photographer_name {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where id=$user");
$ttg->execute();
my $newname = '';
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($entry->{Level} eq 2) {
$newname = $entry->{Fullname};
# retrieved login
}
}
return $newname;
}
sub file_totals {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Hash LIKE '$user'");
$ttg->execute();
my $newname = 0;
my $newername = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
$newname = $entry->{'files'};
# retrieved login
}
$newername = $newname;
$newername++;
my $dbr = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $sqr = qq{ UPDATE clients SET files=$newername WHERE Hash Like '$user' };
$dbr->do($sqr);
$dbr->disconnect();
return $newername;
}
sub files_processed {
my $typez = $_[0];
my $money = $_[1];
#typez:
#
# 1 - total clients
# 2 - total days running
# 3 - total pictures processed
# 4 - total documents processed
# 5 - total blueprints processed
# 6 - total jobs
# 7 - financial total
# 8 - logins
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from stats where id=$typez");
$ttg->execute();
my $newname = 0;
my $newername = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($typez != 7) {
$newname = $entry->{'count'};
} else {
$newname = $entry->{'amount'};
}
# retrieved login
}
if ($typez != 7) {
$newername = $newname;
$newername++;
} else {
$newername = ($newname) + $money;
}
my $dbr = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $sqr;
if ($typez != 7) {
$sqr = qq{ UPDATE stats SET count=$newername WHERE id=$typez };
} else {
$sqr = qq{ UPDATE stats SET amount='$newername' WHERE id=$typez }
}
$dbr->do($sqr);
$dbr->disconnect();
return $newername;
}
sub full_hash {
my $user = $_[0];
my $code = $_[1];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from clients where Username LIKE '$user'");
$ttg->execute();
my $newname = 0;
while ( my $entry = $ttg->fetchrow_hashref ) {
if ($entry->{Username} eq $user) {
if ($entry->{Password} eq $code) {
$newname = "$entry->{'HASH'}";
# retrieved login
} else {
$newname = 0;
# bad pass
}
} else {
$newname = 0;
# bad login
}
}
return $newname;
}
sub get_print_options {
my $thefilenum = $_[0];
my $thefile = $_[1];
my $thefilesname = $_[2];
my $oldfilename = $_[3];
my $thetype = $_[4];
my $papetype = $_[5];
my $thumbn = $_[6];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from print_options where availability=$thetype and medium=$papetype");
$tth->execute();
my $print_page = '';
my $print_pages = '';
if ($thetype eq 2) { $thumbn = "digiprint/img/doc.gif"; }
while ( my $entry = $tth->fetchrow_hashref ) {
my $checkboxname = $thefilenum . "_" . $entry->{id};
my $checkytwo = $checkboxname . "_1";
my $checkythree = $checkboxname . "_x";
my $checkythumb = $checkboxname . "_t";
my $lengthwidth = "$entry->{w} in. X $entry->{l} in.";
my $the_price = "\$" . $entry->{price};
$print_page = qq~
$lengthwidth
$the_price
~;
$print_pages .= $print_page;
}
return qq~
$thefile
QTY
Size
Price
$print_pages
~;
}
sub get_jobs {
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from jobs where status=1");
$tth->execute();
my $job_page = '';
my $job_pages = '';
while ( my $entry = $tth->fetchrow_hashref ) {
$job_page = qq~
$entry->{client}
Pages
price
~;
$job_pages .= $job_page;
}
return $job_pages;
}
sub get_medium {
my $median = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from print_medium where id=$median");
$tth->execute();
my $print_opt = '';
while ( my $entry = $tth->fetchrow_hashref ) {
$print_opt = "$entry->{medium}";
}
return $print_opt;
}
sub client_template {
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from templates");
$tth->execute();
my $template_page = '';
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{template} eq "1") {
$template_page = "$entry->{text}";
}
}
return $template_page;
}
sub printer_template {
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from templates");
$tth->execute();
my $template_page = '';
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{template} eq "2") {
$template_page = "$entry->{text}";
}
}
return $template_page;
}
sub default_template {
my $mope = $_[0];
if ($mope eq "HPA") {
$mope = "_hpa";
} elsif ($mope eq "OCC") {
$mope = "";
} else {
$mope = "";
}
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from templates");
$tth->execute();
my $template_page = '';
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{template} eq "3") {
$template_page = "$entry->{text}";
}
}
return $template_page;
}
sub photostore_template {
my $mope = $_[0];
if ($mope eq "HPA") {
$mope = "_hpa";
} elsif ($mope eq "OCC") {
$mope = "";
} else {
$mope = "";
}
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from templates");
$tth->execute();
my $template_page = '';
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{template} eq "6") {
$template_page = "$entry->{text}";
}
}
return $template_page;
}
sub login_template {
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from templates");
$tth->execute();
my $template_page = '';
while ( my $entry = $tth->fetchrow_hashref ) {
if ($entry->{template} eq "4") {
$template_page = "$entry->{text}";
}
}
return $template_page;
}
sub create_hash {
#
# Blowfish Encryption
#
use Crypt::CBC;
use Crypt::Blowfish;
# The Cipher Settings
my $cipher = Crypt::CBC->new({'key'=> '0xDxIxGxIxPxRxIxNxTxSx0',
'cipher' => 'Blowfish',
'iv' => '![$`2}%q',
'regenerate_key' => 0,
'padding'=> 'space',
'prepend_iv' => 0
});
#
# End
#
my $user = $_[0];
my $code = $_[1];
my $ciphertext;
my $strsize;
my $strconvert;
my $strhex;
my $hexcode;
my $test;
my $i;
my $value;
my @test;
$ciphertext = $cipher->encrypt("$user $code");
chop($ciphertext);
$strsize = length($ciphertext);
for($i = $strsize; $i >= 0; $i--)
{
$test[$i] = substr($ciphertext, $i, 1);
}
foreach $value (@test)
{
$strconvert = ord($value);
$strhex = hex($strconvert);
$hexcode = ("$hexcode" . "\x5C\x78" . "$strhex");
}
$ciphertext = substr($hexcode, 0, length($hexcode) - 3);
$ciphertext =~ s/\\//g;
return $ciphertext;
}
sub upload_buttons {
my $code = $_[0];
my $totalbuttons = qq~
~;
return $totalbuttons;
}
sub shorter_title {
# pic_id, client_id
my $item_a = $_[0];
my $t_count = 0;
my $kar;
my $kount = 0;
my $maxkount = 110;
my $new_ttl;
my @words = split(/ /, $item_a);
my $wordcount = @words;
my $word_item = 0;
my $thingy;
my $full_new_string;
while ($word_item <= $wordcount) {
$thingy = @words[$word_item];
$t_count = 0;
$kount = 0;
$kar = '';
while ($t_count <= length($thingy)) {
$kar = substr($thingy,$t_count,1);
if ($kar eq "a") { $kount = $kount + 5; }
if ($kar eq "b") { $kount = $kount + 5; }
if ($kar eq "c") { $kount = $kount + 5; }
if ($kar eq "d") { $kount = $kount + 5; }
if ($kar eq "e") { $kount = $kount + 5; }
if ($kar eq "f") { $kount = $kount + 4; }
if ($kar eq "g") { $kount = $kount + 5; }
if ($kar eq "h") { $kount = $kount + 5; }
if ($kar eq "i") { $kount = $kount + 1; }
if ($kar eq "j") { $kount = $kount + 3; }
if ($kar eq "k") { $kount = $kount + 5; }
if ($kar eq "l") { $kount = $kount + 1; }
if ($kar eq "m") { $kount = $kount + 9; }
if ($kar eq "n") { $kount = $kount + 5; }
if ($kar eq "o") { $kount = $kount + 5; }
if ($kar eq "p") { $kount = $kount + 5; }
if ($kar eq "q") { $kount = $kount + 5; }
if ($kar eq "r") { $kount = $kount + 3; }
if ($kar eq "s") { $kount = $kount + 5; }
if ($kar eq "t") { $kount = $kount + 3; }
if ($kar eq "u") { $kount = $kount + 5; }
if ($kar eq "v") { $kount = $kount + 5; }
if ($kar eq "w") { $kount = $kount + 9; }
if ($kar eq "x") { $kount = $kount + 5; }
if ($kar eq "y") { $kount = $kount + 5; }
if ($kar eq "z") { $kount = $kount + 5; }
if ($kar eq "1") { $kount = $kount + 3; }
if ($kar eq "2") { $kount = $kount + 6; }
if ($kar eq "3") { $kount = $kount + 6; }
if ($kar eq "4") { $kount = $kount + 6; }
if ($kar eq "5") { $kount = $kount + 6; }
if ($kar eq "7") { $kount = $kount + 5; }
if ($kar eq "8") { $kount = $kount + 6; }
if ($kar eq "9") { $kount = $kount + 6; }
if ($kar eq "0") { $kount = $kount + 6; }
if ($kar eq "-") { $kount = $kount + 2; }
if ($kar eq "_") { $kount = $kount + 5; }
if ($kar eq "(") { $kount = $kount + 3; }
if ($kar eq ")") { $kount = $kount + 3; }
if ($kar eq "[") { $kount = $kount + 2; }
if ($kar eq "]") { $kount = $kount + 2; }
if ($kar eq "'") { $kount = $kount + 1; }
if ($kar eq ".") { $kount = $kount + 1; }
if ($kar eq ";") { $kount = $kount + 2; }
if ($kar eq "A") { $kount = $kount + 9; }
if ($kar eq "B") { $kount = $kount + 7; }
if ($kar eq "C") { $kount = $kount + 7; }
if ($kar eq "D") { $kount = $kount + 7; }
if ($kar eq "E") { $kount = $kount + 7; }
if ($kar eq "F") { $kount = $kount + 6; }
if ($kar eq "G") { $kount = $kount + 8; }
if ($kar eq "H") { $kount = $kount + 7; }
if ($kar eq "I") { $kount = $kount + 1; }
if ($kar eq "J") { $kount = $kount + 5; }
if ($kar eq "K") { $kount = $kount + 8; }
if ($kar eq "L") { $kount = $kount + 6; }
if ($kar eq "M") { $kount = $kount + 9; }
if ($kar eq "N") { $kount = $kount + 7; }
if ($kar eq "0") { $kount = $kount + 8; }
if ($kar eq "P") { $kount = $kount + 7; }
if ($kar eq "Q") { $kount = $kount + 8; }
if ($kar eq "R") { $kount = $kount + 7; }
if ($kar eq "S") { $kount = $kount + 7; }
if ($kar eq "T") { $kount = $kount + 7; }
if ($kar eq "U") { $kount = $kount + 7; }
if ($kar eq "V") { $kount = $kount + 9; }
if ($kar eq "W") { $kount = $kount + 13; }
if ($kar eq "X") { $kount = $kount + 7; }
if ($kar eq "Y") { $kount = $kount + 7; }
if ($kar eq "Z") { $kount = $kount + 7; }
if ($kount > $maxkount) {
$new_ttl .= $kar;
$new_ttl .= " ";
#$t_count = length($thingy);
$kount = 0;
} else {
$new_ttl .= $kar;
}
$t_count++;
}
$full_new_string .= " " . $new_ttl;
$new_ttl = '';
$word_item++;
}
return $full_new_string;
}
sub get_cart {
my $code = $_[0];
my $possible = "";
my $the_count = 0;
my $the_carts = '';
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from shopping_item_public where cart=$code");
$tth->execute();
while ( my $entry = $tth->fetchrow_hashref ) {
$the_count++;
}
# $the_carts = qq{ View ($the_count) Checkout };
if (length($the_carts) > 5) {
$possible = qq{
Shopping Cart $the_carts
};
}
return $possible;
}
sub get_new_cart {
my $code = $_[0];
my $possible = "";
my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time);
my $newyear = ($Year + 1900);
my $new_month = $Month;
my $new_day = $Day;
my $newer_month;
if ($Month eq 0) { $new_month = "00"; $newer_month = "January"; }
if ($Month eq 1) { $new_month = "01"; $newer_month = "February"; }
if ($Month eq 2) { $new_month = "02"; $newer_month = "March"; }
if ($Month eq 3) { $new_month = "03"; $newer_month = "April"; }
if ($Month eq 4) { $new_month = "04"; $newer_month = "May"; }
if ($Month eq 5) { $new_month = "05"; $newer_month = "June"; }
if ($Month eq 6) { $new_month = "06"; $newer_month = "July"; }
if ($Month eq 7) { $new_month = "07"; $newer_month = "August"; }
if ($Month eq 8) { $new_month = "08"; $newer_month = "September"; }
if ($Month eq 9) { $new_month = "09"; $newer_month = "October"; }
if ($Month eq 10) { $newer_month = "November"; }
if ($Month eq 11) { $newer_month = "December"; }
if ($Day eq 0) { $new_day = "01"; }
if ($Day eq 1) { $new_day = "01"; }
if ($Day eq 2) { $new_day = "02"; }
if ($Day eq 3) { $new_day = "03"; }
if ($Day eq 4) { $new_day = "04"; }
if ($Day eq 5) { $new_day = "05"; }
if ($Day eq 6) { $new_day = "06"; }
if ($Day eq 7) { $new_day = "07"; }
if ($Day eq 8) { $new_day = "08"; }
if ($Day eq 9) { $new_day = "09"; }
my $iDatestring = $newyear . $new_month . $new_day . $Hour . $Minute;
my $cart_id = 0; #&cart_number;
my $newer_id;
my $dbn = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $sqn = "INSERT INTO shopping_cart_public VALUES (0,'$iDatestring',$cart_id,0)";
my $stn = $dbn->prepare($sqn);
$stn->execute();
$dbn->disconnect();
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from shopping_cart_public where created like '$iDatestring' and cart=$cart_id");
$tth->execute();
while ( my $entry = $tth->fetchrow_hashref ) {
$newer_id = $entry->{'id'};
}
return $newer_id;
}
sub cart_number {
my $tbgg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttgg = $tbgg->prepare("select * from public_settings where id=1");
$ttgg->execute();
my $newname = 0;
my $newername = 0;
while ( my $entry = $ttgg->fetchrow_hashref ) {
$newname = $entry->{'count'};
# retrieved login
}
$newername = $newname;
$newername++;
my $dbr = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $sqr = qq{ UPDATE public_settings SET count=$newername WHERE id=1 };
$dbr->do($sqr);
$dbr->disconnect();
return $newername;
}
sub allow_buy {
my $code = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from albums where id=$code");
$tth->execute();
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = $entry->{'allow_buy'};
}
return $can_buy;
}
sub count_public_albums {
my $code = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from albums where client=$code and allow_view=1 and allow_front=1 ");
$tth->execute();
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy++;
}
return $can_buy;
}
sub allow_view {
my $code = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from albums where id=$code");
$tth->execute();
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = $entry->{'allow_view'};
}
return $can_buy;
}
sub in_cart {
my $file = $_[0];
my $cart = $_[1];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from shopping_item_public where file=$file and cart=$cart");
$tth->execute();
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = 1;
}
return $can_buy;
}
sub get_store {
my $file = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from clients where id=$file");
$tth->execute();
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = $entry->{c_type};
}
my $tbh2 = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth2 = $tbh2->prepare("select * from stores where id=$can_buy");
$tth2->execute();
my $can_buy2 = '';
while ( my $entry = $tth2->fetchrow_hashref ) {
$can_buy2 = $entry->{code};
}
return $can_buy2;
}
sub album_img {
my $file = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from saved_files where id=$file");
$tth->execute();
my $can_buy = '';
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = $entry->{thumb};
}
return $can_buy;
}
sub album_count2 {
my $user = $_[0];
my $tbg = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $ttg = $tbg->prepare("select * from saved_files where album=$user");
$ttg->execute();
my $newname = 0;
my $albumimage = '';
while ( my $entry = $ttg->fetchrow_hashref ) {
$newname++;
if ($newname eq 1) { $albumimage = $entry->{id}; }
# retrieved login
}
return ($newname, $albumimage);
}