<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[10]!=1)
  jump("jump.php?id=25&jump=main.php");
if(isset($_GET['type']) and isset($_GET['action']) and $_GET['action'] == "del" and isset($_GET['id']))
{
  if($_GET['type']=="heji")
    $phpcolor->table="hotkey";
  else
    $phpcolor->table="hotkey_so";
  $phpcolor->field="*";
  $phpcolor->where="id='".$_GET['id']."'";
  $phpcolor->delete();
  jump("jump.php?id=24&jump=hotkey.php?type=".$_GET['type']);
}
elseif(isset($_GET['action']) and $_GET['action'] == "no" and isset($_GET['id']))
{
  $phpcolor->table="hotkey";
  $phpcolor->field="status='0'";
  $phpcolor->where="id='".$_GET['id']."'";
  $phpcolor->upgrade();
  jump("jump.php?id=24&jump=hotkey.php");
}
elseif(isset($_GET['action']) and $_GET['action'] == "yes" and isset($_GET['id']))
{
  $phpcolor->table="hotkey";
  $phpcolor->field="status='1'";
  $phpcolor->where="id='".$_GET['id']."'";
  $phpcolor->upgrade();
  jump("jump.php?id=24&jump=hotkey.php");
}
else
{
  if(!isset($_GET['page']))
    $_GET['page']=0;
  if(isset($_POST['hotkey']))
    $_GET['hotkey']=$_POST['hotkey'];
  $phpcolor->field="*";
  if($_GET['type']=="heji")
  {
	$phpcolor->table="hotkey";
    if(isset($_GET['hotkey']))
	{
      $phpcolor->where="hotkey like '%".$_GET['hotkey']."%'";
      $count = $phpcolor->exist(2);
      $phpcolor->where="hotkey like '%".$_GET['hotkey']."%' order by hottime desc limit ".($_GET['page']*30).",30";
	  $page=pages($count,'30',$_GET['page'],'hotkey','&type=heji','&hotkey='.$_GET['hotkey'],'0');
	}
	else
	{
      $phpcolor->where="1=1";
      $count = $phpcolor->exist(2);
      $phpcolor->where="1=1 order by hottime desc limit ".($_GET['page']*30).",30";
	  $page=pages($count,'30',$_GET['page'],'hotkey','&type=heji','','0');
	}
	$hotkey=$phpcolor->assignment();
  }
  else
  {
	$phpcolor->table="hotkey_so";
    if(isset($_GET['hotkey']))
	{
      $phpcolor->where="hotkey like '%".$_GET['hotkey']."%'";
      $count = $phpcolor->exist(2);
      $phpcolor->where="hotkey like '%".$_GET['hotkey']."%' order by hottime desc limit ".($_GET['page']*30).",30";
	  $page=pages($count,'30',$_GET['page'],'hotkey','&type=user','','0');
	}
	else
	{
      $phpcolor->where="1=1";
      $count = $phpcolor->exist(2);
      $phpcolor->where="1=1 order by hottime desc limit ".($_GET['page']*30).",30";
	  $page=pages($count,'30',$_GET['page'],'hotkey','&type=user','','0');
	}
	$hotkey=$phpcolor->assignment();
  }
  $tpl -> assign("hotkey", $hotkey);
  $tpl -> assign("type", $_GET['type']);
  $tpl -> assign("page", $page);
  $tpl -> display("hotkey.htm");
}
?>