init
This commit is contained in:
315
chat/chat.php
Executable file
315
chat/chat.php
Executable file
@@ -0,0 +1,315 @@
|
||||
<?php session_start(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
html{
|
||||
overflow: scroll;
|
||||
overflow-x: hidden;
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
background-color: rgb(30,30,30);
|
||||
color: white;
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
width: 0px; /* Remove scrollbar space */
|
||||
background: transparent; /* Optional: just make scrollbar invisible */
|
||||
}
|
||||
code{
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
text-align: left;
|
||||
}
|
||||
.chat-box{
|
||||
position: relative;
|
||||
border: solid 4px black;
|
||||
top: 0vh;
|
||||
max-width: 60%;
|
||||
height: 72vh;
|
||||
overflow: scroll;
|
||||
padding: 5px;
|
||||
}
|
||||
.autost{
|
||||
color: white;
|
||||
background-color: green;
|
||||
padding: 4px;
|
||||
}
|
||||
.statusbox{
|
||||
position: absolute;
|
||||
border: solid 3px black;
|
||||
padding: 5px;
|
||||
top: 10%;
|
||||
left: 2%;
|
||||
font-size: 15px;
|
||||
}
|
||||
.hider{
|
||||
position: absolute;
|
||||
background-color: rgba(0,0,0,0.8);
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
display: none;
|
||||
}
|
||||
.pbox{
|
||||
color: white;
|
||||
width: 90%;
|
||||
height: 60vh;
|
||||
top: 30px;
|
||||
left: 30px;
|
||||
padding: 3%;
|
||||
position: relative;
|
||||
background-color: rgb(50,50,50);
|
||||
overflow: scroll;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.inner-chat-box{
|
||||
font-size: 15px;
|
||||
}
|
||||
.inner-chat-box-pfp{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
object-fit: cover;
|
||||
border-radius: 50px;
|
||||
}
|
||||
.inner-chat-box-wrap{
|
||||
position: relative;
|
||||
bottom: 20;
|
||||
}
|
||||
.inner-chat-box-a{
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<?php
|
||||
date_default_timezone_set('America/Los_Angeles');
|
||||
$set_logout_status=true;
|
||||
require_once("../login/login.php");
|
||||
if($login_correct=="true"&&$_SESSION['username']!="guest"){
|
||||
//set status
|
||||
$statusf=simplexml_load_file("status.xml");
|
||||
$file = fopen("status.xml","w");
|
||||
$userexist=false;
|
||||
for($i=0;$i<=count($statusf->user);$i++){
|
||||
if($statusf->user[$i]==$_SESSION['username']){
|
||||
$userexist=true;
|
||||
break;
|
||||
}
|
||||
if($userexist==true){break;}
|
||||
}
|
||||
$i=0;
|
||||
fwrite($file, '<?xml version="1.0" encoding="UTF-8"?>'."\n".'<status>'."\n");
|
||||
$wrote=false;
|
||||
foreach($statusf as $status){
|
||||
if(($statusf->user[$i]==$_SESSION['username'])||($userexist==false)){
|
||||
if($userexist==false){
|
||||
fwrite($file, ' <user time="'.$statusf->user[$i]['time'].'">'.$statusf->user[$i]."</user>\n");
|
||||
}
|
||||
if($wrote==false){fwrite($file, ' <user time="'.date("n/j/Y/H:i").'">'.$_SESSION['username']."</user>\n"); $wrote=true;}
|
||||
} else {
|
||||
fwrite($file, ' <user time="'.$statusf->user[$i]['time'].'">'.$statusf->user[$i]."</user>\n");
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fwrite($file, '</status>');
|
||||
fclose($file);
|
||||
}
|
||||
$xml=simplexml_load_file("../account_data/".$_SESSION['username'].".xml");
|
||||
$ban="false";
|
||||
for($i=count($xml->history->action);$i>=0;$i--){
|
||||
if(($xml->history->action[$i]['page']=="simplychat")&&($xml->history->action[$i]['type']=="ban")){
|
||||
$ban="true";
|
||||
$reason=strval($xml->history->action[$i]);
|
||||
break;
|
||||
}
|
||||
if($ban=="true"){break;}
|
||||
}
|
||||
?>
|
||||
<title>welcome <?php echo $_SESSION['username']; ?></title>
|
||||
<div align="center"><div id="error-message" style="display: none; text-align: center; background-color: red; width: 50%;"></div></div>
|
||||
<script language="javascript" type="text/javascript">
|
||||
if("<?php echo $_SESSION['errormsglogin']; ?>"!=""){
|
||||
$("#error-message").css("display","block");
|
||||
$("#error-message").html("<?php echo $_SESSION['errormsglogin']; ?>");
|
||||
}
|
||||
</script>
|
||||
<div align="center"><div align="center" id="chat" class="chat-box"></div></div>
|
||||
<a href="../index.html" style="text-decoration: none; color: white; size: 20px; border: 2px outset white; padding: 4px; position: absolute; top: 10px; left: 10px;">go home</a>
|
||||
<br>
|
||||
|
||||
|
||||
<form id="chatform" align="center" method="post" action="chatposter.php" target="_blank" >
|
||||
<textarea autocomplete="off" type="text" name="text" id="text" style="height: 50px; width: 50%; background-color: rgb(30,30,30); color: white; font-size: 15;" ></textarea>
|
||||
</form>
|
||||
|
||||
<div id="status" class="statusbox"></div>
|
||||
|
||||
<div align="center">
|
||||
<input autocomplete="off" id="autost" class="autost" type="button" onclick="autos()" value="toggle autoscroll" />
|
||||
<input autocomplete="off" class="autost" style="background-color: rgba(0,0,0,0);" type="button" onclick="show('rules')" value="show rules, commands, info" />
|
||||
<input autocomplete="off" class="autost" style="background-color: rgba(0,0,0,0);" type="button" onclick="cleartext()" value="clear text" />
|
||||
</div>
|
||||
|
||||
<div id="time" align="right" style="position: relative; float: right; width: 10vw; right:1vw; bottom: 3vh;"></div>
|
||||
<audio controls id="hardr" style="width: 0%; height: 0%;"><source src="hardr.wav" type="audio/mpeg"></audio>
|
||||
|
||||
<div style="position: absolute; right:20px; top: 40px; padding: 10px;">
|
||||
<a href="profile.php?username=<?php echo $_SESSION['username']; ?>" target="_blank">
|
||||
<img style="width:70px; height: 70px; border-radius: 70px; object-fit: cover;" src="<?php echo $_SESSION['profilepicture']; ?>" alt="../account_data/guest.png"></img>
|
||||
<div style="position: absolute; top: 30%; left: 7%; font-size: 15px; color: white; text-decoration: none; background-color: rgba(30,30,30,0.5);" align="center">logged in as<br><?php echo $_SESSION['username']; ?></div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<script language="javascript" type="text/javascript">username="<?php echo $_SESSION['username']; ?>"</script>
|
||||
<script src="../login/login.js" ></script>
|
||||
|
||||
<div id="rules" class="hider" onclick="hide('rules')"><div class="pbox" id="hidertext"></div></div>
|
||||
<div id="errorbox" class="hider" onclick="hide('errorbox')"><div class="pbox" id="errorboxtext"></div></div>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
if('<?php echo $ban; ?>' == 'true') {
|
||||
if(alert('you were banned by admin. reason: '+'<?php echo $reason; ?>')) {
|
||||
window.location.replace("../index.html");
|
||||
} else {
|
||||
window.location.replace("../index.html");
|
||||
}
|
||||
throw new Error('This is not an error. This is just to abort javascript');
|
||||
}
|
||||
//toggle auto scroll
|
||||
function autos(){
|
||||
switch(autoscroll){
|
||||
case true:
|
||||
autoscroll=false;
|
||||
$("#autost").css("background-color", "red");
|
||||
break;
|
||||
case false:
|
||||
autoscroll=true
|
||||
$("#autost").css("background-color", "green");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//post rule commands based on perms
|
||||
var pboxtext="because of my webhost TOS, NO 18+ CONTENT IS ALLOWED ON THIS CHAT<br>";
|
||||
if('<?php for($i=0;$i<=count($xml->permissions->perm);$i++){ if($xml->permissions->perm[$i]=="permission.simplychat.clear"){ echo $xml->permissions->perm[$i]; }} ?>'=="permission.simplychat.clear"){
|
||||
var pboxtext=pboxtext+
|
||||
"/clear --clears chat<br>";
|
||||
}
|
||||
if('<?php for($i=0;$i<=count($xml->permissions->perm);$i++){ if($xml->permissions->perm[$i]=="permission.simplychat.mute"){ echo $xml->permissions->perm[$i]; }} ?>'=="permission.simplychat.mute"){
|
||||
var pboxtext=pboxtext+
|
||||
"/mute,user,time(m minutes,h hours,d days),reason --mutes the user with the set amount of time, example"
|
||||
+" /mute,guest,1m,test<br>";
|
||||
}
|
||||
if('<?php for($i=0;$i<=count($xml->permissions->perm);$i++){ if($xml->permissions->perm[$i]=="permission.simplychat.ban"){ echo $xml->permissions->perm[$i]; }} ?>'=="permission.simplychat.ban"){
|
||||
var pboxtext=pboxtext+
|
||||
"/ban,user,reason --permanatly bans the user example /ban,guest,fwaggot<br>";
|
||||
}
|
||||
var pboxtext=pboxtext+'<br><br><a style="color: rgb(0,120,230);" target="blank" href="http://iceyfox.x10host.com/discord_rules.html">rules</a>'
|
||||
$("#hidertext").html(pboxtext);
|
||||
//hide and show
|
||||
function show(data){
|
||||
$("#"+data).css("display","block");
|
||||
}
|
||||
function hide(data){
|
||||
$("#"+data).css("display","none");
|
||||
}
|
||||
//clear text
|
||||
function cleartext(){
|
||||
$("#text").val("");
|
||||
}
|
||||
//read the fucking file
|
||||
var autoscroll=true;
|
||||
chatget('chat');
|
||||
chatget('status');
|
||||
chatloader();
|
||||
setInterval(chatloader,2000);
|
||||
function chatget(mode){
|
||||
if(mode=="chat"){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "chat.txt",
|
||||
cache: false,
|
||||
async: true,
|
||||
success: function chatreturn(data){
|
||||
$("#chat").html(data);
|
||||
loadedchat=data;
|
||||
}
|
||||
});}
|
||||
}
|
||||
function chatloader(){
|
||||
usaTime = new Date().toLocaleString("en-US", {timeZone: "America/Los_Angeles"});
|
||||
usaTime = new Date(usaTime);
|
||||
//read file
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "chat.txt",
|
||||
cache: false,
|
||||
async: true,
|
||||
success: function(data){
|
||||
if(data!=loadedchat){
|
||||
chatget('chat');
|
||||
}
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "status.xml",
|
||||
cache: false,
|
||||
async: true,
|
||||
dataType: "xml",
|
||||
success: function(xml){
|
||||
str="";
|
||||
datetime = (usaTime.getMonth()+1) + "/"
|
||||
+ usaTime.getDate() + "/"
|
||||
+ usaTime.getFullYear() + "/"
|
||||
+ usaTime.getHours() + ":"
|
||||
+ usaTime.getMinutes();
|
||||
$(xml).find('user').each(function(index){
|
||||
getTime=$(this).attr('time');
|
||||
if((getTime.split(":")[0].split("/")[3] != usaTime.getHours())||((getTime.split("/")[0]+getTime.split("/")[1]+getTime.split("/")[2]) != (datetime.split("/")[0]+datetime.split("/")[1]+datetime.split("/")[2]))){
|
||||
var status = "offline";
|
||||
var statuscolor = "gray";
|
||||
} else if((parseInt(getTime.split(":")[1])+3 < parseInt(usaTime.getMinutes()))||(parseInt(getTime.split(":")[0].split("/")[3]) != parseInt(datetime.split(":")[0].split("/")[3]) )){
|
||||
var status = "away";
|
||||
var statuscolor = "#E64C00";
|
||||
} else {
|
||||
var status = "online";
|
||||
var statuscolor = "rgb(0,200,50)";
|
||||
}
|
||||
str=str+($(this).text()+' <code style="background-color: '+statuscolor+';">'+status+'</code><br>time: '+getTime+"<br><br>");
|
||||
});
|
||||
$("#time").html("pst "+datetime);
|
||||
$("#status").html(str);
|
||||
}
|
||||
});
|
||||
//rest of loop shit
|
||||
if(autoscroll==true){
|
||||
var elem = document.getElementById('chat');
|
||||
elem.scrollTop = elem.scrollHeight;
|
||||
}
|
||||
}
|
||||
//run the text cheak stuff
|
||||
$("#text").keyup(function(event) {
|
||||
if (event.keyCode === 13 && !event.shiftKey) {
|
||||
$("#text").val($("#text").val().slice(0,-1));
|
||||
runtext();
|
||||
}
|
||||
});
|
||||
function runtext(){
|
||||
if(($("#text").val().toLowerCase().includes("nigger"))==true){
|
||||
document.getElementById('hardr').play();
|
||||
return false;
|
||||
} else if($("#text").val().length>2000){
|
||||
show('errorbox');
|
||||
$("#errorboxtext").html("your text can not be greater than 2000 characters<br>"+'<input autocomplete="off" class="autost" style="background-color: rgba(0,0,0,0);" type="button" onclick="cleartext()" value="clear text?" />');
|
||||
return false;
|
||||
} else {
|
||||
$("#chatform").submit();
|
||||
}
|
||||
$("#text").val('');
|
||||
}
|
||||
</script>
|
||||
<?php $_SESSION['errormsglogin']=""; ?>
|
||||
</body>
|
||||
</html>
|
||||
3
chat/chat.txt
Executable file
3
chat/chat.txt
Executable file
@@ -0,0 +1,3 @@
|
||||
<div style="font-size: 20; color: lightblue; text-decoration: underline;">Welcome To Simply Chatty</div><br><br><br><br>
|
||||
|
||||
|
||||
147
chat/chatposter.php
Executable file
147
chat/chatposter.php
Executable file
@@ -0,0 +1,147 @@
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
date_default_timezone_set("America/Los_Angeles");
|
||||
//set status
|
||||
if($_SESSION['username']!="guest"){
|
||||
$statusf=simplexml_load_file("status.xml");
|
||||
$file = fopen("status.xml","w");
|
||||
$userexist=false;
|
||||
for($i=0;$i<=count($statusf->user);$i++){
|
||||
if($statusf->user[$i]==$_SESSION['username']){
|
||||
$userexist=true;
|
||||
break;
|
||||
}
|
||||
if($userexist==true){break;}
|
||||
}
|
||||
$i=0;
|
||||
fwrite($file, '<?xml version="1.0" encoding="UTF-8"?>'."\n".'<status>'."\n");
|
||||
$wrote=false;
|
||||
foreach($statusf as $status){
|
||||
if(($statusf->user[$i]==$_SESSION['username'])||($userexist==false)){
|
||||
if($userexist==false){
|
||||
fwrite($file, ' <user time="'.$statusf->user[$i]['time'].'">'.$statusf->user[$i]."</user>\n");
|
||||
}
|
||||
if($wrote==false){fwrite($file, ' <user time="'.date("n/j/Y/H:i").'">'.$_SESSION['username']."</user>\n"); $wrote=true;}
|
||||
} else {
|
||||
fwrite($file, ' <user time="'.$statusf->user[$i]['time'].'">'.$statusf->user[$i]."</user>\n");
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
fwrite($file, '</status>');
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
//get users color
|
||||
if($_SESSION['username']!="guest"){
|
||||
$userxml=simplexml_load_file("../account_data/".$_SESSION['username'].".xml");
|
||||
$color=$userxml->color;
|
||||
} else {
|
||||
$color="#ffffff";
|
||||
}
|
||||
|
||||
//read file
|
||||
$get_chat_file=file_get_contents("chat.txt");
|
||||
//manage text eg image parsing and link parsing ect
|
||||
$usertext=str_replace(array("<",">"),"",$_POST['text']);
|
||||
$usertext_split=explode(" ",$usertext);
|
||||
$usertext="";
|
||||
foreach($usertext_split as $text){
|
||||
|
||||
if(substr($text,0,29)=="https://www.youtube.com/watch"){
|
||||
$text='
|
||||
|
||||
|
||||
<iframe width="500" height="300" src="https://www.youtube.com/embed/'.explode("&",explode("=",$text)[1])[0].'"></iframe>
|
||||
|
||||
';
|
||||
}
|
||||
elseif(substr($text,0,4)=="http"||substr($text,0,5)=="https"){
|
||||
if(strpos($text,".jpg")||strpos($text,".png")||strpos($text,".gif")){
|
||||
$text='
|
||||
|
||||
|
||||
<a href="'.$text.'" target="_BLANK"><img width="500px" src="'.$text.'"></img></a>
|
||||
|
||||
';
|
||||
} else {
|
||||
$text='<a href="'.$text.'" target="_BLANK">'.$text.'</a>';
|
||||
}
|
||||
}
|
||||
if($text=="nigger"){
|
||||
$text="ERROR. N**** TRIED TO BYPASS";
|
||||
}
|
||||
$usertext=$usertext.$text." ";
|
||||
}
|
||||
|
||||
//tags
|
||||
$tags="";
|
||||
if($_SESSION['username']=="iceyrazor"){
|
||||
$tags=$tags.'<code style="color: white; background-color: rgba(0,50,200,0.4); padding-left: 4px; padding-right: 4px;">site owner</code>';
|
||||
}
|
||||
$chatfile=fopen("chat.txt","w");
|
||||
$chat_file_send_content=$get_chat_file.'
|
||||
<div class="inner-chat-box">
|
||||
<a class="inner-chat-box-a" href="profile.php?username='.$_SESSION['username'].'" target="_blank">
|
||||
<img class="inner-chat-box-pfp" src="'.$_SESSION['profilepicture'].'" />
|
||||
</a>
|
||||
<code class="inner-chat-box-wrap">
|
||||
'.$tags.'
|
||||
<code style="color: '.$color.';">'.$_SESSION['username'].'</code>:
|
||||
<code style="padding-left: 5px; white-space: pre-line;"> '.$usertext.'</code>
|
||||
</code>
|
||||
</div>
|
||||
<br>
|
||||
';
|
||||
|
||||
//cheak perms and run commands
|
||||
$bot_tag='<code style="color: white; background-color: rgba(0,50,200,0.4); padding-left: 4px; padding-right: 4px;">site bot</code>';
|
||||
$perm_clear=false;
|
||||
$perm_mute_guest=false;
|
||||
$perm_mute=false;
|
||||
$perm_lock_chat=false;
|
||||
$perm_bypass_lock=false;
|
||||
foreach($userxml->permissions->perm as $perm){
|
||||
if($perm=="simplychatty.clear"){ $perm_clear=true; };
|
||||
if($perm=="simplychatty.mute-guest"){ $perm_mute_guest=true; };
|
||||
if($perm=="simplychatty.mute"){ $perm_mute=true; };
|
||||
if($perm=="simplychatty.lock-chat"){ $perm_lock_chat=true; };
|
||||
if($perm=="simplychatty.bypass-lock"){ $perm_bypass_lock=true; };
|
||||
}
|
||||
if($perm_clear==true&$usertext=="/clear "){
|
||||
$chat_file_send_content='
|
||||
<div style="font-size: 20; color: lightblue; text-decoration: underline;">
|
||||
Welcome To Simply Chatty
|
||||
</div><br><br><br><br>';
|
||||
}
|
||||
$chatstat=file_get_contents("chatstat.txt");
|
||||
if($perm_lock_chat==true&$usertext=="/lock chat "){
|
||||
$file_chatstat=fopen("chatstat.txt","w");
|
||||
if($chatstat=="locked"){
|
||||
$chat_file_send_content=$get_chat_file.'<div class="inner-chat-box">'.$bot_tag." ".
|
||||
$_SESSION['username'].' unlocked the chat </div><br>';
|
||||
fwrite($file_chatstat,"unlocked");
|
||||
} else {
|
||||
$chat_file_send_content=$get_chat_file.'<div class="inner-chat-box">'.$bot_tag." ".
|
||||
$_SESSION['username'].' locked the chat </div><br>';
|
||||
fwrite($file_chatstat,"locked");
|
||||
}
|
||||
fclose($file_chatstat);
|
||||
}
|
||||
if($perm_bypass_lock==false&$chatstat=="locked"){
|
||||
$chat_file_send_content=$get_chat_file."";
|
||||
}
|
||||
if(false==true){
|
||||
//unfinished mute
|
||||
$chat_file_send_content=$get_chat_file.'<div class="inner-chat-box">'.$bot_tag." ".
|
||||
$_SESSION['username']." muted ".$usertext_split[1].'</div><br>';
|
||||
}
|
||||
//
|
||||
fwrite($chatfile,$chat_file_send_content);
|
||||
fclose($chatfile);
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">window.close();</script>
|
||||
</body>
|
||||
</html>
|
||||
BIN
chat/hardr.wav
Executable file
BIN
chat/hardr.wav
Executable file
Binary file not shown.
213
chat/profile.php
Executable file
213
chat/profile.php
Executable file
@@ -0,0 +1,213 @@
|
||||
<?php session_start(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $_GET['username']; ?> profile</title>
|
||||
<style>
|
||||
html{
|
||||
background-color: rgb(30,30,30);
|
||||
color: white;
|
||||
}
|
||||
::-webkit-scrollbar {
|
||||
width: 0px; /* Remove scrollbar space */
|
||||
background: transparent; /* Optional: just make scrollbar invisible */
|
||||
}
|
||||
.editb, .saveb{
|
||||
display: none;
|
||||
font-size: 20px;
|
||||
}
|
||||
.saveb{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 60px;
|
||||
}
|
||||
.edituserform input{
|
||||
font-size: 20px;
|
||||
padding: 5px;
|
||||
background-color: rgb(30,30,30);
|
||||
color: white;
|
||||
border: inset 2px white;
|
||||
width: 50%;
|
||||
}
|
||||
.color{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: none;
|
||||
}
|
||||
td{
|
||||
border: solid 2px white;
|
||||
padding: 5px;
|
||||
font-size: 25px;
|
||||
}
|
||||
.notibox{
|
||||
background-color: rgb(0,120,0);
|
||||
padding: 5px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require_once("../../mysql_connect.php");
|
||||
$password=$_SESSION['password'];
|
||||
if($_SESSION['username']!="guest"){
|
||||
$stmt=$dbc->prepare("select username,password from ".$dbc_ver_accounts." where username=?");
|
||||
$stmt->execute([$_SESSION['username']]);
|
||||
$getuser=$stmt->fetch();
|
||||
if($getuser[0]==$_SESSION['username']){
|
||||
if(password_verify($_SESSION['password'],$getuser[1])){
|
||||
$pass="pass";
|
||||
}
|
||||
}
|
||||
}
|
||||
if($_GET['username']=="guest"){
|
||||
$pass="guest";
|
||||
} else {
|
||||
$stmt=$dbc->prepare("select username,discord,email from ".$dbc_ver_accounts." where username=?");
|
||||
$stmt->execute([$_GET['username']]);
|
||||
$getuser=$stmt->fetch();
|
||||
$get_username=$getuser[0];
|
||||
$get_discord=$getuser[1];
|
||||
$get_email=$getuser[2];
|
||||
if(file_exists("../account_data/".$_GET['username'].".xml")){
|
||||
$xml=simplexml_load_file("../account_data/".$_GET['username'].".xml");
|
||||
} else {
|
||||
$pass="not exist";
|
||||
}
|
||||
if(file_exists("../account_data/".$_GET['username'].".png")){
|
||||
$user_pfp="../account_data/".$_GET['username'].".png";
|
||||
} elseif(file_exists("../account_data/".$_GET['username'].".jpg")){
|
||||
$user_pfp="../account_data/".$_GET['username'].".jpg";
|
||||
} elseif(file_exists("../account_data/".$_GET['username'].".gif")){
|
||||
$user_pfp="../account_data/".$_GET['username'].".gif";
|
||||
} else {
|
||||
$user_pfp="../account_data/guest.png";
|
||||
}
|
||||
}
|
||||
//get history
|
||||
for($i=0;$i<count($xml->history->action);$i++){
|
||||
$gethistory[$i][0]=strval($xml->history->action[$i]);
|
||||
$gethistory[$i][1]=strval($xml->history->action['page'][$i]);
|
||||
$gethistory[$i][2]=strval($xml->history->action['type'][$i]);
|
||||
$gethistory[$i][3]=strval($xml->history->action['datetime'][$i]);
|
||||
$gethistory[$i][4]=strval($xml->history->action['attime'][$i]);
|
||||
}
|
||||
?>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!--run cheak-->
|
||||
<script language="javascript" type="text/javascript">
|
||||
if("<?php echo $pass; ?>"=="guest"){
|
||||
if(alert('guest can not view/edit profiles')) {
|
||||
window.close();
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
throw new Error('This is not an error. This is just to abort javascript');
|
||||
}
|
||||
if("<?php echo $pass; ?>"=="not exist"){
|
||||
if(alert('user does not exist')) {
|
||||
window.close();
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
window.close();
|
||||
throw new Error('This is not an error. This is just to abort javascript');
|
||||
}
|
||||
</script>
|
||||
<!--shown page-->
|
||||
<div id="notibox" class="notibox" align="center"></div>
|
||||
<div style="padding: 20px; position: absolute; left: 15%; border: solid 2px black; width: 70vw; height: 70vh;">
|
||||
<div style="position: absolute;">
|
||||
<img onmouseover="show('editprofilebox')" style="height: 100px; width: 100px; object-fit: cover; border-radius: 100px;" src="<?php echo $user_pfp; ?>"></img>
|
||||
<div onmouseout="hide('editprofilebox')" style="display: none; position: absolute; top: 0px; bottom: 0px; right: 0px; left: 0px; border-radius: 100px; background-color: rgba(0,0,0,0.6);" id="editprofilebox">
|
||||
<form style="position: absolute; top: 30px; left: 10px;" action="profile_update.php" method="post" enctype="multipart/form-data" target="_blank" onsubmit="setTimeout(() => { location.reload(); }, 1000);">
|
||||
<input autocomplete="off" type="file" name="pfp_picture" /><br>
|
||||
<input autocomplete="off" type="submit" name="pfp_change" value="change" /><br>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="edituserform" style="position: absolute; left: 140px; padding: 4px; font-size: 25px; right: 10px">
|
||||
<div style="padding: 5px;">username: <span id="username"><?php echo $get_username; ?></span></div>
|
||||
<div style="padding: 5px;">discord: <span id="discord"><?php echo $get_discord ?></span></div>
|
||||
<div style="padding: 5px;">email: <span id="email"><?php echo $get_email ?></span></div>
|
||||
<div style="padding: 5px;">color:
|
||||
<span id="color"><span style="padding: 3px"></span><span style="padding: 10px; padding-top: 1px; padding-bottom: 1px; background-color: <?php echo $xml->color; ?>;"></span> </span></div>
|
||||
</div>
|
||||
<div align="Center" style="position: absolute; padding: 5px; max-height: 30%; overflow: scroll; bottom: 50px; left: 23%; right: 23%; border: solid 2px white;">
|
||||
history<br>
|
||||
<p>m=minute, h=hour, d=day</p>
|
||||
<table align="Center">
|
||||
<tr style="background-color: rgb(180,20,0);">
|
||||
<td>page</td><td>date</td><td>type</td><td>for</td><td>reason</td></tr>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var gethistory=JSON.parse('<?php echo json_encode($gethistory); ?>');
|
||||
for(var i=0; i<=(gethistory.length)-1; i++){
|
||||
document.write("<td>"+gethistory[i][1]+"</td>");
|
||||
document.write("<td>"+gethistory[i][3]+"</td>");
|
||||
document.write("<td>"+gethistory[i][2]+"</td>");
|
||||
document.write("<td>"+gethistory[i][4]+"</td>");
|
||||
document.write("<td>"+gethistory[i][0]+"</td>");
|
||||
document.write("</tr>");
|
||||
}
|
||||
</script>
|
||||
</table>
|
||||
</div>
|
||||
<div style="position: absolute; bottom: 10px; left: 43%;" align="center">
|
||||
<button class="editb" id="editbutton" onclick="editm()" >edit</button>
|
||||
<button class="saveb" id="savebutton" onclick="save()" >save</button>
|
||||
</div>
|
||||
</div>
|
||||
<!--hidden form-->
|
||||
<form style="display: none" id="editform" action="poster.php" method="get" target="_blank">
|
||||
<input autocomplete="off" type="hidden" name="doing" value="edituser" />
|
||||
<input autocomplete="off" type="hidden" name="discord" id="discordF" />
|
||||
<input autocomplete="off" type="hidden" name="email" id="emailF" />
|
||||
<input autocomplete="off" type="hidden" name="color" id="colorF" />
|
||||
</form>
|
||||
<!--functions and shit-->
|
||||
<script language="javascript" type="text/javascript">
|
||||
//notification
|
||||
if("<?php echo $_SESSION['message']; ?>"=="file uploaded"){
|
||||
$("#notibox").html("profile changed!");
|
||||
$("#notibox").css("display","block");
|
||||
setTimeout(function(){ $("#notibox").css("display","none"); },4000)
|
||||
} else if("<?php echo $_SESSION['message']; ?>"!=""){
|
||||
$("#notibox").html("<?php echo $_SESSION['message'] ?>");
|
||||
$("#notibox").css("background-color","rgb(180,0,0)");
|
||||
$("#notibox").css("display","block");
|
||||
}
|
||||
|
||||
//functions
|
||||
if("<?php echo $pass; ?>"=="null"){
|
||||
$("#editbutton").css("display","block");
|
||||
}
|
||||
function editm(){
|
||||
$("#savebutton").css("display","block");
|
||||
$("#discord").html('<input autocomplete="off" type="text" id="discordi" value="<?php echo $xml->discord; ?>" />');
|
||||
$("#email").html('<input autocomplete="off" type="email" id="emaili" value="<?php echo $xml->email; ?>" />');
|
||||
$("#color").html('<input class="color" autocomplete="off" type="color" id="colori" value="<?php echo $xml->color; ?>"/>');
|
||||
}
|
||||
function save(){
|
||||
$("#discordF").val($("#discordi").val());
|
||||
$("#emailF").val($("#emaili").val());
|
||||
$("#colorF").val($("#colori").val());
|
||||
$("#editform").submit();
|
||||
setTimeout(() => { location.reload(); }, 500);
|
||||
}
|
||||
function show(idd){
|
||||
if((idd=="editprofilebox")){
|
||||
if(("<?php echo $pass; ?>"!="!edit")){
|
||||
$("#"+idd).css("display","block");
|
||||
}
|
||||
} else {
|
||||
$("#"+idd).css("display","block");
|
||||
}
|
||||
}
|
||||
function hide(idd){
|
||||
$("#"+idd).css("display","none");
|
||||
}
|
||||
</script>
|
||||
<?php $_SESSION['message']=""; ?>
|
||||
</body>
|
||||
</html>
|
||||
33
chat/profile_update.php
Executable file
33
chat/profile_update.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
require_once("../login/login.php");
|
||||
if($login_correct=="true"){
|
||||
if(isset($_POST['pfp_change'])){
|
||||
$file_type = strtolower(pathinfo($_FILES["pfp_picture"]["name"],PATHINFO_EXTENSION));
|
||||
if($file_type=="png"||$file_type=="jpg"||$file_type=="gif"){
|
||||
if($_FILES["pfp_picture"]["size"] < 3000000){
|
||||
unlink("../account_data/".$_SESSION['username'].".png");
|
||||
unlink("../account_data/".$_SESSION['username'].".jpg");
|
||||
unlink("../account_data/".$_SESSION['username'].".gif");
|
||||
if(move_uploaded_file($_FILES["pfp_picture"]["tmp_name"], "../account_data/".$_SESSION['username'].".".$file_type)) {
|
||||
$_SESSION['message']="file uploaded";
|
||||
} else {
|
||||
$_SESSION['message']="there was a error uploading your file";
|
||||
}
|
||||
} else {
|
||||
$_SESSION['message']="file is too big, must be less than 5mb";
|
||||
}
|
||||
} else {
|
||||
$_SESSION['message']="file is not a image or gif, try again";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo $_SESSION['message']="error. you cant edit a profile that isn't yours. nice try";
|
||||
}
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">window.close();</script>
|
||||
</body>
|
||||
</html>
|
||||
4
chat/status.xml
Executable file
4
chat/status.xml
Executable file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<status>
|
||||
<user time="offline">iceyrazor</user>
|
||||
</status>
|
||||
Reference in New Issue
Block a user