Archive for the 'php' Category

基于php获取msn的好友列表

这里看到,再加一个发送邮件,可以做msn好友邀请了,我相信这样的病毒是营销多少还是有些作用的。

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh">
<head>
<title>MSN 测试</title>
<meta name="generator" content="Bluefish 1.0.6"/>
<meta name="keywords" content="MSN"/>
<meta name="description" content="MSN test"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<style type="text/css">
<!--
div {
    font-family: arial, helvetica, sans-serif;
    font-size : 13px ;
    margin: 10px;
    padding: 2px 10px 1px;
    background-color: #C60;
    color: #FFFFFF;
    border-top: 1px solid #C90;
    border-left: 1px solid #C90;
    border-bottom: 1px solid #333;
    border-right: 1px solid #333;
}prom dresses  
a:link {
    color: #00FFBE;
}
--></style>
</head>
<body>
<div>
<?php
# filename: fm.php
# purpose: get MSN contact list
# author: http://qartis.com/?qmsn modified by Druggo
$username = $_POST['username'];
$password = $_POST['password'];
$debug = 0;
$trid = 0;
$proto = "MSNP10";
# start here
echo "通讯协议 $proto<br/>";
echo "开始登录<br/>";
# login nowloctite  
$sbconn = fsockopen("messenger.hotmail.com",1863) or die("Can't connect to MSN server");
flush();
data_out("VER $trid $proto CVR0");
data_in();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");
$temp = data_in();
if (!stristr($temp,":")){
    if (substr($temp,0,3)==601){
        #echo "Error: The MSN servers are currently unavailable.";
        echo "很不幸,MSN的服务器又挂了 >.<<br/>";
        die();
    } else {
        echo "连接失败!<br/>";
        fclose($sbconn);
        die();
    }
}guangzhou massage
@fclose($sbconn);
$temp_array = explode(" ",$temp);
$temp_array = explode(":",$temp_array[3]);
flush();
$sbconn = fsockopen($temp_array[0],$temp_array[1]) or die("error -_-#");
data_out("VER $trid $proto CVR0");
data_in();
flush();
data_out("CVR $trid 0x0409 winnt 5.1 i386 MSNMSGR 8.0.0812 MSMSGS $username");
data_in();
data_out("USR $trid TWN I $username");
$temp = data_in();
$temp_array = explode(" ",$temp);
flush();
$TOKENSTRING = trim(end($temp_array));
#echo "authenticating";
echo "身份验证中……<br/>";
flush();
$nexus_socket = fsockopen("ssl://nexus.passport.com",443);
fputs($nexus_socket,"GET /rdr/pprdr.asp HTTP/1.0rnrn");
while ($temp != "rn"){
    $temp = fgets($nexus_socket,1024);
    if (substr($temp,0,12)=="PassportURLs"){
        $urls = substr($temp,14);
    }shanghai escort
}
$temp_array = explode(",",$urls);
$temp = $temp_array[1];
$temp = substr($temp,8);
$temp_array = explode("/",$temp);
@fclose($nexus_socket);
$ssl_conn = fsockopen("ssl://".$temp_array[0],443);
fputs($ssl_conn,"GET /{$temp_array[1]} HTTP/1.1rn");
fputs($ssl_conn,"Authorization: Passport1.4 orgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRINGrn");
fputs($ssl_conn,"User-Agent: MSMSGSrn");
fputs($ssl_conn,"Host: {$temp_array[0]}rn");
fputs($ssl_conn,"Connection: Keep-Alivern");
fputs($ssl_conn,"Cache-Control: no-cachernrn");
$temp = fgets($ssl_conn,512);
if (rtrim($temp) == "HTTP/1.1 302 Found"){
    #echo "redirection";
    echo "开始重定向<br/>";
    flush();
    while ($temp != "rn"){
        $temp = fgets($ssl_conn,256);
        if (substr($temp,0,9)=="Location:"){
            $temp_array = explode(":",$temp);
            $temp_array = explode("/",trim(end($temp_array)));
            break;
        }
    }
    @fclose($ssl_conn);
    $ssl_conn = fsockopen("ssl://".$temp_array[2],443);
    fputs($ssl_conn,"GET /{$temp_array[3]} HTTP/1.1rn");
    fputs($ssl_conn,"Authorization: Passport1.4 orgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=".urlencode($username).",pwd=$password,$TOKENSTRINGrn");
    fputs($ssl_conn,"User-Agent: MSMSGSrn");
    fputs($ssl_conn,"Host: {$temp_array[2]}rn");
    fputs($ssl_conn,"Connection: Keep-Alivern");
    fputs($ssl_conn,"Cache-Control: no-cachernrn");
} elseif (rtrim($temp)=="HTTP/1.1 401 Unauthorized"){
    #echo "invalidcreds";
    echo "验证失败!<br/>";
    @fclose($ssl_conn);
    die();
} else {
    if (rtrim($temp) != "HTTP/1.1 200 OK"){
        #echo "Unknown HTTP status code: $temp<br>";
        echo "未知状态码 $temp<br/>";
        flush();
        die();
    } else {
        #echo "set_bar_len30?";
    }massage shanghai  
}
while ($temp != "rn"){
    $temp = fgets($ssl_conn,1024);
    if (substr($temp,0,19)=="Authentication-Info"){
        $auth_info = $temp;
        $temp = fgets($ssl_conn,1024);
        if (substr($temp,0,14)!="Content-Length"){
            $auth_info.= fgets($ssl_conn,1024);
        }
        break;
    }
}
@fclose($ssl_conn);
$temp_array = explode("'",$auth_info);
flush();
data_out("USR $trid TWN S {$temp_array[1]}");
flush();
$temp=data_in();
flush();
$time_since_initmsg = time();
while(!strstr($temp,"ABCHMigrated") && is_string(trim($temp))){
    if (substr($temp,0,3)=="sid"){
        $sid = trim(substr($temp,5));
    }
    if (substr($temp,0,2)=="kv"){
        $kv = trim(substr($temp,4));
    }
    if (substr($temp,0,7)=="MSPAuth"){
        $mspauth = trim(substr($temp,9));
        flush();
    }
    $temp = data_in();
}
$temp = data_in();
#echo "authenticated<br />";
echo "验证通过!<br/>";
flush();shanghai massage 
#data_out("LST 9 RL");
#data_in();
data_out("SYN $trid 0 0");
#echo "retreiving_contact_list<br />";
echo "正在获取好友列表……<br/><br/>";
flush();
stream_set_timeout($sbconn,0,125000);
/* a lazy man doing this :D */
for($i=0;$i<160;$i++) # some say max is 150
{
    $temp = data_in();
    switch (substr($temp, 0, 3))
    {
    case "LST":
    $temp_array = explode(" ",$temp);
    $un = substr($temp_array[1], 2);
    $nn = substr($temp_array[2], 2);
    $nn1 = substr($temp_array[2], 0, 1);
    if($nn1 == "F")
    {
    echo "<a href="mailto:$un">$nn</a><br/>";
    }
    else
    {
    echo "曾经的好友: $un<br/>";
    }barbed wire  
    #echo $temp."<br/>";
    break;
    default:
    # no nothing
    break;
    }
}
echo "列表结束";
@fclose($sbconn);
# end here
# functions
function data_out($data){
    global $sbconn,$debug,$trid;
    fputs($sbconn,$data."rn");
    $trid++;
    if ($debug && !empty($data)){ echo "> ".$data."<br>rn";}
}
function data_in(){
    global $sbconn,$debug;
    $temp = fgets($sbconn,256);
    if ($debug && !empty($temp)){echo "< ".$temp."<br>rn";}
    return $temp;
}chain link fencing  
?>
</div>
</body>
</html>

