Config and Commands
Config And Commands
Config
Default config file:
password: randomPass #password for php -> bukkit connections postPassword: randomPass #password for bukkit -> php POST connections port: 11223 #port for PHPsend plugin service postDataUrl: http://localhost #URL of POST default webpage. Must start of http://. Can contain port after ":" like: http://localhost:8080 (NOTE: you need to have your URL in ' ', if you want to use ":". logLevel: 2 #logging level, will explain better later useWhitelist: true #determines is server should use whitelisting postPrint: true #determines if website command should give output
Commands
/website <key1=val1> <key2=val2>
Permission: phpsend.website
NOTE: FOR SECURITY LAST KEY - VALUE PAIR CONTAINS: PHPSpass = SHA1(postPassword) (from config). TO MAKE SURE THAT VALUES COME FROM SERVER YOU SHOULD INSERT AT BEGGINING OF PHP PAGE:
<?php if (PHPSauth($_POST['PHPSpass'])) die(0); ?>
The command outputs receieved website if postPrint is true in config.
/phpsend reload
Permission: phpsend.admin
Simply reloads the config and whitelist so you dont have to restart whole server.
Whitelist
Whitelist filters the clients by IP, to increase security. If your bukkit server is on same machine that website is, you can use it to block all connections from outside.
Plugin-Side Whitelist.
Whitelist must be enabled by config, use whitelist must be true. Whitelist is defined in wlist.txt file in PHPsend config folder (next to config.yml). The file should contain lines with IP's (no hostnames, sorry...), each line is one IP.
PHP-Side Whitelist
Should be edited in PHPSendConfig.php. To add new ip just add line to $PHPSwhitelist=array(), so if we want to add 8.8.8.8 (Google IP), do it like:
<?php $PHPSwhitelist=array ( "127.0.0.1", //remember about comma! "8.8.8.8" //add that ); ?>
Whitelist must be enabled by $PHPSuseWhitelist.
PHP Server Config
Config looks like (commented here):
<?php $PHPSpassword="randomPass"; //Password for outgoing connections (not default used by API, you can use it in your code) $PHPSpostPassword="randomPass"; //Password for incoming connections (used by PHPSauth) $PHPSuseWhitelist=true; //If whitelist should be used (used by PHPSauth) $PHPSwhitelist=array //Whitelist array (used by PHPSauth) ( "127.0.0.1" //Add more entries if needed. ); ?>
/website test=test with a test there is no post var ...
the command website /website test=test key=value test2=value2