Navarr Barnier (rescye) wrote in pokequest,
Navarr Barnier
rescye
pokequest

Script Release: Terminal Setup File (configure)


#!/usr/bin/php
<?php
function nl($text) {
return str_replace(array("\r","\n","\r\n"),'',$text);
}
$f1 = fopen("php://stdin","r");
$f3 = fopen("php://stdin","w");
$settings = array();
print "PoKéQuesT Easy Setup File\r\n\r\n";
print "Have you read the Included Documentation? [y/n]: ";
$pr = nl(fgets($f1,1024));
if (strtoupper($pr) == 'Y') {
print "\r\n\r\n PoKéQuesT Settings\r\n";
print "IP to Bind PoKéQuesT To []: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['pokequest_bind'] = '0.0.0.0';
} else {
$settings['pokequest_bind'] = $temp;
}

print "Port to Run PoKéQuesT On [7566]: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['pokequest_port'] = 7566;
} else {
$settings['pokequest_port'] = $temp;
}

print "Maximum Users Allowed on Server At Once [1000]: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['pokequest_max_users'] = 1000;
} else {
$settings['pokequest_max_users'] = $temp;
}

print "\r\n\r\n MySQL Settings\r\n";
print "MySQL Server Hostname [localhost]: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['mysql_server'] = 'localhost';
} else {
$settings['mysql_server'] = $temp;
}

print "MySQL Server Port (Optional) [3306]: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['mysql_port'] = '3306';
} else {
$settings['mysql_port'] = $temp;
}

print "MySQL Login, Username [root]: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['mysql_user'] = 'root';
} else {
$settings['mysql_user'] = $temp;
}

print "MySQL Login, Password (REQUIRED) []: ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['mysql_pass'] = '';
} else {
$settings['mysql_pass'] = $temp;
}

print "MySQL Database [pokequest] (Must Allready Exist): ";
$temp = nl(fgets($f1,1024));
if ($temp == NULL) {
$settings['mysql_database'] = 'pokequest';
} else {
$settings['mysql_database'] = $temp;
}

// S2S Not Yet Implemented (expect v2 or v3)
//
// print "\r\n\r\n Send To Server (S2S) Setup\r\n";
// print "Enable S2S? [y/n]: ";
// $temp = nl(fgets($f1,1024));
// $settings['s2s'] = 0;
// $settings['s2s_server'] = 'localhost';
// $settings['s2s_port'] = '';
// if (strtoupper($temp) == 'Y') {
// $settings['s2s'] = 1;
// print "Server To Send PS2S Data To [localhost]: ";
// $temp = nl(fgets($f1,1024));
// if ($temp == NULL) {
// $settings['s2s_server'] = 'localhost';
// } else {
// $settings['s2s_server'] = $temp;
// }
//
// print "Port On The Server to Send PS2S Data To (REQUIRED): ";
// $temp = nl(fgets($f1,1024));
// while($temp == NULL) {
// print "Port On The Server to Send PS2S Data To (REQUIRED): ";
// $temp = nl(fgets($f1,1024));
// }
// $settings['s2s_port'] = $temp;
// }
$f2 = fopen("pokequest.conf","w");
fwrite($f2,"");
} else {
die("\r\nPlease Read the Included Documentation First\r\n");
}
// print_r($settings);
?>


~Rescye
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 0 comments