[php] setup script
#1

Hi,

an old project, its not 100% finish, if you have fun you can complete it, its only little edits.

[hide]

 

the Include.php

<?php

$mysqlip = 'localhost';
$mysqluser = 'root';
$mysqlpassword = '';
$database_data = 'newproject_data';
$database_auth = 'newproject_db_auth';
$database_user = 'newproject_db_user';
$database_db = 'newproject_db';
$database_post = 'newproject_post';
$database_data_sql = 'newproject_data.sql';
$database_auth_sql = 'newproject_db_auth.sql';
$database_user_sql = 'newproject_db_user.sql';
$database_db_sql = 'newproject_db.sql';
$database_post_sql = 'newproject_post.sql';
$ep2_us = false;
$ep2_ger = false;
#$ep3 = $_POST["ep3_datenbank"];
$wait_ep2_ger = false;
$wait_ep2_us = false;
$Done = false;

#Don't edit below!#

$exp_inc = '';
$exp_dec = '';
$sp_inc = '';
$sp_dec = '';
$price_inc = '';
$price_dec = '';
$drop_inc = '';
$drop_dec = '';
$aff_inc = '';
$aff_dec = '';
$hs_add = '';

$log_gs_1 = '';
$tmp = '';

    
### EXPERIENCE ###    
    
#Exp inc
if ($exp_inc == true)
{
$exp_query = "UPDATE t_exp SET a_exp = a_exp / $exp_inc";
$exp_ergebnis = mysql_query($exp_query);
if ($exp_ergebnis == true)
{
    echo "Done";
}
}

if ($exp_dec == true)
{
#Exp dec
$exp_query = "UPDATE t_exp SET a_exp = a_exp * $exp_dec";
$exp_ergebnis = mysql_query($exp_query);
if ($exp_ergebnis == true)
{
    echo "Done";
}

### SKILLPOINT ###

}
#Sp inc
if ($sp_inc == true)
{
$sp_query = "UPDATE t_npc SET a_skill_point = a_skill_point * $sp_inc";
$sp_ergebnis = mysql_query($sp_query);
if ($sp_ergebnis == true)
{
    echo "Done";
}
}

if ($sp_dec == true)
{
#Sp dec
$sp_query = "UPDATE t_npc SET a_skill_point = a_skill_point / $sp_dec";
$sp_ergebnis = mysql_query($sp_query);
if ($sp_ergebnis == true)
{
    echo "Done";
}
}

### PRICE ###

#Price inc
if ($price_inc == true)
{
$price_query = "UPDATE t_npc SET a_prize = a_prize * $price_inc";
$price_ergebnis = mysql_query($price_query);
if ($price_ergebnis == true)
{
    echo "Done";
}
}

if ($price_dec == true)
{
#Price dec
$price_query = "UPDATE t_npc SET a_prize = a_prize / $price_dec";
$price_ergebnis = mysql_query($price_query);
if ($price_ergebnis == true)
{
    echo "Done";
}
}

### DROP ###