相关内容

PHP 5.3版本发布

PHP开发团队在2009年6月30日宣布正式发布PHP 5.3。新版本是5.X系列的一次重大更新,包含了大量新特性和bug修正。

一些主要的新特性包括:命名空间(namespaces),迟静态绑定(Late static binding),闭包(closures),可选的循环引用垃圾收集,新的扩展(如ext/phar,ext/intl和ext/fileinfo),和超过140个bug修正等等。PHP为PHP 5.2用户升级发布了迁移指南,更多变化可见ChangeLog

摘自这里

相关内容

使用 JavaScript 实现 PHP 函数功能:PHP.JS

PHP.JS 是一个开源的 JavaScript 库,它尝试在 JavaScript 中实现 PHP 函数。在你的项目中导入 PHP.JS 库,可以在静态页面使用你喜欢的 PHP 函数。

对于熟悉 PHP 的程序员来说,当他想在静态页面中使用 PHP 函数的时候,PHP.JS 是非常方便的,现在已经 400 多个 PHP 函数在 PHP.JS 中实现,还有一些正在被实现,不过现在已经能够找到大部分流行的了,甚至md5(),并且 PHP.JS 实现了一个高级的函数,如: file_get_contents(), mktime(), serialize() 等。

使用 PHP.JS 非常简单,不需要任何服务器支持,现在可以三种方式使用它:

  1. 下载默认的 PHP.JS 包
  2. 或者配置 PHP.JS 选择自己需要的函数,然后下载。
  3. 甚至直接选择需要的某一函数,直接 Copy 过去使用。

