Просмотр файла install.php

Размер файла: 4.94Kb
<?php

/*********************************************************************
 *
 * WapSite powered by CsC Portal. WapSite[tm] is module of CsC Portal.
 *
 * (C) 2004. CsC Portal. All rights reserved.
 *
 * http://cscp.cs-centar.net | http://www.cs-centar.net
 *
 ********************************************************************/

function p_header() {

echo "<html><head><title>[CsCP] Installation</title><LINK REL=\"StyleSheet\" HREF=\"doc/style.css\" TYPE=\"text/css\"></head><body bgcolor=\"cccccc\">
<br><br><br><br>
<center>
<table align=\"center\" width=\"50%\"><tr align=\"center\"><td class=header><a href=\"install.php\" title=\"Click here to go back to the first page\"><font class=bigfont>Installation</font></a></td></tr>
<tr><td>";

}

function p_footer() {

echo "</td></tr><tr><td class=header>&nbsp;</td></tr></table><br><font class=content>
&copy; 2004. CsCPortal. All rights reserved.
<br>
[ <a href=\"http://cscp.cs-centar.net\" target=_blank>http://cscp.cs-centar.net</a> ]
</center>
</body>
</html>";

}

if ($_GET['act'] == "update") {

p_header();

if (@fopen("updates/update.txt", "r")) {

echo $UpdateMessage;

} else {

echo "<br><br><center>There's no new updates!</center><br>";

}

p_footer();

exit;

}

if ($_GET['act'] == "install") {

p_header();

include("wap_db.php");

echo "MySQL Create Tables<br><br><br>";

echo "<table align=\"center\" width=\"100%\"><tr bgcolor=\"dcdcdc\" cellspacing=\"1\" cellpadding=\"2\"><td>DB Host</td><td> $db_host</td></tr><tr bgcolor=\"a9a9a9\"><td>DB Username</td><td> $db_username</td></tr><tr bgcolor=\"dcdcdc\"><td>DB Password</td><td> $db_password</td></tr><tr bgcolor=\"a9a9a9\"><td>DB Name</td><td> $db_name</td></tr></table><br><br><br>";

echo "<center><form method=\"get\" action=\"install.php\">
<input type=\"hidden\" name=\"act\" value=\"createdb\">
Is this correct?
<br><br>
<input type=\"submit\" value=\"YES. CREATE TABLES\" class=\"button\">
</form></center>";

p_footer();

exit;

}

if ($_GET['act'] == "createdb") {

include("db_connect.php");

$create1 = mysql_query("CREATE TABLE cscp_wap_menu (menu_name varchar(25) NOT NULL default '', menu_id varchar(25) NOT NULL default '')", $db);

$c1_insert_1 = mysql_query("INSERT into cscp_wap_menu VALUES ('News', 'news')", $db);

$c1_insert_2 = mysql_query("INSERT into cscp_wap_menu VALUES ('Home', 'index')", $db);

$create2 = mysql_query("CREATE TABLE cscp_wap_news (news_name varchar(20) NOT NULL default '', news_text longtext NOT NULL, news_date date default NULL)", $db);

$create3 = mysql_query("CREATE TABLE cscp_wap_page (page_name varchar(20) NOT NULL default '', page_subject varchar(30) NOT NULL default '', page_text longtext NOT NULL, PRIMARY KEY  (page_name))", $db);

$c3_insert = mysql_query("INSERT into cscp_wap_page VALUES ('index', 'Home', 'This is the first page of your WapSite. \r\n\r\nHere you can write greeting message or something else... ')", $db);

$create4 = mysql_query("CREATE TABLE cscp_wap_files (file_id varchar(10) default NULL, file_name varchar(30) NOT NULL default '', file_size varchar(30) default NULL)", $db);

$create5 = mysql_query("CREATE TABLE cscp_wap_options (id varchar(10) default NULL, language varchar(10) NOT NULL default '', file_upload_dir varchar(30) NOT NULL default '', m_add char(3) default NULL, m_edit char(3) default NULL, m_delete char(3) default NULL, m_upload char(3) default NULL)", $db);

$c5_insert_1 = mysql_query("INSERT into cscp_wap_options VALUES ('panel', 'eng', 'files', NULL, NULL, NULL, NULL)", $db);

$c5_insert_2 = mysql_query("INSERT into cscp_wap_options VALUES ('page', ' ', ' ', 'yes', 'yes', 'yes', NULL)", $db);

$c5_insert_3 = mysql_query("INSERT into cscp_wap_options VALUES ('news', ' ', ' ', 'yes', 'yes', 'yes', NULL)", $db);

$c5_insert_4 = mysql_query("INSERT into cscp_wap_options VALUES ('file', ' ', ' ', NULL, NULL, 'yes', 'yes')", $db);


p_header();

echo "<br><br><center>Tables successfully created!<br><br>Please delete <b>install.php</b>.</center>";

p_footer();

exit;

}

if ($_GET['act'] == "readme") {

p_header();

echo "<meta http-equiv=\"refresh\" content=\"0;URL=doc/readme.html\">";

p_footer();

exit;

}

// displaying first page

p_header();

echo "* Please choose action:<br><br><br><br><center><form method=\"get\" action=\"install.php\"><input type=\"hidden\" name=\"act\" value=\"install\"><input type=\"submit\" value=\" INSTALL \" class=\"button\"><br><br>[ Creates tables in your MySQL base ]</form><br><br><form method=\"get\" action=\"install.php\">
<input type=\"hidden\" name=\"act\" value=\"update\"><input type=\"submit\" value=\" UPDATE \" class=\"button\"><br><br>[ Updates script to newer version ]</form><br><br><form method=\"get\" action=\"install.php\"><input type=\"hidden\" name=\"act\" value=\"readme\"><input type=\"submit\" value=\" README \" class=\"button\"><br><br>[ Click here to see readme file ]</form>";

p_footer();

exit;


?>