#!/usr/local/bin/perl # # Program: bpjoin.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/bpplus # # 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 ($ENV{'QUERY_STRING'} =~ /new/) { &newuser; } elsif ($indata{'adduser'}) { &adduser; } sub newuser { if ($autoname eq "Y") { open (DEFAULT, "+; chop $defaults[2] if ($defaults[2] =~ /\n$/); $defaults[2]++; seek (DEFAULT,0,0); foreach $defaults (@defaults) { chop $defaults if ($defaults =~ /\n$/); print DEFAULT "$defaults\n"; } close (DEFAULT); $id = "bp" . $defaults[2]; } &header('New Member / สมัครสมาชิกใหม่'); print("
\n"); print("\n"); if ($autoname eq "Y") { print("\n"); } print("\n"); print("
\n"); print("\n"); print("
User Information:
\n"); if ($autoname eq "Y") { print("\n"); } else { print("\n"); } print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
User ID:$id
Password:
Re-Enter Password:
Name:
Email:
\n"); print("
"); print("\n"); print("
Site Information:
\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
Site URL:
Site Title:
Banner URL:
\n"); print("
\n"); print("
\n"); print("
\n"); &footer; } sub adduser { &header('New Member'); $error = 0; if ($indata{'userid'}) { if (-e "$bpdata/$indata{'userid'}.txt") { $error = 1; print("

Error

\n"); print("This User ID is already being used\n"); } } if (!$indata{'userid'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter a User ID
\n"); } if ($indata{'userid'} =~ / /) { if (!$error) { print("

Error

\n"); $error = 1; } print("The User ID cannot contain spaces
\n"); } if (!$indata{'userpass1'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("You must enter a Password
\n"); } if ($indata{'userpass1'} ne $indata{'userpass2'}) { if (!$error) { print("

Error

\n"); $error = 1; } print("The two passwords you have entered are not equal
\n"); } if (!$indata{'username'}) { if (!$error) { print("

Error

\n"); $error = 1; } 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 (DEFAULT, "+; close (DEFAULT); open (NEWUSER, ">$bpdata/$indata{'userid'}.txt"); $lockfail = &lock("NEWUSER"); if ($lockfail) { &lockerror("$indata{'userid'}.txt"); } print NEWUSER "$indata{'username'}\n"; print NEWUSER "$indata{'email'}\n"; print NEWUSER "$indata{'siteurl'}\n"; print NEWUSER "$indata{'urlbanner'}\n"; print NEWUSER "0\n"; print NEWUSER "$defaults[0]"; print NEWUSER "0\n"; print NEWUSER "0\n"; print NEWUSER "$indata{'userpass1'}\n"; print NEWUSER "$indata{'sitetitle'}\n"; $year = (localtime)[5] + 1900; $month = (localtime)[4] + 1; if ($month < 10) { $month = "0".$month; } $day = (localtime)[3]; if ($day < 10) { $day = "0".$day; } $date = $year.$month.$day; print NEWUSER "$date\n"; print NEWUSER "$date\n"; print NEWUSER "\n"; print NEWUSER "0\n"; print NEWUSER "$defaults[1]"; close (NEWUSER); open (UNVERIFIED, ">>$bpdata/members.txt"); $lockfail = &lock("UNVERIFIED"); if ($lockfail) { &lockerror("members.txt"); } seek (UNVERIFIED,0,2); print UNVERIFIED "$indata{'userid'}\n"; close (UNVERIFIED); print "

User $indata{'userid'} created successfully\n"; print "

ตอนนี้คุณสามารถเริ่ม สะสมเครดิตได้ทันที แล้วครับ โดย cut \& paste โค๊ตด้านล่างลงบนเพจ ของคุณ(s):
\n"; print "
You can start earning credits as soon as you cut \& paste the following code into your web page(s):
\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"; }