Просмотр файла invites.php

Размер файла: 1.94Kb
<?php

// Криме / Krime
include('common.php');

$do = getarg('do');
$id = getarg('id');

if(islogged())
{
  echo theader($lang['myinvites']);
  echo '    <span>' . $lang['myinvites'] . '</span><br />';

  if($do == 'new')
  {
    $query = mysql_query('SELECT COUNT(*) FROM `invites` WHERE `user` = \'' . getid() . '\';');
    if(intval(mysql_result($query, 0)) <= 5 || checkadmin())
    {
      addinvite(getusername(getid()));
    }
  }
  elseif($do == 'delete')
  {
    $query = mysql_query('SELECT * FROM `invites` WHERE `id` = \'' . $id . '\' AND `user` = \'' . getid() . '\';');
    if(mysql_num_rows($query) > 0)
      @mysql_query('DELETE FROM `invites` WHERE `id` = \'' . $id . '\';');
  }

  $count = mysql_query('SELECT COUNT(*) FROM `invites` WHERE `user` = \'' . getid() . '\';');
  if(intval(mysql_result($count, 0)) <= 5 || checkadmin())
  {
    echo "\r\n";
    echo '    <span><a href="' . $s_siteurl . '/invites.php?lang=' . $language . '&amp;do=new">' . $lang['newinvite'] . '</a></span><br />';
  }

  echo '<br />' . "\r\n";

  $query = mysql_query('SELECT * FROM `invites` WHERE `user` = \'' . getid() . '\';');
  if(mysql_num_rows($query) > 0)
  {
    echo '    <div class="left">' . "\r\n";
    echo '      <div class="invites">' . "\r\n";
    while($invite = mysql_fetch_array($query))
    {
      $iid = $invite['id'];
      $icode = $invite['code'];
      echo '        <span>' . $lang['invitecode'] . ': <b>' . $icode . '</b> <a href="' . $s_siteurl . '/invites.php?lang=' . $language . '&amp;do=delete&amp;id=' . $iid . '">[D]</a></span><br />' . "\r\n";
    }
    echo '      </div>' . "\r\n";
    echo '    </div>' . "\r\n";
  }
  else
  {
    echo '    <span>' . $lang['noinvitations'] . '</span><br />' . "\r\n";
  }

  echo '    <span><a href="' . $s_siteurl . '/index.php?lang=' . $language . '">' . $lang['back'] . '</a></span><br /><br />' . "\r\n";
  echo tfooter();
}

exit();

?>