摘自这里

相关内容

apache-php一站式解决方案:xampp

谁都不喜欢繁琐的操作,如果可以有更加简单的办法。我在我的老iBook上开发php应用,但是我也不喜欢复杂的linux设置。windows上有不少AMP一体式解决方案,我在搜索mac下的解决方案的时候,发现了这个称之为apache friends的xampp,并且它是一体化的支持apache、php、mysql等。

适用于 Mac OS X 的 XAMPP 是 Mac OS X 上最简单,最实用,也最完整的网络服务器解决方案。该发行版包括整合了最新的 MySQL、PHP(4+5),和 Perl 的 Apache 2 服务器。它以 Mac OS X 安装包的方式发布,包含所有必须的文件,无需下载其它东西。

我下载后试用了一下,的确不错,主要的界面管理还是用web的,mac下面只是一个小小的启动服务器的面板。使用xampp后不会影响mac osx原来内置的apache等应用。

相关内容

Mac Os leopard 下配置 PHP+Mysql和GD库

继续找资料的时候,看到国内朋友的中文介绍,可以参考一下,来自这里

Mac下配置php环境:

1. 修改 /etc/apache2/httpd.conf 中
#LoadModule php5_module libexec/apache2/libphp5.so

把前面的#去掉。

2.将/etc/php.ini.default 复制到 /etc/php.ini
sudo cp /etc/php.ini.default /etc/php.ini

3. 打开apache: 在 系统偏好设置-》共享 里面在web共享前打钩。右侧会提示
“Web 共享”允许其他电脑的用户查看这台电脑上的“站点”文件夹中的网页。
证明已经成功打开

4. 测试php
在 /用户/用户名/站点 里创建 index.php 内容为,成功输出php信息。但是发现并没有GD库的支持,文章后面会介绍如何配置 GD库。

Mac下配置Mysql:

1. 到 http://dev.mysql.com/downloads/ 下载最新版的 Mysql,这里下到的是 mysql-5.1.32-osx10.5-x86_64.dmg

2. 双击 mysql-5.1.32-osx10.5-x86_64.dmg,先安装 mysql-5.1.32-osx10.5-x86_64.pkg ,然后安装MYSQLStartupItem.pkg.

3. 编辑 /etc/php.ini,将 mysql.default_socket = 后面 加上 /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock

给PHP配置GD:

1. 首先创建源代码目录:mkdir -p /SourceCache

2. 分别从
http://www.ijg.org/files/jpegsrc.v6b.tar.gz ,
http://www.libpng.org/pub/png/libpng.html ,

http://sourceforge.net/project/showfiles.php?group_id=3157&package_id=3121

下载jpegsrc.v6b.tar.gz,libpng-1.2.35.tar.bz2,freetype-2.3.9.tar.gz,然后放入 SourceCache目录,解压这些压缩包

3. 安装libjpeg:
打开终端,输入
cd /SourceCache/jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .

./configure
make
sudo make install

4. 安装libpng:
cd /SourceCache/libpng-1.2.35
./configure
make
sudo make install

5.安装freetype
cd /SourceCache/freetype-2.3.9
./configure
make
sudo make install

6. 安装GD库:
从http://www.opensource.apple.com/darwinsource/10.5.6/apache_mod_php-44.1/php-5.2.6.tar.bz2 下载php源码包
tar xjf php-5.2.6.tar.bz2
cd /SourceCache/php-5.2.6/ext/gd

