Jump to content

FatesCall

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by FatesCall

  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,
  15. I also keep getting this: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at ...\panel.php:1) in ...\panel.php on line 2
  16. So on this I would just replace line 42? I'm confused on the assigning, could you apply it to my code so I can see why it should be that way? I see a little bit of it, I just don't know how to place it in my code.
  17. 1. I clicked submit and the page was endlessly loading so I clicked it again which posted it multiple times 2. I'm not even sure what works 3. I'm not sure how to use the sessions/how to create them. 4. I'm asking how to use/create the sessions
  18. So I was searching around and I found out about PHP Sessions, I am new to PHP coding and I have tried to google it but its to no avail, I'm probably doing something wrong or I'm just dumb but heres the code. Index ( Login page ): <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Login</title> <style> @import "css/login.css"; </style> </head> <body> <div class="body"></div> <div class="grad"></div> <div class="header"> <div><b>User<span>Login</span></b></div> </div> <br> <form method="post" id="login-form" name="login-form" action="panel.php"><div class="login"> <input type="text" placeholder="username" name="user" required><br> <input type="password" placeholder="password" name="password" required><br> <input type="submit" name="login" id="login" value="login" /> </div></form> <div class="forgotpw"><span title="You will need your account email!"><a href="recover.php" class ="b">Forgot Password?</a></span></div> <?php /* Temporary until my database is finished */ $users = array( "User1" => "123", "User2" => "1234", "User3" => "1235" ); $user = null; $password = null; if(isset($_POST['user']) && trim($_POST['user']) !=''){ $user = trim($_POST['user']); } if(isset($_POST['password']) && trim($_POST['password']) !=''){ $password = trim($_POST['password']); } if($user && $password) { if(array_key_exists($user, $users)) { if($password == $users[$user]) { echo "<div class="."success".">Successful. Redirecting you in 3 seconds.</div>"; echo "<meta http-equiv="."refresh"." content="."3;URL=panel.php".">"; } else { echo "<div class="."warning".">Error: Username or Password is incorrect!</div>"; } } else { echo "<div class="."warning".">Error: Username or Password is incorrect!</div>"; } } ?> </body> </html> Panel.php: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Admin Panel</title> <style> @import "css/panel.css"; </style> </head> <body> </body> </html>
  19. Can you explain this statement a little bit more, like how I should set the SQL Table up. (Mostly the ":user LIMIT 1" part, I understand the rest) $sql = 'SELECT password FROM user WHERE username = :user LIMIT 1'; and a little on creating the Key for hashing?
  20. okay so this is my problem <div class="login"> <input type="text" placeholder="username" name="user"><br> <input type="password" placeholder="password" name="password"><br> <input type="button" value="Login"> </div> How would I take the Username and Password from that and verify them through a sql database, I just don't know how to pull the info when the user clicks the button
  21. I don't learn well from books or online, I like talking to real people.
  22. Hi, I need help with scripting a PHP/HTML/CSS website login panel and I am very new to coding PHP and I tried using websites but I prefer talking to people who know what they are doing so I can ask very specific questions, there would be no pay involved but if you could help me out, It would be greatly appreciated. (:
×
×
  • 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.