当前位置: 编程技术>php
本页文章导读:
▪php抓即时股票信息
php抓即时股票信息 <? $file_name="index.htm"; if(is_file($file_name)) { exec("cat $file_name",$buffer); for($i=0;$i<count($buffer);$i++) { if(strstr($buffer[$i],"<!--股市每日動態-->")) break; //找到這一行.........
▪挑战最棒的留言本的源码(三)
action.php文件 <?php require('config.php'); $action=$arr_request['action']; $key_liuyan=$arr_request['key_liuyan']; if (!isset($PHP_AUTH_USER)) { Header('WWW-Authenticate:Basic realm="管理留言"'); Header('HTTP/1..........
▪利用PHP动态生成VRML网页
多年前本人开始从事三维动画方面的学习,后学习了PHP,发现可以通过PHP动态生成VRML文档,有点类似于Generator动态生成Flash的方式。 由于VRML博大精深,这里只介绍一个简单的例子,还可.........
[1]php抓即时股票信息
来源: 互联网 发布时间: 2013-11-30
php抓即时股票信息
<?
$file_name="index.htm";
if(is_file($file_name)) {
exec("cat $file_name",$buffer);
for($i=0;$i<count($buffer);$i++) {
if(strstr($buffer[$i],"<!--股市每日動態-->")) break; //找到這一行
}
for($j=$i;$j<$i+70;$j++) { //抓以下70行
$str.= $buffer[$j];
}
echo $str;
}
?>
<?
$file_name="index.htm";
if(is_file($file_name)) {
exec("cat $file_name",$buffer);
for($i=0;$i<count($buffer);$i++) {
if(strstr($buffer[$i],"<!--股市每日動態-->")) break; //找到這一行
}
for($j=$i;$j<$i+70;$j++) { //抓以下70行
$str.= $buffer[$j];
}
echo $str;
}
?>
[2]挑战最棒的留言本的源码(三)
来源: 互联网 发布时间: 2013-11-30
action.php文件
<?php
require('config.php');
$action=$arr_request['action'];
$key_liuyan=$arr_request['key_liuyan'];
if (!isset($PHP_AUTH_USER))
{
Header('WWW-Authenticate:Basic realm="管理留言"');
Header('HTTP/1.0 401 Unauthorized');
echo '需要受权,你没有这权限!<BR>';
echo '单击刷新来重试.<br>';
exit;
}
else
{
if (strlen($PHP_AUTH_USER)!=0)
{
if ($action=="delete")
echo "对不起,你没有删除留言的权限!!!<br>";
else if ($action="/blog_article/huifu/index.html")
echo "对不起,你暂时还不能恢复,现在只有版主有这权限!!!<br>";
else
echo "对不起,你没有管理留言本的权限!!!";
exit;
}
$pass=$PHP_AUTH_PW;
// echo $pass;
$result=0;
while($pass%10!=0)
{
$result=$result+$pass%10;
$pass=($pass-$pass%10)/10;
// echo $result;
// echo "<br>";
}
$tt=$result*222;
//echo $tt;
if (!checkpass($tt,$action,$db_name,$table_name_control,$id_link))
{
if ($action=="delete")
echo "对不起,你没有删除留言的权限!!!<br>";
else if ($action="/blog_article/huifu/index.html")
echo "对不起,你暂时还不能恢复,现在只有版主有这权限!!!<br>";
else
echo "对不起,你没有管理留言本的权限!!!";
exit;
}
}
if ($action=="delete")
{
//printf("delete");
//echo $key_liuyan;
$str_sql="delete from $table_name where key_liuyan=$key_liuyan";
$re=mysql_db_query($db_name,$str_sql,$id_link);
if (!$re)
{
echo "删除出错";
}
else
{
echo "成功删除";
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
echo "</head><body topmargin="0"><br>";
echo "<ul>回复成功,将自动显示留言内容";
echo " <br>";
echo "<a href=/blog_article/display.html";
echo "</a></ul>";
}
}
else if ($action=="huifu")
{
//printf("huifu");
// echo $key_liuyan;
?>
<form action="/blog_article/action/action/ok.html" method="post">
<input type="hidden" name="key" value="<?php echo $key_liuyan?>">
<textarea name="huifu" cols="50" rows="6"></textarea>
<input type="submit" value="回复">
</form>
<?php
}
else if ($action=="ok")
{
$key=$arr_request['key'];
$huifuold=$huifu;
$time=date('Y/m/d H:i:s');
$time='('.$time . ')<br>';
$huifuold=$time .$huifuold ;
$huifu_ok=computer_message($huifuold,$hang_zifu_number);
if (strlen($key)==0)
{ echo "error";
exit;
}
$str_sql="update $table_name set huifu_biaozi=1,
huifu='$huifu_ok' where key_liuyan=$key";
// echo $str_sql;
$re=mysql_db_query($db_name,$str_sql,$id_link);
if (!$re)
{
echo "更新出错";
}
else
{
echo "回复成功";
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
echo "</head><body topmargin="0"><br>";
echo "<ul>回复成功,将自动显示留言内容";
echo " <br>";
echo "<a href=/blog_article/display/.html
请点这里返回.";
echo "</a></ul>";
exit;
}
}
else
printf("error");
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
<?php
require('config.php');
$action=$arr_request['action'];
$key_liuyan=$arr_request['key_liuyan'];
if (!isset($PHP_AUTH_USER))
{
Header('WWW-Authenticate:Basic realm="管理留言"');
Header('HTTP/1.0 401 Unauthorized');
echo '需要受权,你没有这权限!<BR>';
echo '单击刷新来重试.<br>';
exit;
}
else
{
if (strlen($PHP_AUTH_USER)!=0)
{
if ($action=="delete")
echo "对不起,你没有删除留言的权限!!!<br>";
else if ($action="/blog_article/huifu/index.html")
echo "对不起,你暂时还不能恢复,现在只有版主有这权限!!!<br>";
else
echo "对不起,你没有管理留言本的权限!!!";
exit;
}
$pass=$PHP_AUTH_PW;
// echo $pass;
$result=0;
while($pass%10!=0)
{
$result=$result+$pass%10;
$pass=($pass-$pass%10)/10;
// echo $result;
// echo "<br>";
}
$tt=$result*222;
//echo $tt;
if (!checkpass($tt,$action,$db_name,$table_name_control,$id_link))
{
if ($action=="delete")
echo "对不起,你没有删除留言的权限!!!<br>";
else if ($action="/blog_article/huifu/index.html")
echo "对不起,你暂时还不能恢复,现在只有版主有这权限!!!<br>";
else
echo "对不起,你没有管理留言本的权限!!!";
exit;
}
}
if ($action=="delete")
{
//printf("delete");
//echo $key_liuyan;
$str_sql="delete from $table_name where key_liuyan=$key_liuyan";
$re=mysql_db_query($db_name,$str_sql,$id_link);
if (!$re)
{
echo "删除出错";
}
else
{
echo "成功删除";
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
echo "</head><body topmargin="0"><br>";
echo "<ul>回复成功,将自动显示留言内容";
echo " <br>";
echo "<a href=/blog_article/display.html";
echo "</a></ul>";
}
}
else if ($action=="huifu")
{
//printf("huifu");
// echo $key_liuyan;
?>
<form action="/blog_article/action/action/ok.html" method="post">
<input type="hidden" name="key" value="<?php echo $key_liuyan?>">
<textarea name="huifu" cols="50" rows="6"></textarea>
<input type="submit" value="回复">
</form>
<?php
}
else if ($action=="ok")
{
$key=$arr_request['key'];
$huifuold=$huifu;
$time=date('Y/m/d H:i:s');
$time='('.$time . ')<br>';
$huifuold=$time .$huifuold ;
$huifu_ok=computer_message($huifuold,$hang_zifu_number);
if (strlen($key)==0)
{ echo "error";
exit;
}
$str_sql="update $table_name set huifu_biaozi=1,
huifu='$huifu_ok' where key_liuyan=$key";
// echo $str_sql;
$re=mysql_db_query($db_name,$str_sql,$id_link);
if (!$re)
{
echo "更新出错";
}
else
{
echo "回复成功";
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
echo "<META content="text/html; charset=gb2312" http-equiv=Content-Type>";
echo "<meta HTTP-EQUIV="REFRESH" CONTENT="2;URL=display.php">";
echo "</head><body topmargin="0"><br>";
echo "<ul>回复成功,将自动显示留言内容";
echo " <br>";
echo "<a href=/blog_article/display/.html
请点这里返回.";
echo "</a></ul>";
exit;
}
}
else
printf("error");
?>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
[3]利用PHP动态生成VRML网页
来源: 互联网 发布时间: 2013-11-30
多年前本人开始从事三维动画方面的学习,后学习了PHP,发现可以通过PHP动态生成VRML文档,有点类似于Generator动态生成Flash的方式。
由于VRML博大精深,这里只介绍一个简单的例子,还可以将各种VRML结点存入数据库中,这样的虚拟现实网页将……,爽!
下面是源程序。注意:在服务器上,要将让PHP处理wrl格式的文档,否则后果将是没有任何虚拟现实。本源程序直接存成wrl文件,在浏览器中要安装插件,可以到我的另一个主页上去下载:http://go.163.com/~sjtucaocao/
<?php header("Content-type: application/x-vrml");$txt="#VRML V2.0 utf8
DEF leftBox Transform
{
translation -5 0 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 0
}
}
geometry Box{}
}
DEF SphereChild Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 1
}
}
geometry Sphere
{
radius 1.2
}
}
]
}
DEF rightBox Transform
{
translation 5 0 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 0 1
}
}
geometry Box{}
}
]
}
DEF onoff Transform
{
translation 0 -1 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 1 0
}
}
geometry Box{}
}
DEF TS TouchSensor{}
]
}
DEF S Script
{
eventIn SFBool isActive
eventOut MFNode child
field MFNode testNode USE SphereChild
url
"javascript:
function isActive(value)
{
if (value)
{
child=testNode;
}
}
"
}
ROUTE TS.isActive TO S.isActive
ROUTE S.child TO leftBox.removeChildren
ROUTE S.child TO rightBox.addChildren";echo $txt;
?>
由于VRML博大精深,这里只介绍一个简单的例子,还可以将各种VRML结点存入数据库中,这样的虚拟现实网页将……,爽!
下面是源程序。注意:在服务器上,要将让PHP处理wrl格式的文档,否则后果将是没有任何虚拟现实。本源程序直接存成wrl文件,在浏览器中要安装插件,可以到我的另一个主页上去下载:http://go.163.com/~sjtucaocao/
<?php header("Content-type: application/x-vrml");$txt="#VRML V2.0 utf8
DEF leftBox Transform
{
translation -5 0 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 0
}
}
geometry Box{}
}
DEF SphereChild Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 1
}
}
geometry Sphere
{
radius 1.2
}
}
]
}
DEF rightBox Transform
{
translation 5 0 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 0 1
}
}
geometry Box{}
}
]
}
DEF onoff Transform
{
translation 0 -1 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 1 0
}
}
geometry Box{}
}
DEF TS TouchSensor{}
]
}
DEF S Script
{
eventIn SFBool isActive
eventOut MFNode child
field MFNode testNode USE SphereChild
url
"javascript:
function isActive(value)
{
if (value)
{
child=testNode;
}
}
"
}
ROUTE TS.isActive TO S.isActive
ROUTE S.child TO leftBox.removeChildren
ROUTE S.child TO rightBox.addChildren";echo $txt;
?>
最新技术文章: