⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.php

📁 The goal with this project was to make it possible for almost any mobile-phone to use ICQ and be abl
💻 PHP
字号:
<?// Wapmess, originally developed by G鰎an (depeh) Johansson, Sweden
//
// Feel free to improve this program in any way you can, but please share your version!
// More info and the latest version is avaiable at:
// http://sourceforge.net/projects/wapmess/require("icqlib.php");

wml_header();
no_cache_header();
xml_header();
  // The current user ICQ user-id
$my_uin=$_REQUEST["u"];// The current user ICQ password
$my_pwd=$_REQUEST["p"];// The receiver(ICQ Uin) of the message to be sent$uin=$_REQUEST["uin"];// The message that should be sent to the icq-server$msg=$_REQUEST["msg"];// m is 1 if the user wants to write a new Message
$m=$_REQUEST["m"];// c is the counter of how many times the wap-client has been refreshing$c=$_REQUEST["c"];$nocache_no=rand(1000, 9999);$mainurl=$wwwname."?u=".$my_uin."&p=".$my_pwd."&".$nocache_no;$indexurl=$wwwpath."/index.php?u=".$my_uin."&p=".$my_pwd."&".$nocache_no;
# Koppla upp mot databasservern
$db = mysql_connect($db_server, $db_user, $db_pass);

# V鋖j DATABAS
mysql_select_db($db_name);

$query="SELECT lifesign FROM alive WHERE uin='".$my_uin."'";

$sqlres=mysql_query($query) or die("get_alive Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($sqlres);

if ($num_rows==1)
	{
		$row = mysql_fetch_array($sqlres);
		$lifesign=$row["lifesign"];
	}
$query="SELECT statusstr FROM uinstatus WHERE uin='".$my_uin."'";

$sqlres=mysql_query($query) or die("get_unistatus Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($sqlres);

if ($num_rows==1)
	{
		$row = mysql_fetch_array($sqlres);
		$status_str=$row["statusstr"];				$status_split=split(",",$status_str);				for ($x=0;$x<count($status_split);$x++)			{				$statusrow_split=split("=",$status_split[$x],2);				$uin_status[$statusrow_split[0]]=$statusrow_split[1];			}		
	}
$client_refresh_time=100; // 10 sekif ($c>6)	{		$client_refresh_time=200; // 20 sek	}if ($c>10)	{		$client_refresh_time=300; // 30 sek	}if ($c>12)	{		$client_refresh_time=600; // 1 min	}if ($c>14)	{		$client_refresh_time=1200; // 2 min	}if ($c>16)	{		$client_refresh_time=3000; // 5 min	}if ($c>18)	{		$client_refresh_time=6000; // 10 min	}if ($c>20)	{		$client_refresh_time=12000; // 20 min	}		
$query="SELECT cnick,cuin FROM contactlist WHERE uin='".$my_uin."' ORDER BY cnick";

$sqlres=mysql_query($query) or die("contactlist Invalid query: " . mysql_error());
$num_rows = mysql_num_rows($sqlres);

if ($num_rows<1)
	{
?>
<wml>
<card id="kort1" title="<?=$app_name?>"><p align="center"><b>No contacts in list!</b>
</p>
</card>
</wml>
<?			exit;
	}
else
	{		$status_list="<b>Online</b><br/>";		
		$wml_list="<select name=\"mott\">";
		while ($row = mysql_fetch_array($sqlres))
			{				$status_symbol="?";					if ($uin_status[$row["cuin"]]=="")					{						$status_symbol="?";					}							else if ($uin_status[$row["cuin"]]=="1")					{						$status_symbol=":)";						$status_list.=$row["cnick"]."<br/>";					}				else if ($uin_status[$row["cuin"]]=="0")					{						$status_symbol=":(";					}					
				$wml_list.="<option value=\"".$row["cuin"]."\">".$row["cnick"]." ".$status_symbol."</option>\n";
			}
		$wml_list.="</select>";
			
	}


$now=time();

$nowtime=date("H:i:s"); 

if ($lifesign<$now-$alive_limit_seconds)
	{
		$server_alive=0;
		$life_text=":(";
	}
else
	{
		$server_alive=1;
		$life_text=":)";
	}

// Kolla om meddelande ska skickas
if ($msg && $uin)
	{
		// L鋑g till meddelandet i outgoing tabellen
		
		$when=date("Y-m-d H:i");				
		
		$query = "INSERT INTO outgoing ( `id` , `fromuin` , `touin` , `msg` , `msgtime` , `seen` ) VALUES (0,'".$my_uin."','".$uin."','".smart_utf8_decode($msg)."','".$when."',0)";
		if ($debug)print "sql=$query\n";
		$sqlres=mysql_query($query) or die("<wml><card id=\"card1\"><p>send_alive Invalid query: ". mysql_error()."</p></card></wml>");
		
		
	}
$show_timer=1;if ($m==1)	{?><wml><card id="card1" title="New Msg">
<p><a href="<?=amp($mainurl);?>">Back</a><br/><?=$wml_list?><input name="reply" type="text" emptyok="true"/>
	<anchor>Send Msg	<go method="post" href="<?=amp($mainurl)?>">
	<postfield name="uin" value="$(mott)"/>	<postfield name="msg" value="$(reply)"/>	</go>	</anchor>
</p></card>		</wml><?		exit;			}
if ($server_alive==1)
	{
				$mess_uin="";		$query = "SELECT DISTINCT incoming.fromuin from incoming,contactlist WHERE incoming.touin = contactlist.uin AND incoming.touin=\"".$my_uin."\" AND contactlist.cuin=incoming.fromuin AND incoming.seen=0 ORDER BY incoming.fromuin LIMIT 1";		if ($debug)print "sql=$query\n";
		$sqlres=mysql_query($query) or die("<wml><card id=\"card1\"><p>send_alive Invalid query: ". mysql_error()."</p></card></wml>");
		$rescount = mysql_num_rows($sqlres);		if ($rescount==1)			{				$row = mysql_fetch_array($sqlres);				$mess_uin=$row["fromuin"];			}				// S鰇 ut de meddelanden fr錸 anv鋘dare som finns p

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -