#!/usr/local/bin/perl # # Program: bpmember.cgi # Author: Drummond Miles # Email: info@gadnet.com # # Created: 29/12/98 # Last Modified: 12/09/99 - removed references to $cgipath for ease of cross-platform installation # Copyright G.A.D.Miles 1998. All Rights Reserved # # Download script from http://www.gadnet.com/bplus # # This program is being distibuted as freeware. It can be freely downloaded and used. # It may be modified as long as the copyright information remains intact. # # Any use of this program is entirely at the risk of the user. No liability will be # accepted by the author. # # This code must not be sold, even in modified form, without the written permission # of the author. This code must also not be distributed without the permission of the # author. require "bpvars.txt"; require "bpsubs.cgi"; print "Content-type: text/html\n\n"; read(STDIN,$indata,$ENV{'CONTENT_LENGTH'}); @indata = split(/&/,$indata); foreach $i (0..$#indata) { $indata[$i] =~ s/\+/ /g; ($key,$val) = split(/=/,$indata[$i],2); $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; $indata{$key} .= "\0" if (defined($indata{$key})); $indata{$key} .= $val; } if ($indata{'showuser'}) { &showuser; } elsif ($indata{'updateuser'}) { &updateuser; } else { &getid; } sub getid { &header('Enter ID / กรอกระหัสผ่าน'); print("
\n"); print("\n"); print("
\n"); print("\n"); print("
User Information:
\n"); print("\n"); print("\n"); print("\n"); print("
User ID:
Password:
\n"); print("

\n"); print("
\n"); &footer; } sub showuser { &header('Members Only'); $error = 0; if (!$indata{'userid'}) { $error = 1; print("

Error

\n"); print("You must enter a User ID
\n"); } if (!$indata{'userpass1'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter a Password
\n"); } if (!(-e "$bpdata/$indata{'userid'}.txt") && ($indata{'userid'})) { if (!$error) { print("

Error

\n"); $error = 1; } print("Invalid User ID
\n"); print("(Note that User ID is case sensitive)
\n"); } if ($error) { print ("

Use the \'Back\' button on your browser to correct your data
\n"); return; } open (OLDUSER, "+<$bpdata/$indata{'userid'}.txt"); $lockfail = &lock("OLDUSER"); if ($lockfail) { &lockerror("$indata{'userid'}.txt"); } @olduserlines = ; close (OLDUSER); foreach $olduserlines (@olduserlines) { chop $olduserlines if ($olduserlines =~ /\n$/); } if (@olduserlines[8] ne $indata{'userpass1'}) { print ("

Error

\n"); print ("Invalid Password
\n"); print ("(Note that Password is case sensitive)
\n"); print ("

Use the \'Back\' button on your browser to correct your data
\n"); return; } $userid = $indata{'userid'}; print "
User $indata{'userid'}
\n"; $earned = 0; if (@olduserlines[5] > 0) { $earned = int(@olduserlines[4] / @olduserlines[5]); } $pc = "N/A"; if (@olduserlines[6] > 0) { $pc = (@olduserlines[7] * 100) / @olduserlines[6]; } unless ($pc eq "N/A") { $pc =~ s/(.\d\d\d)\d*/$1/; $pc = $pc . "%"; } print("
\n"); print("\n"); print("
User Statistics / สถิติ:
\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
Banners Displayed on this Site / จำนวนครั้งที่แสดงป้าย: @olduserlines[4]
Credits Earned / เครดิตสะสม: $earned
Credits Used / เครติตที่ใช้: @olduserlines[6]
Click Thrus to your Site / จำนวนคลิกผ่านไซต์ของคุณ : @olduserlines[7]
Click Thru Percentage / จำนวนคลิกเป็นเปอร์เซ็น: $pc
\n"); print("
\n"); print("\n"); print("\n"); print("
\n"); print("\n"); print("
User Information / ข้อมูล: (แก้ไขได้ เสร็จแล้วกดปุ่ม updat)
\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
Name:
Email:
Site URL:
Site Title:
Banner URL:
\n"); print("
\n"); print("

\n"); print("
\n"); } sub updateuser { &header('Update User'); $error = 0; if (!$indata{'username'}) { $error = 1; print("

Error

\n"); print("You must enter your Name
\n"); } if (!$indata{'email'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter your Email Address
\n"); } if (!$indata{'siteurl'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter the URL of your site
\n"); } if (!$indata{'sitetitle'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter the title of your site
\n"); } if ($error) { print ("

Use the \'Back\' button on your browser to correct your data
\n"); return; } open (OLDUSER, "+<$bpdata/$indata{'userid'}.txt"); $lockfail = &lock("OLDUSER"); if ($lockfail) { &lockerror("$indata{'userid'}.txt"); } @olduserlines = ; $olduserlines[0] = "$indata{'username'}\n"; $olduserlines[1] = "$indata{'email'}\n"; $olduserlines[2] = "$indata{'siteurl'}\n"; $olduserlines[9] = "$indata{'sitetitle'}\n"; $olduserlines[3] = "$indata{'urlbanner'}\n"; $olduserlines[13] = "0\n"; seek (OLDUSER,0,0); truncate (OLDUSER,0); foreach $olduserlines (@olduserlines) { chop $olduserlines if ($olduserlines =~ /\n$/); print OLDUSER "$olduserlines\n"; } close (OLDUSER); $update = 1; print "

User $indata{'userid'} modified successfully / แก้ไขเรียบร้อย
\n"; print "

Please ensure that the following code is displayed on your page(s) / โปรดแน่ใจว่าได้ก๊อบปี๊และ past โค้ตที่ถูกต้อง เหมือนด้านล่างลงบนเพจของคุณ:
\n"; &htmlcode($indata{'userid'}); print "

คุณต้องแทนที่เครื่องหมายสีแดง XX ทั้งสองแห่ง ด้วยจำนวนเลขระหว่าง 01 ถึง 99.
\n"; print "จำเป็นต้องแทนที่เครื่องหมาย XXด้วยดัวเลขที่เหมือนกันทั้งสองแห่ง.
\n"; print "ถ้าคุณใส่ โค๊ตลงบน หลายๆ หน้า, จำนวนเลขที่จะแทนค่าเครื่องหมาย XX จะต้องแตกต่างกันในทุกหน้า. \n"; print "ตัวอย่างเช่น, ถ้าคุณต้องากรใส่โค๊ตลงบน เพจ 2 เพจ, จำนวนเลขที่กำหนดแทนค่า XX ในแต่ละหน้าควรจะเป็น 01 บนเพจแรก และ 02 บนเพจที่สอง.\n"; print "

You must replace BOTH occurences of XX with a number between 01 and 99.
\n"; print "You must change both occurences of XX with the SAME number.
\n"; print "If you past this code onto more than one page, then each occurence of the code should have a DIFFERENT value for XX. \n"; print "In other words, if you place the code on two pages, BOTH occurences of XX could be 01 on the first page and 02 on the second page.\n"; }