<?
$login = $_COOKIE['ckUserLogin'];
$senha = $_COOKIE['ckUserSenha'];
if(!isset($_COOKIE['ckUserLogin'])) { echo "Para acessar essa pagina é preciso estar logado!"; }
else{
$vip=mssql_fetch_row(mssql_query("select vip from memb_info where memb___id='".$login."'"));
?>
<script>
/*
	Script desenvolvido por Leandro Martins - leandro.martins@sankhya.com.br
	Não permite seleção de campos especificados.
*/
var tagsAbertas =["input", "textarea", "select", "div"]; // CAMPOS QUE NAO SERAM BLOQUEADOS
tagsAbertas = tagsAbertas.join("|");

function fechaCamposFF(e){
var elemento = (e.target)?e.target:e.srcElement;
	if (tagsAbertas.indexOf(elemento.tagName.toLowerCase())==-1)
		return false;
}

function abreCamposFF(){
return true
}

function fechaCamposIE(){
var elemento = event.srcElement;
	if(tagsAbertas.indexOf(elemento.tagName.toLowerCase()) == -1)
		document.onselectstart = new Function ("return false");
}

function abreCamposIE(){
var elemento = event.srcElement;
	if(tagsAbertas.indexOf(elemento.tagName.toLowerCase()) == -1){
		document.onselectstart = new Function ("return false");
	}else{
		document.onselectstart = new Function ("return true");
	}
}

if (typeof document.onselectstart != "undefined"){
document.onmousedown	=	fechaCamposIE;
document.onmouseup		=	abreCamposIE;
document.onselectstart  = new Function ("return false");
}else{
document.onmousedown	=	fechaCamposFF;
document.onmouseup		=	abreCamposFF;
}
</script>
<script language="JavaScript">
 function blockError(){return true;}
 window.onerror = blockError;
 </script>
<script language=JavaScript>
 function disableselect(e) {
    return false
 } 
 function reEnable() {
    return true
 }
 //if IE4+
 document.onselectstart=new Function ("return false")
 //if NS6
 if (window.sidebar) { 
    document.onmousedown=disableselect
    document.onclick=reEnable
 }
 </script>
<SCRIPT language=JavaScript>
<!--

var message="Botão Direito Desativado";


function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</SCRIPT>


<script>
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
function mouseDown(e) {
var shiftPressed=0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape")
shiftPressed=(e.modifiers-0>3);
else shiftPressed=event.shiftKey;
if (shiftPressed) {
alert ('Shift esta desabilitado.')
return false;
}
}
return true;
}
if (parseInt(navigator.appVersion)>3) {
document.onmousedown = mouseDown;
if (navigator.appName=="Netscape")
document.captureEvents(Event.MOUSEDOWN);
}
 function blockError(){return true;}
 window.onerror = blockError;
 </script>
 <script language=JavaScript>
 function disableselect(e)
 {
    return false
 }
 function reEnable()
 {
    return true
 }
 document.onselectstart=new Function ("return false")
 if (window.sidebar)
 {
    document.onmousedown=disableselect
    document.onclick=reEnable
 }

var mensagem="Botão Direito Desativado";//protege o botao direito do mouse
function click(mouse) {
  if (document.all) {
     if (event.button==2||event.button==3) {
        alert(mensagem);
        return false;
     }
  }
  if (document.layers) {
     if (mouse.which == 3) {
        alert(mensagem);
        return false;
     }
  }
}
document.onmousedown=click;
document.onkeydown=keypressed;

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 
function ss(id) {


var left = 50;
var top = 50;

window.open('modulos/outros/verscreenshot.php?id='+id+'','SS', 'width=802, height=604, top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, LOCATION=NO, directories=no, menubar=no, RESISABLE=NO, fullscreen=no');

}
</script>
</head><head>
<link rel="stylesheet" href="../style.css" type="text/css" />

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: #333333;
}
a {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10px;
	color: #333333#333333;
}
a:visited {
	color: #333333;
}
a:hover {
	color: #FF0000;
}
a:active {
	color: #FF0000;
}
-->
</style></head>



<form name="form2" method="post" action="">
  <div align="left"><strong>
  Limpar Pk</strong></div>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
    <tr>
      <td width="20%"><p>Personagem:</p></td>
      <td width="80%"><label>
        <select name="char" class="style1" id="char">
          <?
		$Chars = mssql_query("select name from character where accountid='".$login."'");
		for($p=0;$p<mssql_num_rows($Chars);$p++) {
		$Char=mssql_fetch_row($Chars);
		echo '<option value='.$Char[0].'>'.$Char[0].'</option>';
		}
		?>
        </select>
      </label></td>
    </tr>
    <tr>
      <td><p>
        <label></label>
      </p></td>
      <td><input name="prossegue" type="submit" class="button" id="prossegue" value="LIMPAR"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html>
<? 
if($_POST['prossegue']) {
$char = $_POST['char'];
$VerificaPk = mssql_fetch_row(mssql_query("select pklevel from character where name='".$char."'"));
$VerificaStatus = mssql_fetch_row(mssql_query("select connectstat from memb_stat where memb___id='".$login."'"));
$VerificaChar = mssql_num_rows(mssql_query("select name from character where name='".$char."' and accountid='".$login."'"));
if($VerificaChar <= 0) { 
echo "<script>alert('Char incorreto'); 
location='javascript:history.back()'</script>"; 
}
elseif($VerificaStatus[0] >= 1){
echo "<script>alert('Saia da conta'); 
location='javascript:history.back()'</script>";
}
elseif($VerificaPk[0] <= 3) {
echo "<script>alert('$char não está pk'); 
location='javascript:history.back()'</script>"; 
}
else{
mssql_query("update character set
			pklevel=0,
			pkcount=0,
			pktime=0
			where name='".$char."' and accountid='".$login."'");
			echo "<script>alert('O pk de $char foi perdoado'); 
location='javascript:history.back()'</script>"; 
}
}
} ?>