~;
}
sub get_print_options_x {
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 = '';
while ( my $entry = $tth->fetchrow_hashref ) {
my $checkboxname = $thefilenum . "_" . $entry->{id};
my $checkytwo = $checkboxname . "_1";
my $checkythumb = $checkboxname . "_t";
$print_page .= qq~
~;
}
return $print_page;
}
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 get_thumb {
my $median = $_[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=$median");
$tth->execute();
my $print_opt = '';
while ( my $entry = $tth->fetchrow_hashref ) {
$print_opt = "$entry->{thumb}";
}
return $print_opt;
}
sub get_album {
my $median = $_[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=$median");
$tth->execute();
my $print_opt = '';
while ( my $entry = $tth->fetchrow_hashref ) {
$print_opt = "$entry->{album}";
}
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 $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 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 get_cart {
my $code = $_[0];
my $ash = $_[1];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from shopping_cart where client=$code");
$tth->execute();
my $the_date = '';
my $the_id = '';
my $the_count = 0;
my $the_carts = '';
my $max = 5;
my $cur = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
if ($max > $cur) {
$the_id = "$entry->{id}";
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from shopping_item where cart=$the_id");
$tth->execute();
while ( my $entry = $tth->fetchrow_hashref ) {
$the_count++;
}
$the_carts .= qq{ View ($the_count) Checkout };
$the_cart = $the_id;
}
$cur++;
}
my $possible = "";
if (length($the_carts) > 5) {
$possible = qq{
Shopping Cart $the_carts
};
}
return $possible;
}
sub get_sizes {
my $papetype = $_[0];
my $thetype = $_[1];
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 = '';
my $print_num = 0;
$script_needs = '';
#if ($thetype eq 2) { $thumbn = "digiprint/img/doc.gif"; }
while ( my $entry = $tth->fetchrow_hashref ) {
my $lengthwidth = "$entry->{w} in. X $entry->{l} in.";
$print_num++;
$script_needs .= qq~
var o$print_num;
o$print_num = document.createElement("option");
o$print_num.setAttribute("value","$entry->{id}");
o$print_num.appendChild(document.createTextNode("$lengthwidth"));
c_sizea.appendChild(o$print_num);
~;
$print_pages .= qq{ };
}
return $print_pages;
}
sub user_name {
my $user = $_[0];
my $mope = $_[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 ) {
$newname = "$entry->{'Username'}";
# retrieved login
}
return $newname;
}
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();
#print "select * from shopping_item_public where file=$file and cart=$cart
";
my $can_buy = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$can_buy = 1;
}
return $can_buy;
}
sub photostore_template {
my $mope = $_[0];
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 template_exists {
my $a_template = $_[0];
my $tbh = DBI->connect("dbi:mysql:$config_dbname:localhost:3306", $config_dbusername, $config_dbpassword);
my $tth = $tbh->prepare("select * from price_templates where id=$a_template");
$tth->execute();
my $exists = 0;
while ( my $entry = $tth->fetchrow_hashref ) {
$exists = 1;
}
return $exists;
}