swish Posted March 10, 2009 Share Posted March 10, 2009 How would you go about inserting into mysql (remote server) with some the the tcadmin variables (IP, Port, ect) using the install/uninstall scripts? I have tried a few things and cant seem to get it to work... LFA...work your magic lol Link to comment Share on other sites More sharing options...
jcroom Posted March 10, 2009 Share Posted March 10, 2009 What are you trying to do exactly? I don't think just insterting stuff info the tcadmin DB would be a good choice. Link to comment Share on other sites More sharing options...
swish Posted March 10, 2009 Author Share Posted March 10, 2009 Its not inserting into the tcadmin database...its a different database. Link to comment Share on other sites More sharing options...
jcroom Posted March 10, 2009 Share Posted March 10, 2009 Ah - ok. Sorry I misread the post. I'm not sure off the top of my head but when I get back to my own computer, I will certainly look into it (I could use this for some of my own projects ). Link to comment Share on other sites More sharing options...
swish Posted March 10, 2009 Author Share Posted March 10, 2009 Sounds good...ill keep trying some ideas I have and check this thread in a bit Link to comment Share on other sites More sharing options...
maddanny Posted March 10, 2009 Share Posted March 10, 2009 you have to create a script (php, vb, .net, ...) that make this for you. and use install/uninstall scripts to call it that's we're using and it's working very fine Link to comment Share on other sites More sharing options...
swish Posted March 10, 2009 Author Share Posted March 10, 2009 I understand that part completely...I just can figure out what to write i nthe script to make it work. Perhaps you could share your code? staff@clanbaselive.com or ill check here thanks Link to comment Share on other sites More sharing options...
jcroom Posted March 10, 2009 Share Posted March 10, 2009 swish add me on MSN and I will help you with this Link to comment Share on other sites More sharing options...
maddanny Posted March 11, 2009 Share Posted March 11, 2009 It's easy: you have to use $argv & $argc vars in php $argc is command line arguments count and $argv is an array with values. so if you run your script in install/uninstall like this: {php path}\php.exe {script path}\myscript.php %serverip% %serverport% you'll got $argv like this: Array ( [0] => myscript.php [1] => %serverip% [2] => %serverport% ) Of course, it's better to make something better, like: script.php -serverip=%serverip% -serverport=%serverport% but you'll have to handle this by hand or use a framework Link to comment Share on other sites More sharing options...
swish Posted March 11, 2009 Author Share Posted March 11, 2009 swish add me on MSN and I will help you with this I added you on MSN. importx03@hotmail.com is mine Link to comment Share on other sites More sharing options...
jcroom Posted March 13, 2009 Share Posted March 13, 2009 Alright folks, over the past few days I have been helping swish get TCAdmin integrated with LGSL. I am happy to announce that we have done it! Here are the scripts that we wrote for it: First off, in the install script for the paticular game put this: start C:\iexplore.exe "http://www.yoursite.com/tcalgsl.php?ip=%serverip%&port=%serverport%" ping google.com taskkill -im iexplore.exe The reason we are using Internet Explorer instead of PHP to run the script is because you would need to install PHP on everyone of your remote servers to run it. The reason we put a ping in there was so that it will take a while before it killed the task (Ghetto I know, if you know of a better way, post it.) (Obviously you need to change C:\iexplorer.exe to the actual location ) And here is the php script that you will need to put on your website. tcalgsl.php: <?php $con = mysql_connect("localhost","USER","PASS"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DATABASE", $con); //end connection string //Define the variables $ip = $_GET['ip']; $port = $_GET['port']; //START THE QUERY USING THE VARIABLES mysql_query(”INSERT INTO `lgsl` (`id`, `status`, `ip`, `q_port`, `c_port`, `s_port`, `type`, `cache`, `cache_time`, `zone`, `disabled`) VALUES (”, ‘0′, ‘$ip’, ‘$port’, ‘$port’, ‘0′, ‘halo’, ”, ”, ‘0′, ‘0′)”); mysql_close($con); ?> You could take this code and change the game name and add it for every game if you wanted to. As always, have fun! Link to comment Share on other sites More sharing options...
swish Posted March 13, 2009 Author Share Posted March 13, 2009 It took a bit of work but yes! it works very nice! Many thanks to jcroom for helping with the framework while we tested it. How this helps all out there. Link to comment Share on other sites More sharing options...
swish Posted March 13, 2009 Author Share Posted March 13, 2009 TO change it a bit to include the proper info here with proper query port and such here ya go <?php // make sure you only run this query from the install/uninstall scripts otherwise it will insert random info into your db //connect to your remote DB first... $con = mysql_connect("localhost","USERNAME","PASSWORD"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DATABASE_NAME", $con); //end connection string //Define the variables $ip = $_GET['ip']; $port = $_GET['port']; $qport = $_GET['qport']; //START THE QUERY USING THE VARIABLES mysql_query("INSERT INTO `lgsl` (`id`, `status`, `ip`, `q_port`, `c_port`, `s_port`, `type`, `cache`, `cache_time`, `zone`, `disabled`) VALUES ('', '1', '$ip', '$qport', '$port', '0', 'GAMETYPE_HERE', '', '', '0', '0')"); mysql_close($con); ?> start C:\iexplore.exe "http://www.yoursite.com/tcalgsl.php?ip=%serverip%&qport=%queryport%&port=%serverport%" ping google.com taskkill -im iexplore.exe Link to comment Share on other sites More sharing options...
ECF Posted March 13, 2009 Share Posted March 13, 2009 The pause command won't work instead of pinging google? start C:\iexplore.exe "http://www.yoursite.com/tcalgsl.php?ip=%serverip%&qport=%queryport%&port=%serverport%" pause pause taskkill -im iexplore.exe Link to comment Share on other sites More sharing options...
jcroom Posted March 13, 2009 Share Posted March 13, 2009 Wouldnt that just ask for a users input? Press any key to continue . . . Link to comment Share on other sites More sharing options...
ECF Posted March 13, 2009 Share Posted March 13, 2009 You may be right. I know it works in a batch file, but not sure of the script file. Link to comment Share on other sites More sharing options...
swish Posted March 13, 2009 Author Share Posted March 13, 2009 That exactly what we tried....it just pauses and does not close the IE window it opens...so we went ahead and did a quick ping. Link to comment Share on other sites More sharing options...
ECF Posted March 13, 2009 Share Posted March 13, 2009 Did you try wait? Link to comment Share on other sites More sharing options...
maddanny Posted March 13, 2009 Share Posted March 13, 2009 Or install Windows Server 2003 Resource Kit Tools and you'll can use sleep command Link to comment Share on other sites More sharing options...
jcroom Posted March 14, 2009 Share Posted March 14, 2009 'wait' is not recognized as an internal or external command operable program or batch file. @ W2K3 resource kit : that would would be a pain in the ass to install on all of your remote servers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.