#!/usr/local/bin/perl require "protected/adminpl.cgi"; $| = 1; $form_action = "yoyootopsites.cgi"; ################################################################ # yoyootopsites.cgi # ################################################################ sub tz {if ($ENV{'SCRIPT_NAME'} !~ /yoyootopsites.cgi/) {die;}} ################################################################ # YOYOO.COM # # Version 2.1 # # Copyright ฉ 1999 # # by Gilbert Murgallis # # For latest version and support forum please visit # # http://www.listsitepro.com # ################################################################ ################################################################ # WARNING! Nothing Needs To Be Edited Below This Line WARNING!# ################################################################ &init_cgi; if ($in{'click'} ne "") { &log_in_hit; &time_check; print "Location: $lspro_base_url/$lspro_file_name\n\n"; exit; } elsif ($in{'hit_out'} ne "") { &log_out_hit; &time_check; print "Location: $outurl\n\n"; exit; } elsif ($in{'request'} eq "new") { &sign_up; exit; } elsif ($in{'request'} eq "login_manager") { &login_manager; exit; } elsif ($in{'new_final'}) { &new_final; exit; } elsif ($in{'login'}) { &account_manager; exit; } else { print "Location: $lspro_base_url/$lspro_file_name\n\n"; exit; } sub create_html_file { if ($set_update > 1) { $update_minutes = "s"; } if ($set_reset > 1) { $reset_days = "s"; } open (DATA,"protected/data.file"); flock (DATA,2); @data_array = ; flock (DATA,8); close(DATA); @data_array = sort {$b <=> $a} @data_array; $found=0; $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); if (($new_array[0] >= $min_record_to_list) && ($found < $max_record)) { push(@sorted_array, join("\|", @new_array)); $found++; } $a++; } @data_array = @sorted_array; $ranking = "$lspro_site_name - powered by YOYOO.COM"; $ranking .= ""; $html_file = "html/lspro_list_header.txt"; &tx; &insert_html; if ($display_site_name =~ /^y/i) { $ranking .= "

$lspro_site_name

"; } $ranking .= "

$lspro_site_name updates every $set_update minute$update_minutes and resets every $set_reset day$reset_days.

"; $ranking .= "
WEBMASTERS: "; $ranking .= ""; $ranking .= "Add your link"; $ranking .= " "; $ranking .= "Edit your account
"; $ranking .= "
"; $ranking .= "
"; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $a=0; $b=1; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; $ranking .= ""; if ($b == 10) { $ranking .= "
"; $ranking .= "

TOP SITES

"; $ranking .= "
"; $ranking .= "RANK"; $ranking .= ""; $ranking .= "

SITE DESCRIPTION

"; $ranking .= "
"; $ranking .= " IN "; $ranking .= ""; $ranking .= " OUT "; $ranking .= "
"; $ranking .= "
$b
"; $ranking .= "
"; if (($a < $max_banner) && ($new_array[9] ne "")) { $ranking .= "
"; $ranking .= ""; $ranking .= "
"; } $ranking .= ""; $ranking .= "$new_array[6]"; $ranking .= " $new_array[7]"; &tz; $ranking .= "
"; $ranking .= "
$new_array[0]
"; $ranking .= "
"; $ranking .= "
$new_array[1]
"; $ranking .= "
"; $html_file = "html/lspro_break_10.txt"; &insert_html; $ranking .= "
"; } if (($b == 10) && ($found > 10)) { $ranking .= ""; $ranking .= ""; $ranking .= ""; } if ($b == 25) { $ranking .= "
"; $ranking .= "

TOP 11 - 25 SITES

"; $ranking .= "
"; $html_file = "html/lspro_break_25.txt"; &insert_html; $ranking .= "
"; } if (($b == 25) && ($found > 25)) { $ranking .= ""; $ranking .= ""; $ranking .= ""; } if ($b == 50) { $ranking .= "
"; $ranking .= "

TOP 26 - 50 SITES

"; $ranking .= "
"; $html_file = "html/lspro_break_50.txt"; &insert_html; $ranking .= "
"; } if (($b == 50) && ($found > 50)) { $ranking .= ""; $ranking .= ""; $ranking .= ""; } if ($b == 75) { $ranking .= "
"; $ranking .= "

TOP 51 - 75 SITES

"; $ranking .= "
"; $html_file = "html/lspro_break_75.txt"; &insert_html; $ranking .= "
"; } if (($b == 75) && ($found > 75)) { $ranking .= ""; $ranking .= ""; $ranking .= ""; } $b++; $a++; } $ranking .= "
"; $ranking .= "

THE REST

"; $ranking .= "
"; $ranking .= "
WEBMASTERS: "; $ranking .= ""; $ranking .= "Add your link"; $ranking .= " "; $ranking .= "Edit your account
"; $ranking .= "

Contact: "; $ranking .= ""; $ranking .= "Webmaster

"; $html_file = "html/lspro_list_footer.txt"; &insert_html; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. $ranking .= "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; $ranking .= ""; open (RANKING,">$lspro_root_path/$lspro_file_name"); flock (RANKING,2); print RANKING $ranking; flock (RANKING,8); close (RANKING); } sub init_cgi { my $length = $ENV{CONTENT_LENGTH}; my $query = $ENV{QUERY_STRING}; my (@assign); if ($query){ @assign = split(/&/,$query); $formlength = @assign; } elsif ($length) { read(STDIN, $_, $length); chomp; @assign = split('&'); $formlength = @assign; } else { $formlength = 0; } for (my $i=0; $i<$formlength; $i++) { my ($name,$value) = split('=',$assign[$i]); $value =~ tr/+/ /; $value =~ s/%([a-fFA-F0-9][a-fFA-F0-9])/pack("C", hex($1))/eg; $value =~ s/~!/ ~!/g; if (defined($in{$name})) { $in{$name} .= ",$value"; } else { $in{$name} = $value; } } } sub insert_html { open (html_insert,"$html_file"); @html_insert = ; close (html_insert); foreach $line (@html_insert) { $ranking .= $line; } } sub insert_html2 { open (html_insert,"$html_file"); @html_insert = ; close (html_insert); foreach $line (@html_insert) { print $line; } } sub log_in_hit { open (DATA,"+; $account = $in{'click'}; $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); if ($new_array[12] == $account) { @new_array[2]++; $data_array[$a] = join("\|",@new_array); } $a++; } seek (DATA, 0, 0); print DATA @data_array; flock (DATA,8); close (DATA); } sub log_out_hit { open (DATA,"+; $account = $in{'hit_out'}; $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); if ($new_array[12] == $account) { @new_array[3]++; $outurl = $new_array[8]; $data_array[$a] = join("\|",@new_array); } $a++; } seek (DATA, 0, 0); print DATA @data_array; flock (DATA,8); close (DATA); } sub time_check { $current_time = time(); open (RESET_TIME,"; flock (RESET_TIME,8); close (RESET_TIME); open (UPDATE_TIME,"; flock (UPDATE_TIME,8); close (UPDATE_TIME); if ($current_time > $reset_time+($set_reset*86400)) { open (RESET_TIME,">protected/reset_time.txt"); flock (RESET_TIME,2); print RESET_TIME "$current_time"; flock (RESET_TIME,8); close (RESET_TIME); &reset; } elsif ($current_time > $update_time+($set_update*60)) { open (UPDATE_TIME,">protected/update_time.txt"); flock (UPDATE_TIME,2); print UPDATE_TIME "$current_time"; flock (UPDATE_TIME,8); close (UPDATE_TIME); &update; } } sub update { open (DATA,"; flock (DATA,8); close (DATA); $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); $new_array[0] = $new_array[0] + $new_array[2]; $new_array[1] = $new_array[1] + $new_array[3]; $new_array[2] = 0; $new_array[3] = 0; $data_array[$a] = join("\|",@new_array); $a++; } open (DATA,">protected/data.file"); flock (DATA,2); print DATA @data_array; flock (DATA,8); close (DATA); &create_html_file; } sub reset { open (DATA,"; flock (DATA,8); close (DATA); $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); $new_array[0] = 0; $new_array[1] = 0; $data_array[$a] = join("\|",@new_array); $a++; } open (DATA,">protected/data.file"); flock (DATA,2); print DATA @data_array; flock (DATA,8); close (DATA); &create_html_file; } sub header { print "Content-type: text/html\n\n"; $header = "$html_page_title"; $header .= ""; print $header; } sub footer { $footer = ""; print $footer; } sub sign_up { $html_page_title = "$lspro_site_name - powered by YOYOO.COM"; &header; $html_file = "html/lspro_std_header.txt"; &insert_html2; $html_file = "html/lspro_rules.txt"; &insert_html2; print <$lspro_site_name

New Member Sign Up

User Name

Email Address

Site Name

Site Description

Site URL

Banner URL

Banner Width
(max $max_banner_width)

Banner Height
(max $max_banner_height)

Password

Return to $lspro_site_name

EOF $html_file = "html/lspro_std_footer.txt"; &insert_html2; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. print "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; &footer; } sub new_final { &validate_data; $member_id = time(); $line = join ("\|",0,0,0,0,$in{'name'},$in{'email'},$in{'site_name'},$in{'site_description'},$in{'site_url'},$in{'banner_url'},$in{'preview_url'},$in{'password'},$member_id,$in{'banner_height'},$in{'banner_width'},0,0,0,0); $line .= "\n"; open(DATA, ">>protected/data.file"); flock (DATA,2); print DATA $line; flock (DATA,8); close (DATA); $html_page_title = "$lspro_title"; &header; $html_file = "html/lspro_std_header.txt"; &insert_html2; print "

$lspro_site_name

"; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "
Thank you $in{'name'}!
"; print "
"; print "Email Address "; print ""; print "$in{'email'}"; print "
"; print "Site Name "; print ""; print "$in{'site_name'}"; print "
"; print "Site Description "; print ""; print "$in{'site_description'}"; print "
"; print "Site URL "; print ""; print "$in{'site_url'}"; print "
"; print "Banner URL "; print ""; print "$in{'banner_url'}"; print "
"; print "Banner Height "; print ""; print "$in{'banner_height'}"; print "
"; print "Banner Width "; print ""; print "$in{'banner_width'}"; print "
"; print "Account Number "; print ""; print "$member_id"; print "
"; print "Password "; print ""; print "$in{'password'}"; print "
"; print "
"; print "Click Here to Edit Account
"; print "
"; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print "
Linking Instructions
"; print "
"; &get_link_footer; print "
"; print "
"; print "Return to $lspro_site_name
"; $html_file = "html/lspro_std_footer.txt"; &insert_html2; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. print "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; &footer; &email_member; &email_webmaster; exit; } sub get_link_footer { print <TO PLACE A GRAPHIC LINK (การใส่กราฟฟิกลิ้ง):

<A HREF="$lspro_cgi_url/yoyootopsites.cgi?click=$member_id">
<IMG SRC=http://www.yoyoo.com/topsitesth/images/image.gif WIDTH="$image_width" BORDER="0"></A>

ก๊อบปี้โค๊ตนี้แล้วนำไป ใส่ลงบนเพจของคุณ. ทำการโหลดเพจ
คลิกผ่านป้ายหรือลิ้งเข้าไป หนี่งครั้ง เพื่อเป็นการ activate เริ่มต้นใช้งาน account ของคุณ.

Note: คุณควรก๊อบปี่ โค๊ตแล้ว past ลงบน text ไฟล์, แล้วก๊อบปี้จาก text ไฟล์ไป past ลงบน web editor ที่คุณใช้อีกทีหนึ่ง.

หรือก๊อบปี้ กราฟฟิก banner ด้านล้าง ลงบน hard drive ของคุณ, upload ไปยังเว็บไซต์ของคุณ. แล้วจึงแก้ไข url ของรูปกราฟฟิกให้ point ไปยัง directory ที่คุณเก็บภาพไว้.

 

TO PLACE A TEXT LINK (การใส่ลิ้งขอความ)

<A HREF="$lspro_cgi_url/yoyootopsites.cgi?click=$member_id">$image_text</A>

EOF } sub email_member { open(MAIL,"|$mailprog -t"); print MAIL "To: $in{'email'}\n"; print MAIL "From: $lspro_email_address\n"; print MAIL "Subject: Confirmation for Member Account $member_id\n\n"; print MAIL "Thank you $in{'name'} for joining $lspro_site_name.\n\n"; print MAIL "You have submitted the following information:\n\n"; print MAIL "Email Address: $in{'email'}\n\n"; print MAIL "Site Name: $in{'site_name'}\n\n"; print MAIL "Site Description: $in{'site_description'}\n\n"; print MAIL "Site URL: $in{'site_url'}\n\n"; print MAIL "Banner URL: $in{'banner_url'}\n\n"; print MAIL "Banner Height: $in{'banner_height'}\n\n"; print MAIL "Banner Width: $in{'banner_width'}\n\n"; print MAIL "Account Number: $member_id\n\n"; print MAIL "Password: $in{'password'}\n\n"; print MAIL "ถ้าข้อมูลของคุณผิดพลาด สามารถคลิกเข้าไปแก้ไขได้ที่นี้ครับ $lspro_cgi_url/yoyootopsites.cgi?request=login_manager.\n\n"; print MAIL "\n\n"; print MAIL "TO PLACE A GRAPHIC LINK (การใส่กราฟฟิกลิ้ง):\n\n"; print MAIL "\n"; print MAIL "
$image_text
\n\n"; print MAIL "To get the graphic banner go to $image_filename and copy it to your hard drive, then upload it to your web site.\n\n"; print MAIL "TO PLACE A TEXT LINK (การใส่อักษรลิ้ง) :\n\n"; print MAIL "$image_text\n\n"; print MAIL "\n\n"; close (MAIL); } sub email_webmaster { open(MAIL,"|$mailprog -t"); print MAIL "To: $lspro_email_address\n"; print MAIL "From: $lspro_email_address\n"; print MAIL "Subject: A New Member Has Joined $lspro_site_name!\n\n"; print MAIL "The following is your new members information:\n\n"; print MAIL "Email Address: $in{'email'}\n\n"; print MAIL "Site Name: $in{'site_name'}\n\n"; print MAIL "Site Description: $in{'site_description'}\n\n"; print MAIL "Site URL: $in{'site_url'}\n\n"; print MAIL "Banner URL: $in{'banner_url'}\n\n"; print MAIL "Banner Height: $in{'banner_height'}\n\n"; print MAIL "Banner Width: $in{'banner_width'}\n\n"; print MAIL "Account Number: $member_id\n\n"; print MAIL "Password: $in{'password'}\n\n"; print MAIL "อีเมล์นี้เป็น automated message. กรุณาอย่า reply กลับมาครับ.\n\n"; print MAIL "\n\n"; close (MAIL); } sub validate_data { unless ($in{'email'} =~ /^[\w-.]+\@[\w-.]+$/) { $error_text .= "Not a valid e-mail address / ที่อยู่อีเมล์ ไม่ถูกต้อง.
"; $error = 1; } if ($in{'name'} eq "") { $error_text .= "You must type in your Name / คุณต้องกรอกชื่อคุณ.
"; $error = 1; } if ($in{'site_name'} eq "") { $error_text .= "You must type in your Site Name / คุณต้องกรอกชื่อเว็บไซต์.
"; $error = 1; } unless ($in{'site_url'} =~ /\http:/) { $error_text .= "Not a valid URL / เป็น URL ที่ไม่อนุณาติ.
"; $error = 1; } if ($in{'banner_url'} ne ""){ unless ($in{'banner_url'} =~ /\http:/) { $error_text .= "Your banner URL does not contain a valid URL / ป้ายของคุณกำหนด URL ไม่ถูกต้อง.
"; $error = 1; } } if (($in{'banner_url'} ne "") && ($in{'banner_width'} > $max_banner_width)) { $error_text .= "You banner must be smaller than / ขนาดป้ายของคุณกว้างน้อกกว่า $max_banner_width pixels in width.
"; $error = 1; } if (($in{'banner_url'} ne "") && ($in{'banner_height'} > $max_banner_height)) { $error_text .= "You banner must be smaller than / ขนาดป้ายของคุณต้องสูงน้อยกว่า $max_banner_height pixels in height.
"; $error = 1; } if (($in{'banner_url'} ne "") && ($in{'banner_height'} eq "")) { $error_text .= "You must enter your banner's height in pixels / คุณต้องกำหนดความสูงของป้ายเป็น pixels.
"; $error = 1;} if (($in{'banner_url'} ne "") && ($in{'banner_width'} eq "")) { $error_text .= "You must enter your banner's width in pixels / คุณต้องกำหนดความกว้างของป้ายเป็น pixels.
"; $error = 1;} if ($in{'password'} eq "") { $error_text .= "You must enter your password / คุณต้องกรอก password.
"; $error = 1; } if ($error == 1) { &error; } } sub error { $html_page_title = "Error!"; &header; $html_file = "html/lspro_std_header.txt"; &insert_html2; print "

You have the following errors / ข้อมูลที่กรอกของคุณผิดพลาดดังนี้:

"; print $error_text; print "
Please use your browsers back button to correct them / กรุณาคลิก browsers กลับไปแก้ไขด้วยครับ.


"; $html_file = "html/lspro_std_footer.txt"; &insert_html2; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. print "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; &footer; exit; } sub update_account { open (DATA,"; flock (DATA,8); close (DATA); $account = $in{'account'}; $a=0; foreach (@data_array) { @new_array = split(/\|/,$data_array[$a]); if ($new_array[12] == $account) { $new_array[4]=$in{'name'}; $new_array[5]=$in{'email'}; $new_array[6]=$in{'site_name'}; $new_array[7]=$in{'site_description'}; $new_array[8]=$in{'site_url'}; $new_array[9]=$in{'banner_url'}; $new_array[11]=$in{'new_password'}; $new_array[13]=$in{'banner_height'}; $new_array[14]=$in{'banner_width'}; } $data_array[$a] = join("\|",@new_array); $a++; } open (DATA,">protected/data.file"); flock (DATA,2); print DATA @data_array; flock (DATA,8); close (DATA); } sub login_manager { $html_page_title = "Account Manager - Powered by YOYOO.COM"; &header; $html_file = "html/lspro_std_header.txt"; &insert_html2; print < 

Account Manager
Account Number
Password

EOF print "
"; print "Return to $lspro_site_name
"; $html_file = "html/lspro_std_footer.txt"; &insert_html2; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. print "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; &footer; exit; } sub tx {if (-e "protected/advadmin.cgi") {die;}} sub account_manager { open (EDIT_MEMBER,"; flock (EDIT_MEMBER,8); close (EDIT_MEMBER); $valid=0; $a=0; foreach (@edit_member) { @edit_array = split(/\|/,$edit_member[$a]); if (($in{'account'} == $edit_array[12]) && ($in{'password'} eq $edit_array[11])) { $valid++; if ($in{'action'} eq "process") { $in{'password'} = $in{'new_password'}; $edit_array[4]=$in{'name'}; $edit_array[5]=$in{'email'}; $edit_array[6]=$in{'site_name'}; $edit_array[7]=$in{'site_description'}; $edit_array[8]=$in{'site_url'}; $edit_array[9]=$in{'banner_url'}; $edit_array[10]=$in{'preview_url'}; $edit_array[11]=$in{'new_password'}; &update_account } $html_page_title = "Account Manager - Powered by YOYOO.COM"; &header; $html_file = "html/lspro_std_header.txt"; &insert_html2; print <$lspro_site_name

EOF if ($in{'action'} eq "process") { print < EOF } print <
Edit Account
Account Updated...

User Name

Email Address

Site Name

Site Description

Site URL

Banner URL

Banner Width
(max $max_banner_width)

Banner Height
(max $max_banner_height)

Password

Return to $lspro_site_name

EOF $html_file = "html/lspro_std_footer.txt"; &insert_html; #Do not remove the copyright notice. If you are using the program and remove the copyright notice you are in violation of our copyright. print "

Copyright ฉ 1999 YOYOO.COM, All Rights Reserved

"; &footer; exit; } $a++; } if ($valid == 0) { $error_text = "You have entered an invaid account number or password.
"; &error; } exit; }