#!/usr/bin/perl
use lib '/home/*****/public_html/modules';
use AdminLevels;
# -- Default Url:
$prefix = "/home/speajos6/public_html";
# -- Useful modules:
require "$prefix/modules/db.ccc";
require "$prefix/modules/misc.ccc";
require "$prefix/modules/user.ccc";
require "$prefix/modules/web.ccc";
require "$prefix/modules/email.ccc";
require "$prefix/modules/admob.ccc";
# -- Site components:
require "$prefix/components/functions.ccc";
require "$prefix/components/signup.ccc";
require "$prefix/components/userhome.ccc";
require "$prefix/components/inbox.ccc";
require "$prefix/components/buddies.ccc";
require "$prefix/components/forums.ccc";
require "$prefix/components/login.ccc";
require "$prefix/components/useroptions.ccc";
require "$prefix/components/chat.ccc";
require "$prefix/components/extras.ccc";
require "$prefix/components/admin.ccc";
require "$prefix/components/upload.ccc";
# -- Database Server (MySQL) connection information:
$driver = "mysql";
$hostname = "localhost";
$database = "speajos6_prodigit";
$dbuser = "speajos6_special";
$dbpass = "remember";
$dsn = "DBI:$driver:database=$database;hostname=$hostname";
# -- Database tables definitions:
$SESSIONS_TABLE = "sessions";
$USERS_TABLE = "users";
$BANNED_TABLE = "banned";
$INBOX_TABLE = "inbox";
$BUDDIES_TABLE = "buddies";
$FORUMS_TABLE = "forums";
$ALERTS_TABLE = "alerts";
$CHATROOMS_TABLE = "chatrooms";
$CHAT_TABLE = "chat";
$IGNOREDUSERS_TABLE = "ignoredusers";
$EXTRAS_TABLE = "extras";
$LOGS_TABLE = "logs";
$USERPROFILES_TABLE = "userprofiles";
$VOTE_TABLE = "vote";
$SAYIT_TABLE = "sayit";
$SMILEYS_TABLE = "smileys";
# -- smiles defintion
%smiles = (
'wickedwap' => '/images/spam1.gif'
);
# -- Paths definitions:
# Dirs:
$ROOT_DIR = $prefix . "/";
$TEMPLATES_DIR = $ROOT_DIR . "templates/";
$LOGS_DIR = $ROOT_DIR . "logs/";
# Files:
$ABOUT_TEMPLATE = $TEMPLATES_DIR . "about.wml";
$ACCOUNT_TEMPLATE = $TEMPLATES_DIR . "account.wml";
$ACCOUNTSTATS_TEMPLATE = $TEMPLATES_DIR . "accountstats.wml";
$ADDBUDDY_TEMPLATE = $TEMPLATES_DIR . "addbuddy.wml";
$ADMIN_TEMPLATE = $TEMPLATES_DIR . "admin.wml";
$ADMINDIALOG_TEMPLATE = $TEMPLATES_DIR . "admindialog.wml";
$ADMINERROR_TEMPLATE = $TEMPLATES_DIR . "adminerror.wml";
$ADMINRULES_TEMPLATE = $TEMPLATES_DIR . "adminrules.wml";
$ALLUSERS_TEMPLATE = $TEMPLATES_DIR . "allusers.wml";
$BANNEDUSERS_TEMPLATE = $TEMPLATES_DIR . "bannedusers.wml";
$BASICINFO_TEMPLATE = $TEMPLATES_DIR . "basicinfo.wml";
$BROWSERINFO_TEMPLATE = $TEMPLATES_DIR . "browserinfo.wml";
$BUDDIES_TEMPLATE = $TEMPLATES_DIR . "buddies.wml";
$BUDDIESERROR_TEMPLATE = $TEMPLATES_DIR . "buddieserror.wml";
$BUDDYREQUEST_TEMPLATE = $TEMPLATES_DIR . "buddyrequest.wml";
$CHAT_TEMPLATE = $TEMPLATES_DIR . "chat.wml";
$CHATCONTROLS_TEMPLATE = $TEMPLATES_DIR . "chatcontrols.wml";
$CHATERROR_TEMPLATE = $TEMPLATES_DIR . "chaterror.wml";
$CHATMSG_TEMPLATE = $TEMPLATES_DIR . "chatmsg.wml";
$CHATROOM_TEMPLATE = $TEMPLATES_DIR . "chatroom.wml";
$CHATSTATS_TEMPLATE = $TEMPLATES_DIR . "chatstats.wml";
$DELBUDDY_TEMPLATE = $TEMPLATES_DIR . "delbuddy.wml";
$DELETEALLMSGS_TEMPLATE = $TEMPLATES_DIR . "deleteallmsgs.wml";
$DEVICE_TEMPLATE = $TEMPLATES_DIR . "device.wml";
$EDITLINKS_TEMPLATE = $TEMPLATES_DIR . "editlinks.wml";
$EDITVOTE_TEMPLATE = $TEMPLATES_DIR . "editvote.wml";
$EXTRAOPTIONS_TEMPLATE = $TEMPLATES_DIR . "extraoptions.wml";
$FORUMINFO_TEMPLATE = $TEMPLATES_DIR . "foruminfo.wml";
$FORUMS_TEMPLATE = $TEMPLATES_DIR . "forums.wml";
$FORUMSERROR_TEMPLATE = $TEMPLATES_DIR . "forumserror.wml";
$FORUMSTATS_TEMPLATE = $TEMPLATES_DIR . "forumstats.wml";
$FORWARDMESSAGE_TEMPLATE = $TEMPLATES_DIR . "forwardmessage.wml";
$HEADADMIN_TEMPLATE = $TEMPLATES_DIR . "headadmin.wml";
$INBOX_TEMPLATE = $TEMPLATES_DIR . "inbox.wml";
$INBOXERROR_TEMPLATE = $TEMPLATES_DIR . "inboxerror.wml";
$INBOXSTATS_TEMPLATE = $TEMPLATES_DIR . "inboxstats.wml";
$INDEX_TEMPLATE = $TEMPLATES_DIR . "index.wml";
$LINKS_TEMPLATE = $TEMPLATES_DIR . "links.wml";
$LOCATION_TEMPLATE = $TEMPLATES_DIR . "location.wml";
$OFFLINEBUDDIES_TEMPLATE = $TEMPLATES_DIR . "offlinebuddies.wml";
$ONLINELIST_TEMPLATE = $TEMPLATES_DIR . "onlinelist.wml";
$OWNER_TEMPLATE = $TEMPLATES_DIR . "owner.wml";
$POSTALERT_TEMPLATE = $TEMPLATES_DIR . "postalert.wml";
$POSTMESSAGE_TEMPLATE = $TEMPLATES_DIR . "postmessage.wml";
$POSTREPLY_TEMPLATE = $TEMPLATES_DIR . "postreply.wml";
$POSTS_TEMPLATE = $TEMPLATES_DIR . "posts.wml";
$PRIVATEROOM_TEMPLATE = $TEMPLATES_DIR . "privateroom.wml";
$READMESSAGE_TEMPLATE = $TEMPLATES_DIR . "readmessage.wml";
$SEARCHUSERPROFILE_TEMPLATE = $TEMPLATES_DIR . "searchuserprofile.wml";
$SENTMSGS_TEMPLATE = $TEMPLATES_DIR . "sentmsgs.wml";
$SETMOOD_TEMPLATE = $TEMPLATES_DIR . "setmood.wml";
$SHOWPROFILE_TEMPLATE = $TEMPLATES_DIR . "showprofile.wml";
$SHOWVOTE_TEMPLATE = $TEMPLATES_DIR . "showvote.wml";
$SIGNUP_TEMPLATE = $TEMPLATES_DIR . "signup.wml";
$SIGNUPINFO_TEMPLATE = $TEMPLATES_DIR . "signupinfo.wml";
$SITEADMINS_TEMPLATE = $TEMPLATES_DIR . "siteadmins.wml";
$SITESTATS_TEMPLATE = $TEMPLATES_DIR . "sitestats.wml";
$SMILEYS_TEMPLATE = $TEMPLATES_DIR . "smileys.wml";
$TELLANOTHERUSER_TEMPLATE = $TEMPLATES_DIR . "tellanotheruser.wml";
$TERMS_TEMPLATE = $TEMPLATES_DIR . "terms.wml";
$THREADS_TEMPLATE = $TEMPLATES_DIR . "threads.wml";
$UPDATEPROFILE_TEMPLATE = $TEMPLATES_DIR . "updateprofile.wml";
$UPLOAD_TEMPLATE = $TEMPLATES_DIR . "upload.wml";
$USERHOME_TEMPLATE = $TEMPLATES_DIR . "userhome.wml";
$USERINFO_TEMPLATE = $TEMPLATES_DIR . "userinfo.wml";
$USERLIST_TEMPLATE = $TEMPLATES_DIR . "userlist.wml";
$USEROPT_TEMPLATE = $TEMPLATES_DIR . "useropt.wml";
$USEROPTERROR_TEMPLATE = $TEMPLATES_DIR . "useropterror.wml";
$USEROPTIONS_TEMPLATE = $TEMPLATES_DIR . "useroptions.wml";
$USERPROFILES_TEMPLATE = $TEMPLATES_DIR . "userprofiles.wml";
$VOTE_TEMPLATE = $TEMPLATES_DIR . "vote.wml";
$WELCOME_TEMPLATE = $TEMPLATES_DIR . "welcome.wml";
$WHOISWHERE_TEMPLATE = $TEMPLATES_DIR . "whoiswhere.wml";
$WRITEMESSAGE_TEMPLATE = $TEMPLATES_DIR . "writemessage.wml";
# $OPINIONS_TEMPLATE = $TEMPLATES_DIR . "opinions.wml";
# $EXTRAS_TEMPLATE = $TEMPLATES_DIR . "extras.wml";
# $EDITEXTRAS_TEMPLATE = $TEMPLATES_DIR . "editextras.wml";
# $EDITOPINIONS_TEMPLATE = $TEMPLATES_DIR . "editopinions.wml";
# -- Globals:
# admin ID:
$ADMIN_ID = 1;
# admin buddy (appears at top in buddy list):
$ADMIN_BUDDY = 2;
# admin inbox size:
$ADMIN_MAXINBOX = 500;
# maximum inbox size:
$MAXINBOX = 100;
# maximum threads:
$MAXTHREADS = 500000;
# maximum posts:
$MAXPOSTS = 500000;
# session ID lifetime:
$TIMEOUT = 31536000; # (1 year)
# offline time (how many seconds before a user is considered offline):
$OFFLINETIME = 300; # (5 min)
# number of messages per page, in inbox:
$MAILSPERPAGE = 10;
# number of buddies per page:
$BUDDIESPERPAGE = 10;
# number of threads per page:
$THREADSPERPAGE = 10;
# number of posts per page:
$POSTSPERPAGE = 7;
# default number of posts per page:
$DEFPOSTSPERPAGE = 7;
# number of lines in chat:
$CHATLINES = 40;
# refresh speed in chat:
$CHATREFRESH = 10;
# lifetime for chat messages:
$CHATMSGLIFETIME = 1200; #(20 min)
# number of users per page, in who is where?:
$CHATUSERSPERPAGE = 10;
# number of users per page, in userlist (admin):
$USERSPERPAGE = 10;
# number of smileys per page:
$SMILEYSPERPAGE = 5;
# number of users per page, in historylist (admin):
$HISTORYPERPAGE = 100;
# number of chars in opinions:
$OPINIONSCHARS = 250;
# number of extras per page, in extras:
$EXTRASPERPAGE = 10;
# number of interests per page, in interests:
$LINKSPERPAGE = 10;
# flood time for forums (both threads and replies):
$FORUMFLOODTIME = 30; # (half a min)
$REPLIESFLOODTIME = 20; # (10 sec)
# flood time for inbox:
$INBOXFLOODTIME = 10; # (10 sec)
# flood time for chat:
$CHATFLOODTIME = 10; # (10 sec)
# site sections:
%site_areas = (
'home' => 'Home',
'inbox' => 'Inbox/Alerts',
'buddylist' => 'Buddy List',
'forums' => 'Forums',
'chat' => 'Chat',
'extras' => 'Extras',
'opinions' => 'Opinions',
'options' => 'Options',
'admin' => 'Admin Tools',
'logout' => 'Log Out',
'vote' => 'Site Vote',
'links' => 'Links',
'upload' => 'Uploading Photo'
);
# -- Init function: this function will always be called, and this is the point
# -- where we call all the other modules and verify user information.
sub Init {
# Create the database connection and browser interface:
$inp = new CGI;
$dbh = DBI->connect($dsn,$dbuser,$dbpass,{RaiseError >= 1});
$HASH{'SITENAME'} = $ENV{'SERVER_NAME'};
$HASH{'IPADDRESS'} = $ENV{'REMOTE_ADDR'};
my $brwsr = $ENV{'HTTP_USER_AGENT'};
@Numbers = split('/',$brwsr);
$HASH{'BROWSER'} = "@Numbers[0]";
$HASH{'BROWSER'} = "Internet Explorer 7" if $ENV{'HTTP_USER_AGENT'} =~ "MSIE 7.0";
$HASH{'BROWSER'} = "Internet Explorer 6" if $ENV{'HTTP_USER_AGENT'} =~ "MSIE 6.0";
$HASH{'BROWSER'} = "Opera" if $ENV{'HTTP_USER_AGENT'} =~ "Opera";
$HASH{'BROWSER'} = "Opera Mini" if $ENV{'HTTP_USER_AGENT'} =~ "Opera Mini";
$HASH{'BROWSER'} = "Firefox" if $ENV{'HTTP_USER_AGENT'} =~ "Firefox";
$browser = $ENV{'HTTP_USER_AGENT'};
if ($browser =~ m/Anonymouse.org/i) { Template($DEVICE_TEMPLATE,%HASH); exit(); }
my $now = time;
$HASH{'ONLINEUSERS'} = getField("COUNT(id)",$USERS_TABLE,"$now - lastseen <= $OFFLINETIME");
my $lastact = getField("lastseen",$USERS_TABLE,"id = '$uid'");
my $user_time = getField("onlinetime",$USERS_TABLE,"id = '$uid'");
$timetoadd = $now - $lastact;
if($timetoadd>120) { $timetoadd=0; }
my $addtime = $user_time + $timetoadd;
$dbh->do("UPDATE $USERS_TABLE SET onlinetime = '$addtime' WHERE id = '$uid'");
# Define the areas accessible by all users, without a password required:
my %public_areas = (
'index' => 'Homepage',
'login' => 'Login',
'signup' => 'Signup',
'about' => 'About This Site',
'terms' => 'Term Of Usage',
'account' => 'Account'
);
# List of all actions that require authentification:
my %restricted_areas = (
'home' => 'User Homepage',
'inbox' => 'Inbox',
'buddylist' => 'Buddies',
'forums' => 'Forums',
'chat' => 'Chat',
'extras' => 'Extras',
'opinions' => 'Opinions',
'options' => 'User Options',
'admin' => 'Admin Zone',
'logout' => 'Logout',
'vote' => 'Vote',
'links' => 'Links',
'upload' => 'Upload'
);
# Get global variables and well known parameters from the browser:
$rem_ip = $inp->remote_host;
$action = $inp->param("act");
$sesid = $inp->param("id");
$mode = $inp->param("mode");
# Add some globals to main hash
$HASH{'SESID'} = $sesid;
# "guest" is a specially assigned user to all visitors of the site, that are
# not registered users.
my $now = time;
$dbh->do("DELETE FROM $SESSIONS_TABLE where $now - time > '86400' AND username='guest'");
# Get the username attached to this session ID. The user return may be "guest"
# or a registered user. If the value returned is "undef" the session ID is not
# valid. If the user is registered we grant access to all site sections.
$username = isSessionOk($sesid,$SESSIONS_TABLE,$rem_ip);
if (!defined($username)) {
# Session ID invalid. Create one, and redirect to the first page:
$sesid = newSessionID("guest",$rem_ip,$SESSIONS_TABLE);
# Session ID successfuly created. Redirect to the start page:
if ($sesid ne "") { Location("index.cgi","act=index"); }
else { Location("index.cgi","act=index"); }
}
elsif (lc($username) eq "guest") {
# The user is not registered, or he didn't provide authentification information
# by now. The access is restricted only to public areas.
# Request to public section, follow action:
if (exists($public_areas{$action})) {
Template($INDEX_TEMPLATE,%HASH) if $action eq "index";
login() if $action eq "login";
signup() if $action eq "signup";
Template($ABOUT_TEMPLATE,%HASH) if $action eq "about";
Template($TERMS_TEMPLATE,%HASH) if $action eq "terms";
Template($ACCOUNT_TEMPLATE,%HASH) if $action eq "account";
}
elsif (exists($restricted_area{$action})) {
# Request to restricted areas, go to login page:
}
else { Location("index.cgi","act=index"); }
}
else {
# The user is registered, allow access to all site areas:
# Get the user id:
$uid = getField("id",$USERS_TABLE,"username LIKE '$username'");
$HASH{'USERNAME'} = $username;
$HASH{'UID'} = $uid;
$username = lc($username);
loguser();
$POSTSPERPAGE = getField("postsperpage",$USERS_TABLE,"id = $uid") || $DEFPOSTSPERPAGE;
# Send alert
if (defined $inp->param("send_alert_reply")) {
my $to = clear_illegal_user_chars($inp->param("to"));
my $subject = clear_illegal_chars($inp->param("subject"));
my $message = clear_illegal_chars($inp->param("message"));
my $toid = getField("id",$USERS_TABLE,"LOWER(username) = LOWER('$to')");
if ($toid != '') {
unless (sendinbox($uid,$toid,$subject,$message)) {
$HASH{'MSG'} = "Error sending message!";
Template($INBOXERROR_TEMPLATE,%HASH);
}
}
$HASH{LOCATION} = $inp->param("continue");
$HASH{LOCATION} =~ s/\^/;/g;
Template($LOCATION_TEMPLATE,%HASH);
$dbh->disconnect();
exit(0);
}
# Incoming message alert
my $msgid = get_oldest_unread($uid);
my $alerts_on = getField("receivealerts",$USERS_TABLE,"id = $uid");
if ($msgid && $alerts_on && !($action eq 'chat' && $mode eq 'send')) {
$HASH{CONTINUE} = $inp->self_url;
$HASH{CONTINUE} =~ s/;/&/g;
$HASH{CONTINUE2} = $inp->self_url;
$HASH{CONTINUE2} =~ s/;/&/g;
my $sth = $dbh->prepare("SELECT * FROM $INBOX_TABLE WHERE id = $msgid AND uid = $uid");
$sth->execute();
if ($sth->rows > 0) {
my @row = $sth->fetchrow_array;
my $sex = getField("sex",$USERPROFILES_TABLE,"uid = '$row[2]'");
if ($sex eq "M") { $color = "#0000FF"; }
elsif ($sex eq "F") { $color = "#FF0066"; }
$HASH{'DATE'} = gmt_date($row[7]);
$HASH{'TIME'} = gmt_time($row[7]);
$HASH{'FROM'} = "".get_sender($row[2])."";
$HASH{'FROM2'} = get_sender($row[2]);
$HASH{'SUBJECT'} = bb_code($row[3]);
$HASH{'SUBJECT2'} = $row[3];
$HASH{'MESSAGE'} = bb_code($row[4]);
$HASH{'MSGID'} = $msgid;
$HASH{'MESSAGE'} = bb_code($HASH{'MESSAGE'});
$dbh->do("UPDATE $INBOX_TABLE SET isnew = 'N' WHERE id = $msgid AND uid = $uid");
}
Template($TEMPLATES_DIR . "/msg_alert.wml", %HASH);
}
else {
# End *CR*
if (exists($public_areas{$action}) || exists($restricted_areas{$action})) {
userhome() if $action eq "home";
inbox() if $action eq "inbox";
buddies() if $action eq "buddylist";
forums() if $action eq "forums";
chat() if $action eq "chat";
extras() if $action eq "extras";
opinions() if $action eq "opinions";
useroptions() if $action eq "options";
admin() if $action eq "admin";
logout() if $action eq "logout";
vote() if $action eq "vote";
links() if $action eq "links";
upload() if $action eq "upload";
}
else { Location("index.cgi","act=home"); }
}
}
# Disconnect from DB server:
$dbh->disconnect();
exit(0);
}
# -- End of app.ccc:
return 1;
Last time I LOOKED THAT WAS PEARL CGI SCRIPT LMAO
!!!!Once more please use code tags!!!!