Call this v1.2.0

master
Pentium44 2020-12-09 22:17:19 -08:00
parent 2d98141294
commit 8047729e93
3 changed files with 38 additions and 9 deletions

View File

@ -14,6 +14,12 @@ anything like that. This is in working condition!
* Use it!
#### Changelog
* v1.2.0:
* Added /help command for client usage
* Added /nick, and /list commands
* Added another session variable for nick name changes
* Should be rather stable as it sits, need to clean up CSS a bit more
* v1.1.0:
* Added alias' for /focus (/query, /switch)
* General cleanup.

View File

@ -62,6 +62,7 @@ if (isset($_GET['register']) && $_GET['register'] == "go") {
$servport = isset($_POST['servport']) && ($_POST['servport'] !== "") ? htmlentities(stripslashes($_POST['servport'])) : $port;
file_put_contents("users/$username.php", "<?php \$userpass = '" . $password . "'; ?>\n");
$_SESSION['idleirc-user'] = $username;
$_SESSION['idleirc-nick'] = $username;
$_SESSION['idleirc-pass'] = $password;
$_SESSION['idleirc-channel'] = $channame;
$_SESSION['idleirc-servaddr'] = $servaddr;
@ -85,6 +86,7 @@ if (isset($_GET['do']) && $_GET['do']=="login" && isset($_POST['submitBtn']) &&
include("users/$name.php");
if(md5($_POST['password']) == $userpass) {
$_SESSION['idleirc-user'] = $name;
$_SESSION['idleirc-nick'] = $name;
$_SESSION['idleirc-pass'] = $userpass;
$_SESSION['idleirc-channel'] = $channame;
$_SESSION['idleirc-servaddr'] = $servaddr;

View File

@ -18,6 +18,8 @@ if(isset($_GET['msg'])) {
doLog("Msg information: " . trim($_GET['msg']));
}
$username = $_SESSION['idleirc-user'];
$usernick = $_SESSION['idleirc-nick'];
$acctpass = $_SESSION['idleirc-pass'];
$channel = $_SESSION['idleirc-channel'];
$servaddr = $_SESSION['idleirc-servaddr'];
@ -25,7 +27,7 @@ $servport = $_SESSION['idleirc-servport'];
// If we have a message; grab user and content and push to IRC client
if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['nick']!=""){
$nick = stripslashes(htmlentities($_GET['nick'])); // Usernick
$nick = $usernick; // Usernick
$msg = urldecode(stripslashes(trim($_GET['msg']))); // User message content
$line = ""; // start with nothing
$logline = ""; // start with nothing
@ -70,10 +72,23 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
$line .= "\x01\n";
} else if ($cmd[0]=="/join") {
doLog("$username: joining " . $cmd[1]);
$line .= "JOIN" . " " . trim($cmd[1]) . "\n"; // set for push
$line .= "JOIN " . trim($cmd[1]) . "\n"; // set for push
//$logline .= "<tr><td class='userinfo'><b>$nick</b>:</td><td>Joining " . $cmd[1] . "</td></tr>\n"; // push to client
$_SESSION['idleirc-channel'] = trim($cmd[1]);
} else if ($cmd[0] == "/rejoin") {
} else if ($cmd[0]=="/nick") {
if($cmd[1]!="") {
doLog("$username: setting nick to " . $cmd[1]);
$line .= "NICK " . trim($cmd[1]) . "\n"; // set for push
//$logline .= "<tr><td class='userinfo'><b>$nick</b>:</td><td>Joining " . $cmd[1] . "</td></tr>\n"; // push to client
$_SESSION['idleirc-nick'] = trim($cmd[1]);
}
} else if ($cmd[0]=="/list") {
if($cmd[1]!="") {
doLog("$username: listing users for " . $cmd[1]);
$line .= "NAMES " . trim($cmd[1]) . "\n"; // set for push
//$logline .= "<tr><td class='userinfo'><b>$nick</b>:</td><td>Joining " . $cmd[1] . "</td></tr>\n"; // push to client
}
} else if ($cmd[0] == "/rejoin") {
doLog("$username: rejoining channel");
if ($cmd[1] != "") {
$line .= "PART " . trim($cmd[1]) . " :$username leaving...\n"; // push close command to IRC
@ -96,12 +111,18 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
} else if ($cmd[0] == "/focus" || $cmd[0] == "/switch" || $cmd[0] == "/query") {
if(trim($cmd[1]) != $channel) {
$_SESSION['idleirc-channel'] = trim($cmd[1]);
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</b>: </td><td>" . trim($cmd[1]) . " is focused, all messages will be sent to " . trim($cmd[1]) . "</td></tr>\n"; // push to client
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span>: </td><td>" . trim($cmd[1]) . " is focused, all messages will be sent to " . trim($cmd[1]) . "</td></tr>\n"; // push to client
} else {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</b>: </td><td>You're already focused on $channel</td></tr>\n";
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</span>: </td><td>You're already focused on $channel</td></tr>\n";
}
} else if ($cmd[0] == "/help" || $cmd[0] == "/?") {
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</b>: HELP: Information about $title<br />/join [channel] : Join IRC channel [channel]<br />/focus [channel|user]: Funnel messages to specific channel or user (Alias: /switch; /query)<br />/part (channel): Part channel, part focused channel if none specified<br />/rejoin (channel): Part, and join a channel; focused channel if none is specified</td><td></td></tr>\n";
$logline .= "<tr><td class='userinfo'><span style='color:$ipcolor;'>$title $version</b></td>";
$logline .= "<td>HELP: Information about $title<br />/join [channel] : Join IRC channel [channel]<br />";
$logline .= "/focus [channel|user]: Funnel messages to specific channel or user (Alias: /switch; /query)<br />";
$logline .= "/part (channel): Part channel, part focused channel if none specified<br />";
$logline .= "/rejoin (channel): Part, and join a channel; focused channel if none is specified<br />";
$logline .= "/nick [nickname]: Change your nickname<br />";
$logline .= "/list [channel]: List users in a channel</td></tr>\n";
} else {
// @@ This is a work in progress
// Sends every channel message to each channel :[
@ -110,12 +131,12 @@ if (isset($_GET['msg']) && $_GET['msg']!="" && isset($_GET['nick']) && $_GET['ni
}
// Get original content
$content = file_get_contents("$nick.log");
$content = file_get_contents("$username.log");
echo "<table>" . nl2br(stripslashes($content)) . "</table>";
// Grab all contents, and push to socket output file.
file_put_contents("$nick.log", $content . $logline);
file_put_contents("$username.log", $content . $logline);
// Grab user message and push to IRC client
file_put_contents(".$nick.push", $line);
file_put_contents(".$username.push", $line);
// Throw out your user message
//echo nl2br(stripslashes($line));
// DONE