Jump to content

FatesCall

Members
  • Posts

    27
  • Joined

  • Last visited

FatesCall's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'm having a lot of problems using this API (mainly due to the poor documentation), but if anyone knows this api and knows how to get the online users in a specific server group, that would be helpful! Sorry for so many newb questions and things but I don't know any php coders
  2. I feel like I'm such a noob on these forums because I'm asking so many simple questions.
  3. So I'm trying to submit the name of a teamspeak 3 channel and the one word channels work fine with using $_POST['channel'] but if the string is two words (separated by a space) then it only uses the first word of the string Form.php: <form name="kick" method="POST" action="kick.php"> <select name="channel" id="channel"> <option value="default" name="default" selected>Choose One</option> <?php require_once("Teamspeak3/libraries/TeamSpeak3/TeamSpeak3.php"); $ts3_VirtualServer = TeamSpeak3::factory("serverquery://<username redacted>:<password redacted> @localhost:10011/?server_port=9987"); foreach ($ts3_VirtualServer->channelList() as $ts3_Channel) { echo "<option value=" . $ts3_Channel["channel_name"] . ">" . $ts3_Channel["channel_name"] . "</option>"; } ?> </select> <input type="submit" name="Kick Players"/> </form> Kick.php: <?php session_start(); define('MYSITE', $_SERVER['SERVER_NAME'] . ":8000"); //define what our site is. if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['channel'] == "default") { header('Location: http://' . MYSITE . '/panel_error.php?reason=default'); exit(); } else { $clients = array(); require_once("Teamspeak3/libraries/TeamSpeak3/TeamSpeak3.php"); $ts3_VirtualServer = TeamSpeak3::factory("serverquery://<username redacted>:<password redacted> @localhost:10011/?server_port=9987"); $channel = $ts3_VirtualServer->channelGetByName($_POST['channel']); foreach($ts3_VirtualServer->clientList() as $client) { if($client['cid'] == $channel->getId()) { $clients[$client->getId()] = $client; } } if(empty($clients)) { header('Location: http://' . MYSITE . '/panel_error.php?reason=noclients'); exit(); } $ts3_VirtualServer->clientKick($clients, TeamSpeak3::KICK_SERVER, "You have been kicked from the server!"); header('Location: http://' . MYSITE . '/panel.php'); exit(); } } EXAMPLE OF PROBLEM: In the drop down list I choose 'Admin Room'. I submit and when I run: $channel = $ts3_VirtualServer->channelGetByName($_POST['channel']); it runs as: $channel = $ts3_VirtualServer->channelGetByName('Admin'); instead of: $channel = $ts3_VirtualServer->channelGetByName('Admin Room'); THE ERROR: C:\path\to\project\kick.php(11): TeamSpeak3_Node_Server->channelGetByName('Admin'); //results in below Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'invalid channelID'
  4. Sorry for posting so much this is probably going to be my last post. I have my sessions working and pages restricted now thanks to you guys but I have a few more questions. 1) How would I make it to where if the user is inactive for longer than 30 minutes it logs them out and forces them to log in again? 2) In my logout php I would just use exit() and session_destroy(), correct? EDIT: So I wrote this but I'm not sure if it will work: if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) { session_unset(); session_destroy(); } $_SESSION['LAST_ACTIVITY'] = time(); // Call this every time a user submits/clicks on something
  5. Although, is there a way to force them to log in every time instead of the auto login? EDIT: and also to prevent people from directly going to www.mysite.com/panel.php and getting in
  6. THANK YOU SO MUCH IT WORKS PERFECTLY LIKE I WANT IT TOO :D :D
  7. Okay so I have that worked out now how do I make it work with session timeouts and things of that nature?
  8. I think there is something wrong in the code checking the username/password because I can use any combination with the password 123 to get in. EDIT: http://hastebin.com/ehihuqojam.php <--- Login PHP
  9. Could this also be fixed by using the action="login-response.php" in the form and creating its own php form for the validation?
  10. http://hastebin.com/ijucoqetus.php <--- Still throwing the error invalid logins
  11. Still results in the warning being shown as soon as I run the webpage
  12. ok ill post the code as soon as i wake up tomorrow EDIT: index.php: http://hastebin.com/fisodifino.php
  13. Its the same but i added in the new code and remove "action=panel.php" from the form
  14. Everytime I load this, it reads it sends the Warning html without even inputting anything,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.