Location: PHPKode > projects > Psichat > psichat/chat/admin/eingabe.php
<?php
if(($user = $HTTP_POST_VARS['user']) == "") $user = $HTTP_GET_VARS['user'];
if(($pass = $HTTP_POST_VARS['pass']) == "") $pass = $HTTP_GET_VARS['pass'];
$user = strtolower($user);

include("varinfo.php");
include("../../lib.php");

if($user != "")
{
	$anzadm = getslot('../../'.$varver.'chat/ca/li', 0, 0);
	$alladm = getslot('../../'.$varver.'chat/ca/li', 1, $anzadm+1);

	for($i = 0; $i < $anzadm; $i++)
	{
		if($user == $alladm[$i] && $pass == getslot('../../'.$varver.'chat/'.strtolower($user), 4, 4))
		{
			$neuwert = "";
			$neuwert[0] = date("U");
			$neuwert[1] = $sid = (rand(1000, 9999)*10000+rand(1000, 9999));
			$neuwert[2] = getenv("REMOTE_ADDR");
			putslot('../../'.$varver.'chat/ca/'.strtolower($user), 0, $neuwert);
			$modus = 1;
		}
	}
	if($modus != 1)
		$modus = 2;

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>PsiChat Adminkonsole</title>


<script type="text/javascript"><!--
var 
histList = [""], 
histPos = 0, 
passmod = 0,
_scope = {}, 
_win, // a top-level context
question;

	var x;
	if(document.ids)x="nc4";
	else if( document.all && !document.getElementById )x="ie4";
	else if( window.opera && !document.createElement )x="op5";
	else if( window.opera && window.getComputedStyle )
	{
		if(window.navigate)x="op7.5";
		else x="op7.2";
	}
	else if( window.opera && document.compatMode )x="op7";
	else if( window.opera && document.releaseEvents )x="op6";
	else if( document.contains && !window.opera )x="kq3";
	else if( window.getSelection && window.atob )x="nn7";
	else if( window.getSelection && !document.compatMode )x="nn6";
	else if( window.clipboardData && document.compatMode )x="ie6";
	else if( window.clipboardData )
	{
		x="ie5";
		if( !document.createDocumentFragment ) x+=".5";
		if( document.doctype && !window.print ) x+="m";
	}
	else if( document.getElementById && !document.all ) x="op4";
	else if( document.images && !document.all ) x="nn3";
	else x="???";
	if(navigator.appName == "Microsoft Internet Explorer" && !(x == "op5" || x == "op7.5" || x == "op7.2" || x == "op7"|| x == "op6"))
		alert("Warnung: Die Admin-Konsole ist nicht mit dem Internet Explorer kompatibel. Ein Login wird daher nicht möglich sein. Die Admin-Konsole ist optimiert für Mozilla/Netscape, du kannst aber auch die meisten anderen javascript-fähigen Browser verwenden, z.B. Konqueror, Opera, usw.");

		
function moves()
{ 
	window.scroll(1,40000000);
	window.setTimeout("moves()", 10);
}
	moves();

function refocus()
{
  _in.blur(); // Needed for Mozilla to scroll correctly.
  _in.focus();
}

function init()
{
  _in = document.getElementById("input");
  _out = document.getElementById("output");

  _win = window;

  if (opener && !opener.closed)
  {
    println("Using bookmarklet version of shell: commands will run in opener's context.", "message");
    _win = opener;
  }

  _win.Shell = window;

  refocus();

  
  if (window.getSelection && document.addEventListener)
  {
    // Unless the user is selected something, refocus the textbox.
    // (requested by caillon, brendan, asa)
    function keepFocusInTextbox(e) 
    {
      g = e.target; 
      while (!g.tagName) 
        g = g.parentNode; 
      t = g.tagName.toUpperCase(); 
      if (t!="A" && t!="INPUT" && !String(window.getSelection())) 
        refocus(); 
    }
    document.addEventListener("click", keepFocusInTextbox, false);
  }
}

function println(s, type)
{
  if(s=String(s))
  {
    var newdiv = document.createElement("div");
    newdiv.appendChild(document.createTextNode(s));
    newdiv.className = type;
    try { _out.appendChild(newdiv); } catch(er) { }
    return newdiv;
  }
}

function printWithRunin(h, s, type)
{
  var div = println(s, type);
  var head = document.createElement("strong");
  head.appendChild(document.createTextNode(h + ": "));
  div.insertBefore(head, div.firstChild);
}


function hist(keycode)
{
  // Use onkeydown because IE doesn't support onkeypress for arrow keys
  // But because it's onkeydown and not onkeypress, we can't return false to prevent the
  // cursor from moving :(  That's what the setTimeout hack is for.

  // histList[0] = first command entered, [1] = second, etc.
  // type something, press up --> thing typed is now in "limbo"
  // (last item in histList) and should be reachable by pressing 
  // down again.

  var L = histList.length;

  if (L == 1)
    return;

  if (keycode == 38 || keycode == 57373) // 'up' key, 57373 is opera
  {
    if (histPos == L-1)
    {
      // Save this entry in case the user hits the down key.
      histList[histPos] = _in.value;
    }

    if (histPos > 0)
    {
      histPos--;
      // Use a timeout to prevent up from moving cursor within new text
      // Set to nothing first for the same reason
      setTimeout("_in.value = ''; _in.value = histList[histPos];", 0);
    }
  } 
  if (keycode == 40 || keycode == 57374) // 'down' key
  {
    if (histPos < L-1)
    {
      histPos++;
      _in.value = histList[histPos];
    }
    else if (histPos == L-1)
    {
      // Already on the current entry: clear but save
      if (_in.value)
      {
        histList[histPos] = _in.value;
        ++histPos;
        _in.value = "";
      }
    }
  }
}

function printQuestion(q)
{ 
<?php
	if($modus == 0 || $modus == 2)
	{
		echo 'if(passmod == 0) { '."\n";
		echo 'println(q, "input"); '."\n";
		echo 'if(q == "") '."\n";
		echo '{ '."\n";
		echo 'println("Login:", "text"); '."\n";
		echo '} '."\n";
		echo 'if(q != "") '."\n";
		echo '{ '."\n";
		echo 'println("Passwort:", "text"); '."\n";
		echo 'document.getElementById("input").type = "password"; '."\n";
		echo 'document.getElementsByName("frm")[0].action = "eingabe.php"; '."\n";
		echo 'document.getElementsByName("frm")[0].method = "post"; '."\n";
		echo 'document.frm.user.value = q; '."\n";
		echo 'passmod = 1; '."\n";
		echo '} '."\n";
		echo '} else {'."\n";
		echo 'document.frm.pass.value = q; '."\n";
		echo 'document.getElementsByName("frm")[0].submit(); '."\n";
		echo '} '."\n";
	}
	if($modus == 1)
	{
		echo 'println(q, "input"); '."\n";
		echo 'if(q == "") '."\n";
		echo '{ '."\n";
		echo 'println(" ", "text"); '."\n";
		echo '} '."\n";
		echo 'else '."\n";
		echo '{ '."\n";
		echo 'top.exec.location.href = "exec.php?user='.$user.'&sid='.$sid.'&cmnd="+q; '."\n";
		echo '} '."\n";
	
	}
?>
	
}

function go (s)
{
  _in.value = 
    question = s ? s : _in.value;
  
  histList[histList.length-1] = question;
  histList[histList.length] = "";
  histPos = histList.length - 1;

  // Because of differences in timing among browsers, 
  // this should be the last statement in go().
  _win.location.href = "javascript:Shell._in.value=''; Shell.printQuestion(Shell.question); setTimeout(Shell.refocus, 0); void 0";
}
//-->
</script>

<style type="text/css">
body { font-family: Courier; background: #000000; color: #AAAAAA; }

#output { font-family: Courier; white-space: -moz-pre-wrap; } /* Preserve newlines but wrap */

form { font-family: Courier; margin: 0; padding: 0; }
#input { font-family: Courier; width: 100%; border: none; padding: 0;}

.input { font-family: Courier; color: #FF0000; background: #000000; font: inherit; font-weight: bold; margin-top: .1em; }
.text { font-family: Courier; color: #AAAAAA; background: #000000; font: inherit; font-weight: bold; margin-top: .1em; }
</style></head>


<body onload="init()" bgcolor="#000000">

<div id="output"><b>
<?php
if($modus == 0)
	echo 'PsiChat Adminkonsole</b><div><br><br><b>Login:';
if($modus == 1)
	echo 'PsiChat Adminkonsole</b><div><br><b>Login erfolgreich<br><br>';
if($modus == 2)
	echo 'Login fehlgeschlagen.</b><div><br><br><b>Login:';

?>
</b></div></div>

<form name="frm" method="" onsubmit="try{go();}catch(er){alert(er);} return false;" action="javascript:void 0">
<div><input type="text" id="input" class="input" onkeydown="hist(event.keyCode);"></div>
<input type="hidden" name="user" class="input">
<input type="hidden" name="pass" class="input">
</form>

</body></html>


Return current item: Psichat