#Drop inc
if ($drop_inc == true)
{
$drop_query = "
UPDATE t_npc SET a_item_percent_0 = a_item_percent_0 * $drop_inc;
UPDATE t_npc SET a_item_percent_1 = a_item_percent_1 * $drop_inc;
UPDATE t_npc SET a_item_percent_2 = a_item_percent_2 * $drop_inc;
UPDATE t_npc SET a_item_percent_3 = a_item_percent_3 * $drop_inc;
UPDATE t_npc SET a_item_percent_4 = a_item_percent_4 * $drop_inc;
UPDATE t_npc SET a_item_percent_5 = a_item_percent_5 * $drop_inc;
UPDATE t_npc SET a_item_percent_6 = a_item_percent_6 * $drop_inc;
UPDATE t_npc SET a_item_percent_7 = a_item_percent_7 * $drop_inc;
UPDATE t_npc SET a_item_percent_8 = a_item_percent_8 * $drop_inc;
UPDATE t_npc SET a_item_percent_9 = a_item_percent_9 * $drop_inc;
UPDATE t_npc SET a_item_percent_10 = a_item_percent_10 * $drop_inc;
UPDATE t_npc SET a_item_percent_11 = a_item_percent_11 * $drop_inc;
UPDATE t_npc SET a_item_percent_12 = a_item_percent_12 * $drop_inc;
UPDATE t_npc SET a_item_percent_13 = a_item_percent_13 * $drop_inc;
UPDATE t_npc SET a_item_percent_14 = a_item_percent_14 * $drop_inc;
UPDATE t_npc SET a_item_percent_15 = a_item_percent_15 * $drop_inc;
UPDATE t_npc SET a_item_percent_16 = a_item_percent_16 * $drop_inc;
UPDATE t_npc SET a_item_percent_17 = a_item_percent_17 * $drop_inc;
UPDATE t_npc SET a_item_percent_18 = a_item_percent_18 * $drop_inc;
UPDATE t_npc SET a_item_percent_19 = a_item_percent_19 * $drop_inc;";
$drop_ergebnis = mysql_query($drop_query);
if ($drop_ergebnis == true)
{
    echo "Done";
}
}

if ($drop_dec == true)
{
#Drop dec
$drop_query = "
UPDATE t_npc SET a_item_percent_0 = a_item_percent_0 / $drop_dec;
UPDATE t_npc SET a_item_percent_1 = a_item_percent_1 / $drop_dec;
UPDATE t_npc SET a_item_percent_2 = a_item_percent_2 / $drop_dec;
UPDATE t_npc SET a_item_percent_3 = a_item_percent_3 / $drop_dec;
UPDATE t_npc SET a_item_percent_4 = a_item_percent_4 / $drop_dec;
UPDATE t_npc SET a_item_percent_5 = a_item_percent_5 / $drop_dec;
UPDATE t_npc SET a_item_percent_6 = a_item_percent_6 / $drop_dec;
UPDATE t_npc SET a_item_percent_7 = a_item_percent_7 / $drop_dec;
UPDATE t_npc SET a_item_percent_8 = a_item_percent_8 / $drop_dec;
UPDATE t_npc SET a_item_percent_9 = a_item_percent_9 / $drop_dec;
UPDATE t_npc SET a_item_percent_10 = a_item_percent_10 / $drop_dec;
UPDATE t_npc SET a_item_percent_11 = a_item_percent_11 / $drop_dec;
UPDATE t_npc SET a_item_percent_12 = a_item_percent_12 / $drop_dec;
UPDATE t_npc SET a_item_percent_13 = a_item_percent_13 / $drop_dec;
UPDATE t_npc SET a_item_percent_14 = a_item_percent_14 / $drop_dec;
UPDATE t_npc SET a_item_percent_15 = a_item_percent_15 / $drop_dec;
UPDATE t_npc SET a_item_percent_16 = a_item_percent_16 / $drop_dec;
UPDATE t_npc SET a_item_percent_17 = a_item_percent_17 / $drop_dec;
UPDATE t_npc SET a_item_percent_18 = a_item_percent_18 / $drop_dec;
UPDATE t_npc SET a_item_percent_19 = a_item_percent_19 / $drop_dec;";
$drop_ergebnis = mysql_query($drop_query);
if ($drop_ergebnis == true)
{
    echo "Done";
}
}

### AFFINITY ###

#Affinity inc
if ($aff_inc == true)
{
$aff_query = "UPDATE t_affinity_work SET a_value = a_value * $aff_inc;";
$aff_ergebnis = mysql_query($aff_query);
if ($aff_ergebnis == true)
{
    echo "Done";
}
}

if ($aff_dec == true)
{
#Affinity dec
$aff_query = "UPDATE t_affinity_work SET a_value = a_value / $aff_dec;";
$aff_ergebnis = mysql_query($aff_query);
if ($aff_ergebnis == true)
{
    echo "Done";
}
}

### HS ADD ###
if ($hs_add == true)
{
$hs_query = "UPDATE t_npc SET a_item_19 = 85;";
$hs_ergebnis = mysql_query($hs_query);
if ($hs_ergebnis == true)
{
    echo "Done";
}
}

?>
the setup.php

<?php
$check = mkdir('/home/Server');

$zip = new ZipArchive;
if ($zip->open('ep3/Server.zip') === TRUE) {
    $zip->extractTo('/home/Server');
    $zip->close();
    echo 'ok';
    shell_exec('chmod -R 0777 /home/Server');
} else {
    echo 'Fehler';
}

include("include.php");

$Setup_ip = $_SERVER['SERVER_NAME'];

###GameServer newStobm edit###
$lines = file ("/home/Server/GameServer/GameServer1/data/newStobm.bin");
#Server#
$lines[3] = "IP=$Setup_ip\n";
#Catalog#
$lines[10] = "DBName=$database_data\n";
$lines[11] = "User=$mysqluser\n";
$lines[12] = "Password=$mysqlpassword\n";
#Post#
$lines[32] = "DBName=$database_post\n";
$lines[33] = "User=$mysqluser\n";
$lines[34] = "Password=$mysqlpassword\n";

$handle = fopen ("/home/Server/GameServer/GameServer1/data/newStobm.bin", "w");
fwrite($handle, implode('',$lines));
fclose($handle);

###LoginServer newStobm edit###
$lines = file ("/home/Server/LoginServer/LoginServer/newStobm.bin");
#Server#
$lines[2] = "IP=$Setup_ip\n";
#User DB#
$lines[8] = "DBName=$database_user\n";
$lines[9] = "User=$mysqluser\n";
$lines[10] = "Password=$mysqlpassword\n";
#Data DB#
$lines[14] = "DBName=$database_data\n";
$lines[15] = "User=$mysqluser\n";
$lines[16] = "Password=$mysqlpassword\n";
#Auth DB#
$lines[20] = "DBName=$database_auth\n";
$lines[21] = "User=$mysqluser\n";
$lines[22] = "Password=$mysqlpassword\n";

$handle = fopen ("/home/Server/LoginServer/LoginServer/newStobm.bin", "w");
fwrite($handle, implode('',$lines));
fclose($handle);

###Connector newStobm edit###
$lines = file ("/home/Server/Connector/Connector/newStobm.bin");
#User DB#
$lines[8] = "DBName=$database_user\n";
$lines[9] = "User=$mysqluser\n";
$lines[10] = "Password=$mysqlpassword\n";
#Auth DB#
$lines[14] = "DBName=$database_auth\n";
$lines[15] = "User=$mysqluser\n";
$lines[16] = "Password=$mysqlpassword\n";
#Event DB#
$lines[20] = "DBName=$database_auth\n";
$lines[21] = "User=$mysqluser\n";
$lines[22] = "Password=$mysqlpassword\n";

$handle = fopen ("/home/Server/Connector/Connector/newStobm.bin", "w");
fwrite($handle, implode('',$lines));
fclose($handle);

###Helper newStobm edit###
$lines = file ("/home/Server/Helper/Helper/newStobm.bin");
#Char DB#
$lines[7] = "DBName=$database_db\n";
$lines[8] = "User=$mysqluser\n";
$lines[9] = "Password=$mysqlpassword\n";

$handle = fopen ("/home/Server/Helper/Helper/newStobm.bin", "w");
fwrite($handle, implode('',$lines));
fclose($handle);

