#!/usr/bin/perl use lib qw( ../../lib ); use Dbdata; ################################################################# # Banner Rotator 3.0 MySQL (beta) # # This program is distributed as a beta ware. We are not # responsible for any damages that the program causes # to your system or business. You are using this software at your # own risk. Modifications are not allowed # without the premissions from SiliconSoup.com LLC. # If you find any bugs in this software, please report it to us at # cgifactory@cgi-factory.com. # However, that email address above is only for bugs reporting. # We will not respond to the messages that are sent to that # address. If you have any trouble installing this program. # Please feel free to post a message on our CGI Support Forum. # Selling this script is absolutely forbidden and illegal. ################################################################## # # COPYRIGHT NOTICE: # # Copyright 1999-2001 CGI-Factory.com TM # A subsidiary of SiliconSoup.com LLC # # # Web site: http://www.cgi-factory.com # E-Mail: cgifactory@cgi-factory.com # Released Date: August 21, 2001 # # Banner Rotator 3.0 MySQL (beta) is protected by the copyright # laws and international copyright treaties, as well as other # intellectual property laws and treaties. ################################################################### print "Content-type:text/html\n\n"; $fullpath="./"; push(@INC, $fullpath); ############################################################################# # read the html form inputs and store the inputs into the $buffer variable # ############################################################################# read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); ################################################################################## # since each input is separated by a &. We can separate all inputs into a array # ################################################################################## @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ######################################################################################### # since each input is presented as name=value. We can separate them into two variables # ######################################################################################### ($name, $value) = split(/=/, $pair); ################## # URL decoding # ################## $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $input{$name} = $value; } $software="The Kyngdoms™ Banner Ad Stats"; #encrypt the input password to match the one stored in the database if ($input{'action'} ne "show_stats") { ### #print out the login page #### print < Banner Ads Client Area




The Kyngdoms BaD Client Area

   Welcome to The Kyngdoms™ Log In area.   
Client Name:
  

Password:







Copyright © The Kyngdoms ™ 2005 All Rights Reserved.
Designated trademarks and brands are the property of their respective owne rs.
EOF exit; } else { #else print out the stats #load in the required settings my %vals = db_data; $host="$vals{host}"; $database="$vals{addb}"; $sql_user="$vals{user}"; $sql_pass="$vals{password}"; $ad_table="$vals{adtable}"; $default_banner_image="$vals{addefaultban}"; $default_banner_forward="$vals{addefurl}"; $redirect="$vals{adredirect}"; $dsn = "DBI:mysql:database=$database;host=$host;user=$sql_user;password=$sql_pass"; use DBI; $dbh=DBI->connect($dsn) or &sql_error(DBI->errstr,1); $sth = $dbh->prepare("Select * from $ad_table where user='$input{'user'}'"); $sth->execute or &sql_error(DBI->errstr,1); $at_least_one_row=0; # Retrieve each row while ((@results=$sth->fetchrow) != NULL) { $at_least_one_row=1; #check the password if ($input{'password'} ne @results[2]) { print "Wrong username or password"; exit; } #some variables need for the stats page #advertising option if (@results[11] eq "click") { $option="Click-throughs"; } else { $option="Exposures"; } #click-throughs ratio if (@results[12]==0) { $ratio="0.00"; } else { $ratio=sprintf("%.2f",(@results[13]/@results[12])*100); } #account created date ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(@results[14]))[0,1,2,3,4,5,6]; $mon+=1; $mday = sprintf("%.02d",$mday); $year += 1900; $date="$mon/$mday/$year"; &admin_header; #start to print out the stats page print qq|
|; if (@results[11] eq "exp") { print "\n"; print " \n"; print " \n" if @results[5] < 26; print " \n" if @results[5] > 25; print "\n"; } else { print qq| |; } print qq|
 @results[1] ID: @results[0]  
Display @results[4]
Forwarding URL @results[3]
   
Contact Info @results[7]
Email @results[8]
Phone Number @results[9]
   
Account @results[10]
Advertising Option $option
Exposures @results[12]
Exposures Remaining@results[5]@results[5]
Click-Throughs Remaining @results[6]
Click-Throughs @results[13]
Click-Through Ratio $ratio%
Account Created $date

|; &admin_footer; } #exit if the member is not found in the database. if ($at_least_one_row==0) { &admin_header; print "Member not found"; &admin_footer; exit; } # Close the sql connection $sth->finish; $dbh->disconnect; exit; } #admin header and footer sub admin_header { print < $software
$software
$description  

    EOF } sub admin_footer { print <
Questions or problems? Contact Banner Admin and include your account details and query.
$software © Copyright 2005 All Rights Reserved.
EOF $description=""; } #sql query error handling sub sql_error ($errorMessage,$errorType) { #disconnect from the database my ($errorMessage,$errorType) = @_; #QUERY error if ($errorType==2) { $sth->finish; $dbh->disconnect; } print qq|
An error has occured


    SQL Error message:
    $errorMessage

    \n Reason/Debugging message:
    $!

    \n Additional Info:
    Please contact the webmaster or the server admin if you keep getting this message.
    \n If you are the webmaster, there is no need to panic. The scripts are already functioning and that is why you can see this message. The cause of this error is likely to be something minor. For example, incorrect system path or incorrect file permissions.
    \n

    If you need any asistance, please visit us at cgi-factory.com, a subsidiary of SiliconSoup.com (Slicon Soup) LLC.
|; exit; } exit;