Code: Perl
#!/usr/bin/perl
#!C:\perl\bin\perl.exe
=Copyright Infomation
==========================================================
Program Name : Mewsoft Boardawy
Program Author : Dr. Elsheshtawy, Ahmed Amin, Ph.D. Physics
Home Page : http://www.mewsoft.com
Email : support@mewsoft.com
Products : Auction, Classifieds, Directory, etc. Integrated
Copyrights © 2005-2009 Mewsoft® Corporation. All rights reserved.
==========================================================
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
==========================================================
=cut
#==========================================================
$| = 1;
print "Content-type: text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);
#==========================================================
BEGIN {
undef %Param;
undef %Global;
undef @User_Fields;
undef %Cookies;
}
#==========================================================
BEGIN {
use FindBin qw($Bin $Script);
$Bin ||= ".";
use lib "$Bin/lib";
unshift @INC, $Bin;
unshift @INC, "$Bin/mewsoft";
$Global{CGI_Dir} = $Bin;
$Global{MainProg} = $Script;
}
#==========================================================
use Configuration;
use ForumTables;
&MyProgramStart;
#==========================================================
&Update_SQL_Tables;
&Quit;
#==========================================================
#==========================================================
sub Update_SQL_Tables{
my ($Query);
#goto step10;
print "Updating Forum_Users_Info Table...";
$Query = qq!ALTER TABLE Forum_Users_Info DROP LastVist!;
$dbh->do($Query);# || &DB_Exit($Query."<br />Line ". __LINE__ . ", File ". __FILE__);
$Query = qq!ALTER TABLE Forum_Users_Info ADD LastVisit INT!;
$dbh->do($Query);
$Time = time;
$Query = qq!UPDATE Forum_Users_Info SET LastVisit=$Time!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Forums MODIFY COLUMN Forum BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Topics MODIFY COLUMN Topic BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Posts MODIFY COLUMN Post BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Search MODIFY COLUMN Cash BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Groups MODIFY COLUMN GroupID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE PrivMsgs MODIFY COLUMN ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_CommunityBoards MODIFY COLUMN Board BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
$Query = qq!ALTER TABLE Forum_Smileys MODIFY COLUMN ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY!;
$dbh->do($Query);
print " Done<br />";
#----------------------------------------------------------------
print "Updating configuration... ";
&Create_Forum_Config_Table;
$Query = qq!SELECT Name, Value FROM Forum_Config!;
$sth = $dbh->prepare($Query);
$sth->execute;
undef %Config;
while(($Name, $Value) = $sth->fetchrow_array) {
$Config{$Name} = $Value;
}
$sth->finish;
if (%Config) {
&UpdateSettings(%Config);
}
print " Done<br />";
print "Dropping table Forum_Config... <br />";
$Query = qq!DROP TABLE Forum_Config!;
$dbh->do($Query);
print " Done<br />";
#----------------------------------------------------------------
#----------------------------------------------------------------
step10:
print "Updating Forum_Whos_Online Table...";
$Query = qq!ALTER TABLE Forum_Whos_Online ADD Action VARCHAR(50), ADD Forum INT, ADD Topic INT, ADD Post INT!;
$dbh->do($Query) || &DB_Exit($Query."<br />Line ". __LINE__ . ", File ". __FILE__);
print " Done<br />";
}
#==========================================================
sub MyProgramStart {
eval "use General;";
eval "use DisplayMgr;";
eval "use Mewsoft;";
eval "use SQLlib;";
eval "use Banners;";
eval "use ForumLib;";
&ModLoad("DBI");
&ModLoad("Time::Local");
&GetForm;
&Get_Cookies;
$ScriptURL = &ScriptURL;
&Read_Configuration;
srand (time | $$);
&LoadLangFile($Global{LanguageForumFile});
&DB_Start;
&ReadSettings;
}
#==========================================================
|