<?php session_start(); include dirname(__FILE__) . "/smarty.php"; include dirname(__FILE__) . "/db/db_connection.php"; if (isset($_SESSION['username']) && !empty($_SESSION['username'])) { $subject = $_POST['subject']; $content = $_POST['content']; $course_id = $_SESSION['course_id']; $publisher = $_SESSION['userid']; doDB(); $sql_subject = "insert into subject(name, content, publisher, course_id, date_added, date_modified) values('" . $subject . "', '" . $content . "', '" . $publisher . "', '" . $course_id . "', now(), now())"; $result = $mysqli->query($sql_subject); if ($result) { header("Location: forum_subject_display.php?id={$course_id}"); } } else { echo "未登录,点击<a href='login.html'>返回</a>,重新登录"; }
<?php /* This is where the magic happens. Schweet! Author: brownzilla Author URL: https://brownzilla.me Version: 0.1 */ include 'default.php'; $db = doDB(); $response = "Toontown Online Launcher API. https://github.com/brownzilla/toontown-online-patcher/"; // I would greatly appreciate it if you didn't change this. :^) $salt = grabSalt(); // This is used to add extra protection to your logins. // Server Accessibility. $isTest = 0; $isClosed = 0; // Where the server gets the data. e.g https://example.com/api/login/?u=demo&p=demo $usr = $_GET['n']; // Unfortunately, I'm unable to change these. They're in the latest build of the launcher. $pwd = $_GET['p']; $spwd = $salt . $pwd; // Combinding the salt and pwd together. $ip = $_SERVER['REMOTE_ADDR']; // This is where the DB is queried. $sql = "SELECT * FROM Users WHERE Username='******'"; $stmt = $db->query($sql); // Finally, the IF statement. Only edit if you know what's happening. if ($stmt->num_rows < 1) { $response = "LOGIN_ACTION=LOGIN\nLOGIN_ERROR=LOGIN_FAILED\nGLOBAL_DISPLAYTEXT=Unable to retrieve account " . $usr . ".\n"; // Checking to see if the account exists.