<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IT Blog &#187; login</title>
	<atom:link href="http://blog.thuongtin.net/tag/login/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thuongtin.net</link>
	<description>php, sql, autoit, javascript, c, html</description>
	<lastBuildDate>Tue, 15 Sep 2009 00:57:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Login and Logout using Sessions and Cookies</title>
		<link>http://blog.thuongtin.net/2008/11/04/login-and-logout-using-sessions-and-cookies/</link>
		<comments>http://blog.thuongtin.net/2008/11/04/login-and-logout-using-sessions-and-cookies/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 03:36:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[login]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=300</guid>
		<description><![CDATA[Login and Logout using Sessions and Cookies.
1. Tại file functions.php với nội dung:
&#60;?php

function createsessions($username,$password)
{
//Add additional member to Session array as per requirement
session_register();

$_SESSION[&#34;gdusername&#34;] = $username;
$_SESSION[&#34;gdpassword&#34;] = md5($password);

if(isset($_POST['remme']))
{
//Add additional member to cookie array as per requirement
setcookie(&#34;gdusername&#34;, $_SESSION['gdusername'], time()+60*60*24*100, &#34;/&#34;);
setcookie(&#34;gdpassword&#34;, $_SESSION['gdpassword'], time()+60*60*24*100, &#34;/&#34;);
return;
}
}

function clearsessionscookies()
{
unset($_SESSION['gdusername']);
unset($_SESSION['gdpassword']);

session_unset();
session_destroy();

setcookie (&#34;gdusername&#34;, &#34;&#34;,time()-60*60*24*100, &#34;/&#34;);
setcookie (&#34;gdpassword&#34;, &#34;&#34;,time()-60*60*24*100, &#34;/&#34;);
}

function confirmUser($username,$password)
{
// $md5pass = md5($password); // Not needed any ]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">Login and Logout using Sessions and Cookies.</p>
<p>1. Tại file functions.php với nội dung:</p>
<pre class="brush: php;">&lt;?php

function createsessions($username,$password)
{
//Add additional member to Session array as per requirement
session_register();

$_SESSION[&quot;gdusername&quot;] = $username;
$_SESSION[&quot;gdpassword&quot;] = md5($password);

if(isset($_POST['remme']))
{
//Add additional member to cookie array as per requirement
setcookie(&quot;gdusername&quot;, $_SESSION['gdusername'], time()+60*60*24*100, &quot;/&quot;);
setcookie(&quot;gdpassword&quot;, $_SESSION['gdpassword'], time()+60*60*24*100, &quot;/&quot;);
return;
}
}

function clearsessionscookies()
{
unset($_SESSION['gdusername']);
unset($_SESSION['gdpassword']);

session_unset();
session_destroy();

setcookie (&quot;gdusername&quot;, &quot;&quot;,time()-60*60*24*100, &quot;/&quot;);
setcookie (&quot;gdpassword&quot;, &quot;&quot;,time()-60*60*24*100, &quot;/&quot;);
}

function confirmUser($username,$password)
{
// $md5pass = md5($password); // Not needed any more as pointed by ted_chou12

/* Validate from the database but as for now just demo username and password */
if($username == &quot;demo&quot; &amp;&amp; $password = &quot;demo&quot;)
return true;
else
return false;
}

function checkLoggedin()
{
if(isset($_SESSION['gdusername']) AND isset($_SESSION['gdpassword']))
return true;
elseif(isset($_COOKIE['gdusername']) &amp;&amp; isset($_COOKIE['gdpassword']))
{
if(confirmUser($_COOKIE['gdusername'],$_COOKIE['gdpassword']))
{
createsessions($_COOKIE['gdusername'],$_COOKIE['gdpassword']);
return true;
}
else
{
clearsessionscookies();
return false;
}
}
else
return false;
}
?&gt;
</pre>
<p>File index.php</p>
<pre class="brush: php;">&lt;?php
ob_start();
session_start();

require_once (&quot;functions.php&quot;);

if (checkLoggedin())
echo &quot;&lt;H1&gt;You are already logged in - &lt;A href = &quot;login.php?do=logout&quot;&gt;logout&lt;/A&gt;&lt;/h1&gt;&quot;;
else
echo &quot;&lt;H1&gt;You are not logged in - &lt;A href = &quot;login.php&quot;&gt;login&lt;/A&gt;&lt;/h1&gt;&lt;/h1&gt;&quot;;
?&gt;
</pre>
<p>File login.php</p>
<pre class="brush: php;">&lt;?php

ob_start();
session_start();

require_once (&quot;functions.php&quot;);

$returnurl = urlencode(isset($_GET[&quot;returnurl&quot;])?$_GET[&quot;returnurl&quot;]:&quot;&quot;);
if($returnurl == &quot;&quot;)
$returnurl = urlencode(isset($_POST[&quot;returnurl&quot;])?$_POST[&quot;returnurl&quot;]:&quot;&quot;);

$do = isset($_GET[&quot;do&quot;])?$_GET[&quot;do&quot;]:&quot;&quot;;

$do = strtolower($do);

switch($do)
{
case &quot;&quot;:
if (checkLoggedin())
{
echo &quot;&lt;H1&gt;You are already logged in - &lt;A href = &quot;login.php?do=logout&quot;&gt;logout&lt;/A&gt;&lt;/h1&gt;&quot;;
}
else
{
?&gt;
&lt;form NAME=&quot;login1&quot; ACTION=&quot;login.php?do=login&quot; METHOD=&quot;POST&quot; ONSUBMIT=&quot;return aValidator();&quot;&gt;
&lt;input TYPE=&quot;hidden&quot; name=&quot;returnurl&quot; value=&quot;&lt;?$returnurl?&gt;&quot;&gt;
&lt;TABLE cellspacing=&quot;3&quot;&gt;
&lt;TR&gt;
&lt;TD&gt;Username:&lt;/TD&gt;
&lt;TD&gt;&lt;input TYPE=&quot;TEXT&quot; NAME=&quot;username&quot;&gt;&lt;/TD&gt;
&lt;TD&gt;Password:&lt;/TD&gt;
&lt;TD&gt;&lt;input TYPE=&quot;PASSWORD&quot; NAME=&quot;password&quot;&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD colspan=&quot;4&quot; ALIGN=&quot;center&quot;&gt;&lt;input TYPE=&quot;CHECKBOX&quot; NAME=&quot;remme&quot;&gt;&amp;nbsp;Remember me for the next time I visit&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD ALIGN=&quot;CENTER&quot; COLSPAN=&quot;4&quot;&gt;&lt;input TYPE=&quot;SUBMIT&quot; name=&quot;submit&quot; value=&quot;Login&quot;&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/form&gt;
&lt;/TABLE&gt;
&lt;?
}
break;
case &quot;login&quot;:
$username = isset($_POST[&quot;username&quot;])?$_POST[&quot;username&quot;]:&quot;&quot;;
$password = isset($_POST[&quot;password&quot;])?$_POST[&quot;password&quot;]:&quot;&quot;;

if ($username==&quot;&quot; or $password==&quot;&quot; )
{
echo &quot;&lt;h1&gt;Username or password is blank&lt;/h1&gt;&quot;;
clearsessionscookies();
header(&quot;location: login.php?returnurl=$returnurl&quot;);
}
else
{
if(confirmuser($username,md5($password))) // As pointed out by asgard2005
{
createsessions($username,$password);
if ($returnurl&lt;&gt;&quot;&quot;)
header(&quot;location: $returnurl&quot;);
else
{
header(&quot;Location: index.php&quot;);
}
}
else
{
echo &quot;&lt;h1&gt;Invalid Username and/Or password&lt;/h1&gt;&quot;;
clearsessionscookies();
header(&quot;location: login.php?returnurl=$returnurl&quot;);
}
}
break;
case &quot;logout&quot;:
clearsessionscookies();
header(&quot;location: index.php&quot;);
break;
}
?&gt;
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2008/09/12/class-login/" rel="bookmark">Class login</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/file-sao-luu-du-lieu/" rel="bookmark">File sao lưu dữ liệu</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/tao-1-file-download-file/" rel="bookmark">Tạo 1 file download file</a></li><li><a href="http://blog.thuongtin.net/2008/10/22/yahoo-messenger-api/" rel="bookmark">Yahoo Messenger API</a></li><li><a href="http://blog.thuongtin.net/2008/09/12/grab-link-megaroticcom/" rel="bookmark">Grab link megarotic.com</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=300&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/11/04/login-and-logout-using-sessions-and-cookies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yahoo Messenger API</title>
		<link>http://blog.thuongtin.net/2008/10/22/yahoo-messenger-api/</link>
		<comments>http://blog.thuongtin.net/2008/10/22/yahoo-messenger-api/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 08:00:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Get links]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[wap]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=218</guid>
		<description><![CDATA[Đây là class login vào yahoo, set status và gửi tin nhắn cho 1 nick. Tôi sưu tầm trên mạng mà giờ chẳng biết bài viết gốc nó nằm mô rồi. Hix!

&#60;?
// Class 'Yahoo Messenger API' v1.0
// details : send pm to any yahoo messenger IDs via PHP
// (c) Hadi Fanaee , Iran , Mashhad ]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">Đây là class login vào yahoo, set status và gửi tin nhắn cho 1 nick. Tôi sưu tầm trên mạng mà giờ chẳng biết bài viết gốc nó nằm mô rồi. Hix!<br />
<span id="more-218"></span>
<pre class="brush: php;">&lt;?
// Class 'Yahoo Messenger API' v1.0
// details : send pm to any yahoo messenger IDs via PHP
// (c) Hadi Fanaee , Iran , Mashhad , Kasbarg Information Technology .
// Released under the terms of the GNU Public License
// Website : www.php45.com
// Email : info@php45.com

class Ymess {

//-------------------------------------PACKETS----------------------------------------------------
Function Packet1($MyWAPHost)
{
$StrPck = &quot;GET / HTTP/1.1\n&quot;;
$StrPck.=&quot;Referer: /\n&quot;;
$StrPck.=&quot;Accept-Language: en-us\n&quot;;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;;
$StrPck.=&quot;Host: $MyWAPHost\n\n&quot;;
return $StrPck;
}
Function Packet2($MySID,$MyWAPHost,$MyIntl,$MyCookie)
{

$StrPck = &quot;GET /p/messenger?$MySID HTTP/1.1\n&quot;;
$StrPck.=&quot;Referer: /\n&quot;;
$StrPck.=&quot;Accept-Language: en-us\n&quot;;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;    ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n&quot;;
return $StrPck;
}
Function Packet3($MyWAPHost,$MyIntl,$MyCookie)
{
$StrPck = &quot;GET /p/messenger HTTP/1.1\n&quot;;
$StrPck.=&quot;Referer: /\n&quot;;
$StrPck.=&quot;Accept-Language: en-us\n&quot;   ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot; ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;        ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n&quot;           ;
return  $StrPck;
}
Function Packet4($MyWID,$MyWAPHost,$MyCookie)
{
$StrPck = &quot;GET /p/messenger/welcome?r=$MyWID HTTP/1.1\n&quot;  ;
$StrPck.=&quot;Referer: /\n&quot;;
$StrPck.=&quot;Accept-Language: en-us\n&quot;     ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot; ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;       ;
$StrPck.=&quot;Cookie: $MyCookie\n\n&quot; ;
return $StrPck;
}

Function Packet5($MyCID,$MyWID,$MySID,$MyWAPHost,$MyIntl,$MyCookie)
{
$StrPck = &quot;POST /p/messenger?c=$MyCID&amp;r=$MyWID&amp;ySiD=$MySID HTTP/1.1\n&quot;  ;
$StrPck.=&quot;Referer: /\n&quot;  ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;  ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;  ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;     ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n&quot;    ;
return $StrPck;
}

Function Packet6($MyWID,$MyWAPHost,$MyIntl,$MyCookie)
{
$StrPck = &quot;GET /p/logout?r=$MyWID HTTP/1.1\n&quot;   ;
$StrPck.=&quot;Referer: /p/messenger?r=$MyWID\n&quot;  ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;   ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;  ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;         ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n&quot; ;
return $StrPck;
}

Function Packet7($MyMsg,$MyVictim,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie)
{
$mess= substr($MyMsg, 0, 940);
$Pck = &quot;message=$mess&amp;wmlfix=Send&quot;      ;
$lenmess=strlen($Pck);
$StrPck = &quot;POST /p/messenger/chat/$MyVictim/sendIm?c=$MyCID&amp;r=$MyWID HTTP/1.1\n&quot; ;
$StrPck.=&quot;Referer: /p/messenger/chat/$MyVictim?c=$MyCID&amp;r=$MyWID\n&quot;  ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;                  ;
$StrPck.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\n&quot;   ;
$StrPck.=&quot;Content-Type: application/x-www-form-urlencoded\n&quot;     ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;  ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;              ;
$StrPck.=&quot;Content-Length: $lenmess\n&quot;     ;
$StrPck.=&quot;Connection: Keep-Alive\n&quot;      ;
$StrPck.=&quot;Cache-Control: no-cache\n&quot;     ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n$Pck&quot;  ;
return $StrPck;
}

Function Packet8($MyYID,$MyPw,$MyCookieHost)
{
$StrPck=&quot;&quot;;
$StrPck.=&quot;GET /config/login?login=$MyYID&amp;passwd=$MyPw HTTP/1.1\n&quot;;
$StrPck.=&quot;Referer: /config/login?\n&quot;         ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;  ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;     ;
$StrPck.=&quot;Host:$MyCookieHost\n&quot;  ;
$StrPck.=&quot;Accept: text/html\n\n&quot; ;
return $StrPck;
}

Function Packet9()
{
$Pck = &quot;user=&quot; &amp; $MyVictim &amp; &quot;&amp;buddyGroup=Friends&amp;message=&quot; &amp; substr($MyMsg, 1, 940) &amp; &quot;&amp;wmlfix=Add&quot;   ;
$StrPck = &quot;POST /p/messenger/contacts/addComplete?c=&quot; &amp; $MyCID &amp; &quot;&amp;r=&quot; &amp; $MyWID &amp; &quot; HTTP/1.1&quot; &amp; &quot;\n&quot;  ;
$StrPck.=&quot;Referer: /p/messenger/contacts/add?c=&quot; &amp; $MyCID &amp; &quot;&amp;r=&quot; &amp; $MyWID &amp; &quot;\n&quot;    ;
$StrPck.=&quot;Accept-Language: en-us&quot; &amp; &quot;\n&quot;                          ;
$StrPck.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*&quot; &amp; &quot;\n&quot;  ;
$StrPck.=&quot;Content-Type: application/x-www-form-urlencoded&quot; &amp; &quot;\n&quot;                                        ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)&quot; &amp; &quot;\n&quot;   ;
$StrPck.=&quot;Host: &quot; &amp; $MyWAPHost &amp; &quot;\n&quot;                      ;
$StrPck.=&quot;Content-Length: &quot; &amp; strlen($Pck) &amp; &quot;\n&quot;         ;
$StrPck.=&quot;Connection: Keep-Alive&quot; &amp; &quot;\n&quot;               ;
$StrPck.=&quot;Cache-Control: no-cache&quot; &amp; &quot;\n&quot;            ;
$StrPck.=&quot;Cookie: &quot; &amp; $MyIntl &amp; $MyCookie &amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; $Pck       ;
return $StrPck;
}

Function Packet12($MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie,$MySID)
{
//http://wap.yahoo.com/p/messenger/contacts/recent?g=Friends&amp;c=Xn8TUwVHetB&amp;r=1620424127&amp;ySiD=oCChSJj.2f9bJBbg7Vy9
$StrPck = &quot;GET /p/messenger/contacts/recent?g=Friend&amp;c=$MyCID&amp;r=$MyWID&amp;ySiD=$MySID HTTP/1.1\n&quot;  ;
$StrPck.=&quot;Referer: /\n&quot;      ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;            ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;    ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;    ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n&quot;    ;
return $StrPck;
}
Function Packet10()
{
$StrPck = &quot;GET /p/messenger/contacts/deny?yid=&quot; &amp; $MyVictim &amp; &quot;&amp;c=&quot; &amp; $MyCID &amp; &quot;&amp;r=&quot; &amp; $MyWID &amp; &quot; HTTP/1.1&quot; &amp; &quot;\n&quot;  ;
$StrPck.=&quot;Referer: /p/messenger/notify?yid=&quot; &amp; $MyVictim &amp; &quot;&amp;c=&quot; &amp; $MyCID &amp; &quot;&amp;r=&quot; &amp; $MyWID &amp; &quot;\n&quot;      ;
$StrPck.=&quot;Accept-Language: en-us&quot; &amp; &quot;\n&quot;            ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)&quot; &amp; &quot;\n&quot;    ;
$StrPck.=&quot;Host: &quot; &amp; $MyWAPHost &amp; &quot;\n&quot;    ;
$StrPck.=&quot;Cookie: &quot; &amp; $MyIntl &amp; $MyCookie &amp; &quot;\n&quot; &amp; &quot;\n&quot;    ;
return $StrPck;
}
Function Packet11($MyMsg,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie)
{
$mess= substr($MyMsg, 0, 250);

$Pck = &quot;message=$mess&amp;wmlfix=Submit&quot;    ;
$lenmess=strlen($Pck);
$StrPck = &quot;POST /p/messenger/prefs/status/submit?c=$MyCID&amp;r=$MyWID HTTP/1.1\n&quot;  ;
$StrPck.=&quot;Referer: /p/messenger/prefs/status?c=$MyCID&amp;r=$MyWID\n&quot;      ;
$StrPck.=&quot;Accept-Language: en-us\n&quot;                     ;
$StrPck.=&quot;Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*\n&quot;    ;
$StrPck.=&quot;Content-Type: application/x-www-form-urlencoded\n&quot;                                                ;
$StrPck.=&quot;User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)\n&quot;         ;
$StrPck.=&quot;Host: $MyWAPHost\n&quot;                                                                              ;
$StrPck.=&quot;Content-Length: $lenmess\n&quot;                                                                  ;
$StrPck.=&quot;Connection: Keep-Alive\n&quot;                                                                           ;
$StrPck.=&quot;Cache-Control: no-cache\n&quot;                                                                          ;
$StrPck.=&quot;Cookie: $MyIntl$MyCookie\n\n$Pck&quot;                                                    ;
return $StrPck;
}
//-------------------------------------PACKETS----------------------------------------------------
//--------------------------------------------------------------------------------------
function Connect($pServer,$hPort){
$hStream = fsockopen($pServer, $hPort);
if(!$hStream){$IsConnect=0;echo &quot;Cannot connect to $pServer at port $hPort&quot;; exit;}
$IsConnect=1;
return array($IsConnect,$hStream);
}
//--------------------------------------------------------------------------------------
function Disconnect($hStream){
fclose($hStream);
}
//--------------------------------------------------------------------------------------
function GetDataArrival ($hStream){
//  $hResult = '';
while(!feof($hStream)) {
// receive the results of the request
$hResulttmp.= fgets($hStream);
}
$hResult=html_entity_decode($hResulttmp);
return  $hResult;
}
//--------------------------------------------------------------------------------------
function SendData($hStream,$Data){
fputs($hStream, $Data);
}
//--------------------------------------------------------------------------------------
function LoginWap ($myID,$myPass,$CookieHost,$wapHost,$Status,$VictimID,$Message){
$logged=0;
list($Connected5,$stream5) = $this-&gt;Connect($CookieHost, 80);

if ($Connected5=1){
$this-&gt;SendData($stream5 , $this-&gt;Packet8($myID,$myPass,$CookieHost));
$res5 = $this-&gt;GetDataArrival($stream5);
if ($res5 &lt;&gt; ''){
//GET COOKIE
$cookie1 = $this-&gt;GetCode(&quot;Y=v=&quot;,&quot;;&quot;,$res5);
$cookie2 = $this-&gt;GetCode(&quot;T=z=&quot;,&quot;;&quot;,$res5);
//if($cookie1=&quot;&quot; OR $cookie2=&quot;&quot;){echo &quot;CONNECT FAILED! SERVER IS BUSY OR INVALID ID/PASS. TRY AGAIN LATER.&quot;;}
$cookie =  &quot;Y=v=$cookie1; T=z=$cookie2&quot;;
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
list($Connected,$stream) = $this-&gt;Connect($wapHost, 80);

if ($Connected=1){
$this-&gt;SendData($stream , $this-&gt;Packet1($wapHost));
$res = $this-&gt;GetDataArrival($stream);
if ($res &lt;&gt; ''){
//GET SID AND INTL
$sid = $this-&gt;GetCode(&quot;ySiD=&quot;,'&quot;',$res);
$intltmp = $this-&gt;GetCode(&quot;B=&quot;,&quot;;&quot;,$res);
$intl= &quot;B=$intltmp;&quot; ;
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
list($Connected1,$stream1) = $this-&gt;Connect($wapHost, 80);

if ($Connected1=1){
$this-&gt;SendData($stream1 , $this-&gt;Packet2($sid,$wapHost,$intl,$cookie));
$res1 = $this-&gt;GetDataArrival($stream1);
if ($res1 &lt;&gt; ''){
//ENTER SID AND INTL
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
list($Connected2,$stream2) = $this-&gt;Connect($wapHost, 80);

if ($Connected2=1){
$this-&gt;SendData($stream2 , $this-&gt;Packet3($wapHost,$intl,$cookie));
$res2 = $this-&gt;GetDataArrival($stream2);
if ($res2 &lt;&gt; ''){
//GET WID
$widtmp = $this-&gt;GetCode(&quot;welcome?r=&quot;,&quot;C&quot;,$res2);
$wid = substr($widtmp,0,strlen($widtmp)-2);
// $Dat5 = explode(&quot;welcome?r=&quot;,$res2);
//$Dat6 = explode($res2,$Dat5[1]);
//$wid = $Dat6[0];
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
list($Connected3,$stream3) = $this-&gt;Connect($wapHost, 80);

if ($Connected3=1){
$this-&gt;SendData($stream3 , $this-&gt;Packet4($wid,$wapHost,$cookie));
$res3 = $this-&gt;GetDataArrival($stream3);
if ($res3 &lt;&gt; ''){
//GET CID
$cid = $this-&gt;GetCode(&quot;?c=&quot;,&quot;&amp;r=&quot;,$res3);
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
list($Connected4,$stream4) = $this-&gt;Connect($wapHost, 80);

if ($Connected4=1){
$this-&gt;SendData($stream4 , $this-&gt;Packet5($cid,$wid,$sid,$wapHost,$intl,$cookie));
$res4 = $this-&gt;GetDataArrival($stream4);
if ($res4 &lt;&gt; ''){
//FINNALLY CONNECT
//echo &quot;COOKIE:$cookie ______________SID:$sid ______________WID:$wid ______________CID:$cid ______________INTL:$intl&quot; ;
$logged=1;
}
}
//[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
$num = rand(0,10000);
sleep(1);
$this-&gt;SetStatus($Status,$cid,$wid,$intl,$wapHost,$cookie);
//$this-&gt;LogoutWap($wid, $wapHost,$intl ,$cookie);

//sleep(1);
//$mess1 = $this-&gt;Test($cid,$wid,$intl,$wapHost,$cookie,$sid);
//sleep(1);
$this-&gt;SendMessage($Message,$VictimID,$cid,$wid,$intl,$wapHost,$cookie);
//sleep(1);
$logged=1;
//sleep(1); exit;
return array($cid,$wid,$sid,$intl,$cookie,$wapHost,$logged);

}
//--------------------------------------------------------------------------------------
function LogoutWap($MyWID,$MyWAPHost,$MyIntl,$MyCookie){
list($Connected,$stream) = $this-&gt;Connect($MyWAPHost, 80);

if ($Connected=1){
$this-&gt;SendData($stream , $this-&gt;Packet6($MyWID,$MyWAPHost,$MyIntl,$MyCookie));
$res = $this-&gt;GetDataArrival($stream);
if ($res &lt;&gt; ''){
//LOGOUT
echo $this-&gt;Packet6($MyWID,$MyWAPHost,$MyIntl,$MyCookie);
}
}
}
//--------------------------------------------------------------------------------------
function SendMessage($MyMsg,$MyVictim,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie){
list($Connected,$stream) = $this-&gt;Connect($MyWAPHost, 80);

if ($Connected=1){
$this-&gt;SendData($stream , $this-&gt;Packet7($MyMsg,$MyVictim,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie));
$res = $this-&gt;GetDataArrival($stream);
if ($res &lt;&gt; ''){
//LOGOUT
//echo $this-&gt;Packet6($MyWID,$MyWAPHost,$MyIntl,$MyCookie);
}
}
}
//--------------------------------------------------------------------------------------
/*function Test($MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie,$MySID){
list($Connected,$stream) = $this-&gt;Connect($MyWAPHost, 80);

if ($Connected=1){
$this-&gt;SendData($stream , $this-&gt;Packet12($MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie,$MySID));
$res = $this-&gt;GetDataArrival($stream);
if ($res &lt;&gt; ''){
//LOGOUT
echo $res;
}
}
return $res;
}   */
//--------------------------------------------------------------------------------------
function SetStatus($MyMess,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie){
list($Connected,$stream) = $this-&gt;Connect($MyWAPHost, 80);

if ($Connected=1){
$this-&gt;SendData($stream , $this-&gt;Packet11($MyMess,$MyCID,$MyWID,$MyIntl,$MyWAPHost,$MyCookie));
$res = $this-&gt;GetDataArrival($stream);
if ($res &lt;&gt; ''){
//
}
}
//return 0;
}
//--------------------------------------------------------------------------------------

function GetCode($start,$end,$str){

$x1=strpos($str,$start);
if($x1){
$x2=strpos($str,$end , $x1+1);
$getbet=substr($str,$x1+strlen($start),$x2-$x1-strlen($start));
}else{
$getbet=&quot;&quot;;
}
return $getbet;
}
}
?&gt;
</pre>
<p>Lưu file lại với tên là yim.php</p>
<p>Tạo 1 file để test với nội dung:</p>
<pre class="brush: php;">
&lt;?php
include(&quot;yim.php&quot;);
$ym=new Ymess();
$mess = &quot;:))&quot;;
list($MyCid,$MyWid,$MySid,$MyIntl,$MyCookie,$MyWapHost,$logged)=$ym-&gt;LoginWap(&quot;Nick&quot;,&quot;Pass&quot;,'login.yahoo.com','us.m.yahoo.com',&quot;Status&quot;,&quot;Victim&quot;,&quot;Nội dung tin nhắn&quot;);
?&gt;
</pre>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2009/04/29/autoit-viet-phan-mem-spam-web/" rel="bookmark">[AutoIt] Viết phần mềm spam web</a></li><li><a href="http://blog.thuongtin.net/2008/09/10/class-curl/" rel="bookmark">Class Curl</a></li><li><a href="http://blog.thuongtin.net/2008/09/11/ham-kiem-tra-file-size/" rel="bookmark">Hàm kiểm tra file size</a></li><li><a href="http://blog.thuongtin.net/2009/05/03/autoit-source-tool-flood-co-gui/" rel="bookmark">[AutoIt] Source tool Flood có GUI</a></li><li><a href="http://blog.thuongtin.net/2008/10/22/doan-ma-http-ddos-attack-bkavcomvn/" rel="bookmark">Đoạn mã HTTP DDOS attack bkav.com.vn</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=218&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/10/22/yahoo-messenger-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Phpmylogon</title>
		<link>http://blog.thuongtin.net/2008/09/12/phpmylogon/</link>
		<comments>http://blog.thuongtin.net/2008/09/12/phpmylogon/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 08:02:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[login]]></category>

		<guid isPermaLink="false">http://thuongtin.net/blog/?p=77</guid>
		<description><![CDATA[Tình cờ lướt net thì thấy cái này: http://phpmylogon.sourceforge.net
Không biết có ai dùng chưa.
Để đó hồi có gì đem ra nghiên cứu, đỡ phải viết vậy.
Related Posts:Hàm tính tuổiRegular Expressions - So mẫu PHP [A-Z]Để lập trình viên tắm cả ngàyRomance de a'amourMạng BotNet Nền tảng và Cách tạo “Bot”]]></description>
			<content:encoded><![CDATA[<p class="dropcap-first">Tình cờ lướt net thì thấy cái này: http://phpmylogon.sourceforge.net<br />
Không biết có ai dùng chưa.<br />
Để đó hồi có gì đem ra nghiên cứu, đỡ phải viết vậy.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.thuongtin.net/2008/10/10/ham-tinh-tuoi/" rel="bookmark">Hàm tính tuổi</a></li><li><a href="http://blog.thuongtin.net/2008/10/29/regular-expressions-so-mau-php-a-z/" rel="bookmark">Regular Expressions - So mẫu PHP [A-Z]</a></li><li><a href="http://blog.thuongtin.net/2008/10/24/de-lap-trinh-vien-tam-ca-ngay/" rel="bookmark">Để lập trình viên tắm cả ngày</a></li><li><a href="http://blog.thuongtin.net/2008/11/01/romance-de-aamour/" rel="bookmark">Romance de a'amour</a></li><li><a href="http://blog.thuongtin.net/2008/10/17/mang-botnet-nen-tang-va-cach-tao-bot/" rel="bookmark">Mạng BotNet Nền tảng và Cách tạo “Bot”</a></li></ul></div><img src="http://blog.thuongtin.net/?ak_action=api_record_view&id=77&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.thuongtin.net/2008/09/12/phpmylogon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