phpize

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp” CCFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” CXXFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” LDFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load” ./configure –with-zlib-dir=/usr –with-jpeg-dir=/usr/local/lib –with-png-dir=/usr/X11R6 –with-freetype-dir=/usr/X11R6 –with-xpm-dir=/usr/X11R6

make
sudo make install

配置php加载gd.so:
编辑/etc/php.ini ,增加一行

extension=gd.so

7 重启apache服务器

8 GD库安装成功!

注意: 如果 不能使用.configure 或make,请先安装 Xcode 3.1

相关内容

如何在Max OSX 10.5 下设置php功能

国内使用mac进行php开发的朋友越来越多了,osx 10.5类似与一个完整的linux server,apache是自带的,php功能自然也有。自己在使用的过程中碰到过不少小小的麻烦,好在有互联网,很多人的实践为我们节约了不少时间。下面这篇如何在mac osx 10.5下使用php功能的文章,来源是这里

Mac OS X 10.5 (Leopard) comes with both Apache 2.2.6 and PHP 5.2.4 preinstalled, but they’re not enabled by default. The following instructions should help you get up and running.

  1. Open BBEdit or TextWrangler (a free, cut-down version of BBEdit available from www.barebones.com). From the File menu, select Open Hidden. In the Open dialog box, select All Files from the Enable drop-down menu. Then navigate to Macintosh HD:private:etc:apache2:httpd.conf, and click Open.
  2. This opens the main configuration file for Apache 2.2.6. It’s a system file, so you need to unlock it by clicking the icon of a pencil with a line through it at the top-left of the toolbar, as shown in the following screenshot:
    Apache configuration file in TextWrangler
  3. You will be told that the document is owned by “root”, and be asked to confirm that you want to unlock it. Click Unlock. This removes the line through the pencil, and readies the file for editing. Normally, when editing system files, it’s a good idea to make a backup. However, it’s not necessary in this case, because backup copies of all the Apache configuration files are in the original subfolder of the Apache2 folder.
  4. Scroll down until you find the code shown on line 114 in the following screenshot (although the line number is likely to be the same in your version, it’s the code that’s important, not which line it’s on):
    Load PHP module command
  5. Position your cursor at the beginning of that line, and remove the hash or pound sign (#). It should now look like this:
    LoadModule php5_module      libexec/apache2/libphp5.so
    This enables PHP 5 on your computer.
  6. Save the file. Because it’s owned by “root”, you will be prompted to enter your Mac password. That takes care of the basic configuration. In theory, you could now start Apache and PHP would be up and running. However, the default installation doesn’t use the PHP configuration file php.ini. You need to need to make a copy of a file called php.ini.default, and edit it.
  7. Unfortunately, you can’t open php.ini.default in BBEdit or TextWrangler and save it with a different name. You need to go under the hood of OS X by opening Terminal in the Applications:Utilities folder. Similar to the Command Prompt in Windows, Terminal gives you direct access to the underlying operating system on a Mac.
  8. With Terminal open, type the following series of commands, each followed by Return:
    cd /private/etc
    sudo cp php.ini.default php.ini

    This moves you into the private:etc folder, and then copies php.ini.default to php.ini in the same folder, using the sudo command. You need to use sudo because it’s a system file. Enter your Mac administrator password when prompted. Terminal should now look something like this:
    Copying php.ini.default in Terminal
  9. Open php.ini in BBEdit or TextWrangler using Open Hidden in the same way as with http.conf. You should find php.ini in Macintosh HD:private:etc. Click the icon of a pencil with a line through it to enable editing.
  10. How you edit php.ini is mainly a question of preference, but the most important change is to a command called error_reporting. The default setting (it should be on line 305) looks like this:
    error_reporting = E_ALL & ~E_NOTICE
    Change it to this:
    error_reporting = E_ALL
    This ensures that PHP reports all errors. Although no one likes error messages, it’s vital to eliminate any errors (even seemingly minor ones) before deploying scripts on a live web server.
    NOTE: There are several lines that look similar. Make sure that you edit the line that does NOT begin with a semicolon. A semicolon at the beginning of a line in php.ini indicates a comment, which is ignored by the server.
  11. Save php.ini.
  12. You can now start Apache by going to System Preferences. Click Sharing in Internet & Network. Then place a checkmark in Web Sharing. When Apache starts up, System Preferences should display Web Sharing: On.
  13. Click the link under Your computer’s website. This should launch Safari and display an Apache web page.
  14. Create a page called test.php, and type in the following code:
    <?php phpinfo(); ?>
    Save it in Macintosh HD:Library:WebServer:Documents.
  15. Load the following URL into your browser:
    http://localhost/test.php
    If you see the PHP configuration screen, you’re up and running!

NOTE: If you did an upgrade install of Leopard, you cannot view pages stored in your personal Sites folder, because the necessary file(s) won’t have been copied to the correct folder for Apache 2. To copy the file(s), open Terminal and type the following commands, both followed by Return:
cd /private/etc/httpd/users
ls

You should see at least one file that uses your Mac username followed by .conf. For example, on my computer, it’s called davidpowers.conf. You need to copy this file for each user to a folder where Apache 2 can find it. Type the following command, using the name of the file on your computer instead of davidpowers.conf:
sudo cp davidpowers.conf /private/etc/Apache2/users

If there are several .conf files to copy, you can use the following command instead:
sudo cp *.conf /private/etc/Apache2/users

However, if you have previously installed the Mac PHP package from Marc Liyanage, do not copy entropy-php.conf.

For this (or any other) change to take effect, go to Sharing in System Preferences, deselect Web Sharing, and then reselect it. This restarts Apache and implements any changes made to the Apache or PHP configuration.

相关内容

一个web版本应用开发研究

做家庭理财软件很多年了,也做互联网很多年了,该是有点交集了。

互联网是一个可以产生奇迹的地方,二三年间,就可以诞生一批很强很新的公司。说明这是还是一个很新的行业,远没有定型,没有自己必然的发展规律。我们可以经历一个产业的发展,也算是一件有趣的事情。不知道,很多年后,今天上过的这些网站,如此纷杂的信息,会是怎么一个样子。

上面的问题终究会有互联网史学家去研究和回答。我们每个人要做的,就是贡献一点自己的经验和时间了。

国内理财软件说来也很多,在线记账和理财的软件也不少,权当做是我学习吧,既是学习LAMP,也是学习开发方法,并且可以对工作中的网站架构有一些更加多一些的实践经验。粗浅的尝试过ruby on rails和php之后,还是选择php吧,facebook、wordpress和wikipedia都用php了,我没有什么好犹豫的了。

相关内容

Xcode可以用作php的开发环境

textmate的确是mac下很强的程序编辑器,但是它有一个致命的问题,中文显示不正常,所以一直比较苦恼。今天看到这里介绍,原来xcode也可以做php开发,除了基本的功能以外,中文也不是问题了,看来xocde小组很强啊。

最近一直在做些web相关的事情,因此经常需要写一些php脚本。Mac上的一些编辑器好归好,但也各有缺点。

TextMate很好用,不过讨厌的地方也很明显,中文的显示就算通过改字体的方法进行修改,显示出来的也是半个字大小的长条字,难看的紧。相比之 下,BBEdit要好很多,不过有个小小问题,目录结构的项目管理窗口是浮出的,总是需要通过command+`来回切换。Coda的感觉更好些,语法高 亮,语法提示一应俱全,不过无法分析整个项目的类和函数,所以语法提示的也只是php内置的语法。

于是突发奇想,想看看XCode是否可以编辑php。

默认XCode并没有出现在php文件的打开菜单中,建了一个空的项目之后,把php脚本整个目录拽到了新建的项目里。语法高亮有了,不过感觉关键字少了些,只有function,foreach等内置的关键字起到了高亮作用。

不过用了一会就发现,XCode可以分析整个php项目里的类和方法,还可以通过语法提示显示出来。

下面这张图就是XCode做的语法提示:

再往后面用,更发现一个比较有趣的功能,XCode还可以自动完成php的语法:

用习惯了XCode,自然感觉相比其他编辑器更加熟悉。既然XCode也可以进行php的编辑,何不就用它了呢?

XCode支持的其他语言的语法高亮还有很多,下面是一个列表:

相关内容