###SubHelper newStobm edit###
$lines = file ("/home/Server/SubHelper/SubHelper/newStobm.bin");
#Char DB#
$lines[9] = "DBName=$database_db\n";
$lines[10] = "User=$mysqluser\n";
$lines[11] = "Password=$mysqlpassword\n";
#Post DB#
$lines[15] = "DBName=$database_post\n";
$lines[16] = "User=$mysqluser\n";
$lines[17] = "Password=$mysqlpassword\n";

$handle = fopen ("/home/Server/SubHelper/SubHelper/newStobm.bin", "w");
fwrite($handle, implode('',$lines));
fclose($handle);
### ICH BIN DER GEILSTE, PASS MA UF DU MUSST EP3 NOCH RAUS NEHMEN DIGGA###
$ep3 = true;

if ($ep3)
{
$wait_ep3 = true;    
}

$verbindung = mysql_connect("$mysqlip","$mysqluser","$mysqlpassword");
if (!$verbindung)
{
#    echo "Das war wohl nichts Sad";    
}
else
{

### CREATE database_data ###
$connect_data = mysql_select_db("$database_data");
if(!$connect_data)
{
    echo "Creating $database_data";
$verbindung_data = mysql_query("CREATE DATABASE $database_data");
if (!$verbindung_data)
    {
#        echo "<br>Can't create $database_data";
    }    
}
else
{
#    echo "<br>Database $database_data is exist!";
}

### CREATE database_auth ###
$connect_auth = mysql_select_db("$database_auth");
if(!$connect_auth)
{
#    echo "<br>Create $database_auth";
$verbindung_auth = mysql_query("CREATE DATABASE $database_auth");
if (!$verbindung_auth)
    {
#        echo "<br>Can't create $database_auth";
    }
}
else
{
#    echo "<br>Database $database_auth is exist!";
}

### CREATE database_user ###
$connect_user = mysql_select_db("$database_user");
if(!$connect_user)
{
#    echo "<br>Create $database_user";
$verbindung_user = mysql_query("CREATE DATABASE $database_user") or die("<br>Can't create $database_user");
}
else
{
#    echo "<br>Database $database_user is exist!";
}

### CREATE database_db ###
$connect_db = mysql_select_db("$database_db");
if(!$connect_db)
{
#    echo "<br>Create $database_db";
$verbindung_db = mysql_query("CREATE DATABASE $database_db");
    if(!$verbindung_db)
    {
#    echo "<br>Can't create $database_db";
    }
}
else
{
#    echo "<br>Database $database_db is exist!";
}

### CREATE database_post ###
$connect_post = mysql_select_db("$database_post");
if(!$connect_post)
{
    echo ("<br>Create $database_post");
$verbindung_post = mysql_query("CREATE DATABASE $database_post");
    if(!$verbindung_post)
    {
#            echo "<br>Can't create $database_post";
    }
}
else
{
#    echo "<br>Database $database_post is exist!";
}

}    

#    echo "<br> load ep3 database!";
        $ep3_out_data = shell_exec("mysql --user=$mysqluser --password=$mysqlpassword '$database_data' < ep3/'$database_data_sql'");
        $ep3_out_db = shell_exec("mysql --user=$mysqluser --password=$mysqlpassword '$database_db' < ep3/'$database_db_sql'");
        $ep3_out_auth = shell_exec("mysql --user=$mysqluser --password=$mysqlpassword '$database_auth' < ep3/'$database_auth_sql'");
        $ep3_out_user = shell_exec("mysql --user=$mysqluser --password=$mysqlpassword '$database_user' < ep3/'$database_user_sql'");
        $ep3_out_post = shell_exec("mysql --user=$mysqluser --password=$mysqlpassword '$database_post' < ep3/'$database_post_sql'");
        
if (!$ep3_out_data AND !$ep3_out_db AND !$ep3_out_auth AND !$ep3_out_user AND !$ep3_out_post)
{
    $wait_ep3 = false;

}    

?>
 

 

[/hide]

salute,

peter



Forum Jump:


Users browsing this thread: 1 Guest(s)