Advertisement
Guest User

Untitled

a guest
Jan 19th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.63 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. session_start();
  4. require("admin.php");
  5. require("config.php");
  6. ?>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  8. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
  9. <head>
  10. <link rel="stylesheet" type="text/css" href="style.css">
  11. <title>PUDS Donation System</title>
  12. </head>
  13. <body>
  14. <div id="header">
  15. <h1>PayPay-ULX Donation System Config Installer</h1>
  16. </div>
  17. <?php
  18.  
  19. //Gets the current URL
  20. function curDomain() {
  21. $pageURL = 'http';
  22. if ($_SERVER["HTTPS"] == "on") {
  23. $pageURL .= "s";
  24. }
  25. $pageURL .= "://";
  26. if ($_SERVER["SERVER_PORT"] != "80") {
  27. $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
  28. } else {
  29. $pageURL .= $_SERVER["SERVER_NAME"];
  30. }
  31. return $pageURL;
  32. }
  33.  
  34. //Gets the current Directory
  35. function curDirectory() {
  36. $current_dir_url = 'http';
  37. if ($_SERVER["HTTPS"] == "on") {
  38. $pageURL .= "s";
  39. }
  40. $current_dir_url .= "://";
  41. if ($_SERVER["SERVER_PORT"] != "80") {
  42. $current_dir_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"];
  43. } else {
  44. $current_dir_url .= $_SERVER["SERVER_NAME"];
  45. }
  46. $current_dir_url .= dirname($_SERVER['PHP_SELF']);
  47. return $current_dir_url;
  48. }
  49. //Session information
  50. $steam64 = $_SESSION['id'];
  51. $steamID = $_SESSION['sid'];
  52. $friendlyName = $_SESSION['name'];
  53. $mAvatar = $_SESSION['mAvatar'];
  54.  
  55. //Defaults
  56. if (empty($UseDB)) {
  57. $UseDB = 'true';
  58. }
  59. if (empty($_STEAMAPI)) {
  60. $_STEAMAPI = $_SESSION['steamAPI'];
  61. }
  62. if (empty($HOST)) {
  63. $HOST = 'localhost';
  64. }
  65. if (empty($payPalURL)) {
  66. $payPalURL = 'https://www.paypal.com/cgi-bin/webscr';
  67. }
  68. if (empty($website)) {
  69. $website = curDomain();
  70. }
  71. if (empty($currency)) {
  72. $currency = 'GBP';
  73. }
  74. if (empty($payPalEmail)){
  75. $payPalEmail = 'Changeme@changeme.com';
  76. }
  77. if (empty($IPN)) {
  78. $IPN = curDirectory() .'/ipn.php';
  79. }
  80. if (empty($donateDir)) {
  81. $donateDir = curDirectory();
  82. }
  83. if (empty($prices)) {
  84. $prices = array("1","2","3");
  85. }
  86. if (empty($ranks)) {
  87. $ranks = array("iron", "bronze", "gold");
  88. }
  89. if (empty($commands)) {
  90. $commands = array("ulx adduserid", "ulx adduserid", "ulx adduserid");
  91. }
  92. if (empty($messageRankFail)){
  93. $messageRankFail ='
  94. Thank you for your purchase $name Your rank information
  95. -------------------------
  96. Paid: \$fee
  97. SteamID: \$steamid
  98. Rank: \$rank
  99. -------------------------
  100. There has been an issue when adding your SteamID to the correct usergroup.
  101. Please contact the server admin to resolve this issue.';
  102. }
  103. if (empty($messageSuccess)){
  104. $messageSuccess ='Thank you for your purchase $name Your rank information
  105. -------------------------
  106. Paid: \$fee
  107. SteamID: \$steamid
  108. Rank: \$rank
  109. -------------------------
  110. Your rank will be available immediately';
  111. }
  112. if (empty($messageIPNFail)){
  113. $messageIPNFail ='
  114. Hello, The donation has failed to be verified by PayPal IPN, however payment may have been taken.
  115. Please contact the owner of the server to resolve this issue.';
  116. }
  117. if (ISSET($_POST["Submit"])) {
  118. $prices_str = '"' . implode('", "', explode(',', $_POST[prices])). '"';
  119. $ranks_str = '"' . implode('", "', explode(',', $_POST[ranks])). '"';
  120. $commands_str = '"' . implode('", "', explode(',', $_POST[commands])). '"';
  121.  
  122. echo '<p> Config successfully updated!</p>';
  123. $string = "<?php \$name = '';\n
  124. \$fee = '';\n
  125. \$steamid = '';\n
  126. \$rank = '';\n
  127. \$donationDir = '$_POST[donationDir]';\n
  128. \$IP = '$_POST[IP]';\n
  129. \$PORT = '$_POST[PORT]';\n
  130. \$PASSWORD = '$_POST[PASSWORD]';\n
  131. \$_STEAMAPI = '$_POST[steamapi]';\n
  132. \$UseDB = '$_POST[UseDB]';\n
  133. \$HOST = '$_POST[HOST]';\n
  134. \$DBUSER = '$_POST[DBUSER]';\n
  135. \$DBPASS = '$_POST[DBPASS]';\n
  136. \$DBNAME = '$_POST[DBNAME]';\n
  137. \$DBTABLE = '$_POST[DBTABLE]';\n
  138. \$payPalURL = '$_POST[payPalURL]';\n
  139. \$IPN = '$_POST[IPN]';\n
  140. \$payPalEmail = '$_POST[payPalEmail]';\n
  141. \$website = '$_POST[website]';\n
  142. \$currency = '$_POST[currency]';\n
  143. \$prices = array($prices_str);\n
  144. \$ranks = array($ranks_str);\n
  145. \$commands = array($commands_str);\n
  146. \$messageRankFail = '$_POST[messageRankFail]';\n
  147. \$messageSuccess = '$_POST[messageSuccess]';\n
  148. \$messageIPNFail = '$_POST[messageIPNFail]';\n
  149. ?>";
  150. $fp = FOPEN("config.php", "w");
  151. FWRITE($fp, $string);
  152. FCLOSE($fp);
  153. header("Location: $donateDir/install.php");
  154. };
  155.  
  156. if (!isset($_SESSION['id'])) {
  157. header("Location: $donateDir/login.php");
  158. exit();
  159. }
  160.  
  161. if($_SESSION['admin'] == true){
  162. echo "
  163. <p> Hello $friendlyName</p>
  164. <img src='$mAvatar'/>
  165. <a href='$donateDir/logout.php'>Logout</a>
  166. <form action='' method='post' name='install' id='install'>
  167. <h2>Garrysmod Server Configuration</h2>
  168. <p><input name='IP' type='text' id='IP' value=$IP>Server IP</p>Your garrysmod Server IP or localhost if your server runs on the same server as this website.
  169. <p><input name='PORT' type='text' id='PORT' value=$PORT>Server Port</p>Your garrysmod Server port.
  170. <p><input name='PASSWORD' type='password' id='PASSWORD' value=$PASSWORD>RCON Password</p>Your garrysmod rcon password - remember to set it up on your gmod server!
  171. <h2>Donation directory</h2>
  172. <p><input name='donationDir' type='text' id='donationDir' value=$donateDir style='width: 300px;'>Donation Files Directory</p> You should not need to change this.
  173. <h2>Steam API Key</h2>
  174. <p><input name='steamapi' type='text' id='steamapi' value='$_STEAMAPI' style='width: 300px;'>Steam API Key</p> Get one <a href=http://steamcommunity.com/dev/registerkey>here</a>
  175. <h2>MySQL Database Configuration</h2>
  176. <p><select name='UseDB' type='text' id='UseDB'>";
  177. $truefalse ="<option value='true'>True</option>
  178. <option value='false'>False</option>";
  179. $truefalse = str_replace("'$UseDB'", "'$UseDB' selected", $truefalse);
  180. echo $truefalse;
  181. echo"</select>
  182. Use MySQL (true/false)
  183. </p> Set to true to enable saving of donations to a mysql database. Setting to false will not save any record of donations (other than the log files).
  184. <p><input name='HOST' type='text' id='HOST' value=$HOST>Database Host</p>If this script is on the same webserver as your database leave as localhost
  185. <p><input name='DBUSER' type='text' id='DBUSER' value=$DBUSER>Database User</p>The user for the MySql database
  186. <p><input name='DBPASS' type='password' id='DBPASS' value=$DBPASS>Database Password</p>Password for the MySql user
  187. <p><input name='DBNAME' type='text' id='DBNAME' value=$DBNAME>Database Name</p>The name of the database
  188. <p><input name='DBTABLE' type='text' id='DBTABLE' value=$DBTABLE>Database Table</p>The name of the database table to store the donation information (PUDS will create it if its not already made)
  189. <p>
  190. <h2>PayPal Configuration</h2>
  191. <select name='payPalURL' type='text' id='payPalURL'>";
  192. $paypalurls ="<option value='https://www.paypal.com/cgi-bin/webscr'>Live PayPalURL</option>
  193. <option value='https://www.sandbox.paypal.com/cgi-bin/webscr'>Sandbox PayPalURL</option>";
  194. $paypalurls = str_replace("'$payPalURL'", "'$payPalURL' selected", $paypalurls);
  195. echo $paypalurls;
  196. echo "</select>
  197. PayPal URL
  198. </p>Set to Sandbox for testing, Set to Live for a live environment.
  199. <p><input name='payPalEmail' type='text' id='payPalEmail' value='$payPalEmail' style='width: 300px;'>PayPal E-mail</p> The paypal account the donations go to - remember to change this to a sandbox account if testing the sandbox.
  200. <p><input name='IPN' type='text' id='IPN' value=$IPN style='width: 300px;'>IPN Script URL</p> The location of the IPN script, you should not need to change this.
  201. <p><input name='website' type='text' id='website' value=$website style='width: 300px;'>Your website</p> PUDS will automatically fill this in for you.
  202. <p><select name='currency' type='text' id='currency'>";
  203. $currencycodes ="<option value='AUD'>AUD Australian Dollar</option>
  204. <option value='CAD'>CAD Canadian Dollar</option>
  205. <option value='CZK'>CZK Czech Koruna</option>
  206. <option value='DKK'>DKK Danish Krone</option>
  207. <option value='EUR'>EUR Euro</option>
  208. <option value='HKD'>HKD Hong Kong Dollar</option>
  209. <option value='HUF'>HUF Hungarian Forint</option>
  210. <option value='ILS'>ILS Israeli New Sheqel</option>
  211. <option value='JPY'>JPY Japanese Yen</option>
  212. <option value='MXN'>MXN Mexican Peso</option>
  213. <option value='NOK'>NOK Norwegian Krone</option>
  214. <option value='NZD'>NZD New Zealand Dollar</option>
  215. <option value='PHP'>PHP Philippine Peso</option>
  216. <option value='PLN'>PLN Polish Zloty</option>
  217. <option value='GBP'>GBP Pound Sterling</option>
  218. <option value='SGD'>SGD Singapore Dollar</option>
  219. <option value='SEK'>SEK Swedish Krona</option>
  220. <option value='CHF'>CHF Swiss Franc</option>
  221. <option value='TWD'>TWD Taiwan New Dollar</option>
  222. <option value='THB'>THB Thai Baht</option>
  223. <option value='USD'>USD U.S. Dollar</option>";
  224. $currencycodes = str_replace("'$currency'", "'$currency' selected", $currencycodes);
  225. echo $currencycodes;
  226.  
  227. $prices_str = implode(",", $prices);
  228. $ranks_str = implode(",", $ranks);
  229. $commands_str = implode(",", $commands);
  230. echo "</select>
  231. Your currency</p>Set to the currency donators will pay in, these are all functional with PayPal.
  232. <h2>Donation/Rank Configuration</h2>
  233. <p>Each item in the following lists align with each other, please keep them comma separated.</p>
  234. <p><input name='prices' type='text' id='prices' value='$prices_str' style='width: 300px;'>Prices</p> eg. 1,2,3,4 or 10,20,50,100 etc.
  235. <p><input name='ranks' type='text' id='ranks' value='$ranks_str' style='width: 300px;'>Ranks</p> These are the ULX groups which users are donating for. eg. bronze,silver,gold or rank1,rank2,rank3
  236. <p><input name='commands' type='text' id='commands' value='$commands_str' style='width: 300px;'>Commands</p> eg. ulx adduserid,ulx adduserid,ulx adduserid - currently PUDS only supports ulx adduser as a command for each rank.
  237. <h2>E-mail Messages Configuration</h2>
  238. <p>The e-mail section currently does not accept variables such as \$steamid, \$fee, \$rank. These must be put in without a backslash before the variable,directly into config.php
  239. <p><TEXTAREA name='messageRankFail' rows='10' cols='80'>$messageRankFail</TEXTAREA>Failed Rank E-mail</p>
  240. <p><TEXTAREA name='messageSuccess' rows='10' cols='80'>$messageSuccess</TEXTAREA>Successful E-mail</p>
  241. <p><TEXTAREA name='messageIPNFail' rows='10' cols='80'>$messageIPNFail</TEXTAREA>IPN Failed E-mail</p>
  242. <p>Click Save to write to the config file. Click Load to load the config for editing.</p>
  243. <input type='submit' name='Submit' value='Save'>
  244. <input type='button' value='Load' onClick='window.location.reload()'>
  245. </p>
  246. </form>";
  247. } else {
  248. if ($_SESSION['id']) {
  249. echo "<p>Hello, $friendlyName You are not admin! Please login as admin.
  250. <img src='$mAvatar'/>
  251. <a href='$donateDir/logout.php'>Logout</a>";
  252. }
  253. }
  254. ?>
  255. </body>
  256. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement