Показать сообщение отдельно

  #2  
Старый 23.02.2009, 01:32
AdReNa1!Ne
Участник форума
Регистрация: 24.05.2007
Сообщений: 229
Провел на форуме:
2308963

Репутация: 309
По умолчанию

ICQFIGHT (то же, что и флеш версия на сайте icq.com)

PHP код:
<?php
function icqfight($uin1,$uin2) {
    
$array = array();
    
$a file_get_contents("http://www.icq.com/fight/fight_frm.php?u1=".$uin1."&u2=".$uin2);
    
$pos strpos($a,"Make sure you enter a valid ICQ number");
    if(
$pos != false) {
        
$array['status'] = 'error';
    }
    
$array1 explode("&",$a);
    
$sc1 $array1[0];
    
$sc2 $array1[1];
    
$sc1 str_replace("sc1=","",$sc1);
    
$sc2 str_replace("sc2=","",$sc2);
    if(
$sc1 $sc2) {
        
$array['status'] = 'win';
    } else
        if(
$sc2 $sc1) {
            
$array['status'] = 'lose';
        } else
              if(
$sc2 == $sc1 && $pos == false) {
            
$array['status'] = 'draw';
        }
    
$array['score1'] = $sc1;
    
$array['score2'] = $sc2;
    return 
$array;
}

if(
$_GET['y'] && $_GET['h']){
    
header("Content-type: text/html; charset=windows-1251");
    
$result icqfight($_GET['y'],$_GET['h']);
    
      if (
$result['status'] == error) {
      
$echo "Ошибка! Возможно, неверно введены UIN`ы.";
      }  
      if (
$result['status'] == win) { 
      
$ret1 " - Вы выйграли!";
      
$echo "Поздравляем! Вы выйграли со счетом - <b>".$result['score1']." - ".$result['score2']."</b>.";
      }
      if (
$result['status'] == lose) {
      
$ret1 " - Вы проиграли.";
      
$echo "К сожалению, вы проиграли со счетом - <b>".$result['score1']." - ".$result['score2']."</b>.";
      }
      if (
$result['status'] == draw) {
      
$ret1 " - Ничья!";
      
$echo "Ничья! Счет - <b>".$result['score1']." - ".$result['score2']."</b>.";
      }       
      echo 
$echo;
    exit();
}

echo <<<HTML
<html>
<meta http-equiv="content-type" content="text/html; charset=windows-1251" />
<title>ICQ FIGHT
{$ret1}</title>
<head>
<style type="text/css">
      body{ 
               background-color: rgb(238,52,63);
               background-image: url("logo.jpg");
               background-repeat: no-repeat;
               background-position: top center;
     }
    </style>
<script>
function switchSettings()
{
    var settings = document.getElementById('settings');
    if (settings.style.visibility == 'hidden') settings.style.visibility = 'visible';
        else settings.style.visibility = 'hidden';
    var settings1 = document.getElementById('res');
    if (settings1.style.visibility == 'hidden') settings1.style.visibility = 'visible';
        else settings1.style.visibility = 'hidden';
    var settings2 = document.getElementById('eshe');
    if (settings2.style.visibility == 'hidden') settings2.style.visibility = 'visible';
        else settings2.style.visibility = 'hidden';
}


function getPage(url,id) {
  var r;
  
  if (window.XMLHttpRequest) {
    r = new XMLHttpRequest();   
    document.getElementById('button').disabled = true;
    r.open("GET", url, false);
    r.send(null);
  }else if (window.ActiveXObject) {
    r = new ActiveXObject("Microsoft.XMLHTTP");
    if (!r)
      r = new ActiveXObject("Msxml2.XMLHTTP");
    if (r) {     
      document.getElementById('button').disabled = true;
      r.open("GET", url, false); 
      r.send(null);
      }
    }
        document.getElementById(id).innerHTML = r.responseText;
        document.getElementById('button').disabled = false;
  }
</script>
</head>
<body>
<center>
<form method="GET" action="">
<table style="margin-top: 320px; margin-left: 10px; visibility:visible;" id="settings">
    <tr><td><input type="9" maxlength="9" name="your" id="your" value="you" onclick="this.value=''" size="14"/></td><td><b> VS </b></td><td><input type="9" maxlength="9" name="him" id="him" value="enemy" onclick="this.value=''" size="14"/></td></tr>
    <tr><td colspan="3" align="center"><input type="button" value="FIGHT!" id='button' onclick="switchSettings(); getPage('?y='+getElementById('your').value+'&h='+getElementById('him').value,'res');"/></td></tr>
</table>
</form>
<div id="res" style="visibility:hidden;"></div>
<a href="javascript:switchSettings();" id="eshe" style="visibility:hidden;">Еще раз?</a>
</center>
</body>
</html>
HTML;
?>
http://slil.ru/26989687 <- тут лого
 
Ответить с цитированием