找回密码
 注册
广告投放 虚位以待【阿里云】2核2G云新老同享 99元/年,续费同价做网站就用糖果主机-sugarhosts.comJtti.com-新加坡服务器,美国服务器,香港服务器
查看: 553|回复: 5

用PHP+SQLITE制作简单的视频点播程序

[复制链接]
发表于 2006 年 3 月 7 日 15:50:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本文介绍怎样利用 PHP  SQLITE 制作简单的视频点播程序,这是一个简单的视频点播程序,设有过多的美观界面。下面介绍一下程序文件的功能:
  1. init.php初始化数据库,及表文件;
  1. <?php
  2.    $db = sqlite_open("db.sqlite"); //创建并连接数据库
  3.    $sql = "create table test (id INTEGER PRIMARY KEY,movie text,url text,content text ,time  datatime);"; //创建表
  4.    $result = sqlite_query($db, $sql);
  5.    if ($result)
  6.    {
  7.        echo "数据初始化成功";
  8.        echo "<a href='sql.php'>进入创建数据文件</a>";
  9.    }
  10.    else
  11.    {
  12.        echo "数据初始化失败,请重试!";
  13.    }
  14. ?>
复制代码

2.form.php提供数据输入的表单;
  1. <form name="form1" method="post" action="add.php">
  2.   <table width="48%" border="0" align="center" cellpadding="0" cellspacing="0">
  3.    <tr>
  4.      <td width="36%" height="38"><div align="right">影片名称:</div></td>
  5.      <td width="64%"> <input type="text" name="movie"> </td>
  6.    </tr>
  7.    <tr>
  8.      <td height="39"><div align="right">影片地址:</div></td>
  9.      <td><input type="text" name="url"></td>
  10.    </tr>
  11.    <tr>
  12.      <td height="33"><div align="right">影片简介:</div></td>
  13.      <td><textarea name="content"></textarea></td>
  14.    </tr>
  15.    <tr>
  16.      <td height="53" colspan="2"><div align="center">
  17.          <input type="submit" name="Submit" value="确 定">    
  18.          <input type="reset"  value="重 填">
  19.        </div></td>
  20.    </tr>
  21.   </table>
  22. </form>
复制代码
3.add.php添加表数据;
  1. <?php
  2.    $movie = $_POST['movie'];
  3.    $url = $_POST['url'];
  4.    $content = $_POST['content'];
  5.    $now = date("Y- m- d  H:i:s");
  6.    if (trim($movie) == "" || trim($url) == "" || trim($content) == "")
  7.    {
  8.        echo "请填写完整数据再提交!";
  9.        exit();
  10.    }
  11.    else
  12.    {
  13.        $db = sqlite_open("db.sqlite");
  14.        $sql = "insert into test (movie,url,content,time) values ( '$movie','$url','$content','$now')";
  15.        $result = sqlite_query($db, $sql);
  16.        if ($result)
  17.        {
  18.            echo "数据添加成功";
  19.            echo "点击<a href='sql.php'>该处</a>继续添加";
  20.        }
  21.        else
  22.        {
  23.            echo "数据添加失败,请检查后重试";
  24.        }
  25.    }
  26. ?>
复制代码

4.  index.php视频点播主界面;
  1. <?php
  2.    $db = sqlite_open("db.sqlite"); //连接数据库
  3.    $sql = "select * from test ";
  4.    $query = sqlite_query($db, $sql); //选出表中数据
  5. ?>
  6. <html>
  7. <head>
  8. <title>视频点播</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  10. </head>
  11. <body>
  12. <table width="100%" border="1">
  13. <tr>
  14. <?php
  15.    while ($res = sqlite_fetch_array($query))
  16.    {
  17.        // show the data
  18.        echo "<td>";
  19.        echo "<a href=red.php?id=" . $res['id'] . ">" . $res['name'] . "</a>";
  20.        echo "</td>";
  21.    }
  22.     
  23. ?>
  24. <tr>
  25. </table>
  26. </body>
  27. </html>
复制代码

5.show.php视频点播播放界面;
  1. <?php
  2.    $id = $_GET['id']; //取得Id的值
  3.     
  4.    $db = sqlite_open("db.sqlite"); //连接数据库
  5.     
  6.    $sql = "select * from test where id='$id'";
  7.    $query = sqlite_query($db, $sql);
  8.    $res = sqlite_fetch_array($query);//取出符合要求的数据
  9.     
  10. ?>
  11. <HTML>
  12. <HEAD>
  13. <TITLE><?php echo $res['movie'] ;?></TITLE>
  14. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  15. <META content="MSHTML 6.00.2800.1106" name=GENERATOR>
  16. </HEAD>
  17. <BODY bgcolor="#F4FFF4">
  18. <table width="576" height="418" border="0" align="center" cellpadding="0" cellspacing="0">
  19.   <tr>
  20.    <td height="62" colspan="3"><img src="vod1.jpg" width="590" height="62"></td>
  21.   </tr>
  22.   <tr>
  23.    <td width="21%"><img src="vod2.jpg" width="130" height="290"></td>
  24.    <td width="55%">
  25.       <object ID=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=326 height=245>
  26.      <param name="src" value="[url]rtsp://localhost:554/<?php[/url] echo $res['url'] ;?>">
  27.      <param name="controls" value="ImageWindow">
  28.      <param name="autostart" value="true">
  29.      <param name="console" value="_master">
  30.      <embed width="326" height="245" src="[url]rtsp://localhost:554/<?php[/url] echo $res['url'] ;?>" controls="ImageWindow" console="_master" >
  31.      </embed>
  32.   </object>
  33.   <object ID=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=326 height=40>
  34.      <param name="controls" value="ControlPanel">
  35.      <param name="console" value="_master">
  36.      <embed width="326" height="40" src="cabin_w_layout.rpm"
  37.             controls="ControlPanel" console="_master" >
  38.      </embed>
  39.   </object></td>
  40.    <td width="24%"><img src="vod4.jpg" width="135" height="289"></td>
  41.   </tr>
  42.   <tr>
  43.    <td colspan="3"><img src="vod3.jpg" width="590" height="66"></td>
  44.   </tr>
  45. </table>
  46. </body>
  47. </html>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
发表于 2006 年 3 月 7 日 16:01:03 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
不知道再那裏學PHP+MYSQL啊?
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 3 月 7 日 16:14:31 | 显示全部楼层
有机会一定要试下SQLite
呵呵
[s:14]
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2006 年 3 月 7 日 16:26:27 | 显示全部楼层
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2006 年 3 月 7 日 16:34:19 | 显示全部楼层
引用第3楼esnak2006-03-07 16:26发表的“”:
http://blog.csdn.net/hfly2005/archive/2005/07/07/416378.aspx
呵呵!
正确!
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2006 年 3 月 7 日 15:50:41 | 显示全部楼层

用PHP+SQLITE制作简单的视频点播程序

本文介绍怎样利用 PHP  SQLITE 制作简单的视频点播程序,这是一个简单的视频点播程序,设有过多的美观界面。下面介绍一下程序文件的功能:
  1. init.php初始化数据库,及表文件;
  1. <?php
  2.    $db = sqlite_open("db.sqlite"); //创建并连接数据库
  3.    $sql = "create table test (id INTEGER PRIMARY KEY,movie text,url text,content text ,time  datatime);"; //创建表
  4.    $result = sqlite_query($db, $sql);
  5.    if ($result)
  6.    {
  7.        echo "数据初始化成功";
  8.        echo "<a href='sql.php'>进入创建数据文件</a>";
  9.    }
  10.    else
  11.    {
  12.        echo "数据初始化失败,请重试!";
  13.    }
  14. ?>
复制代码

2.form.php提供数据输入的表单;
  1. <form name="form1" method="post" action="add.php">
  2.   <table width="48%" border="0" align="center" cellpadding="0" cellspacing="0">
  3.    <tr>
  4.      <td width="36%" height="38"><div align="right">影片名称:</div></td>
  5.      <td width="64%"> <input type="text" name="movie"> </td>
  6.    </tr>
  7.    <tr>
  8.      <td height="39"><div align="right">影片地址:</div></td>
  9.      <td><input type="text" name="url"></td>
  10.    </tr>
  11.    <tr>
  12.      <td height="33"><div align="right">影片简介:</div></td>
  13.      <td><textarea name="content"></textarea></td>
  14.    </tr>
  15.    <tr>
  16.      <td height="53" colspan="2"><div align="center">
  17.          <input type="submit" name="Submit" value="确 定">    
  18.          <input type="reset"  value="重 填">
  19.        </div></td>
  20.    </tr>
  21.   </table>
  22. </form>
复制代码
3.add.php添加表数据;
  1. <?php
  2.    $movie = $_POST['movie'];
  3.    $url = $_POST['url'];
  4.    $content = $_POST['content'];
  5.    $now = date("Y- m- d  H:i:s");
  6.    if (trim($movie) == "" || trim($url) == "" || trim($content) == "")
  7.    {
  8.        echo "请填写完整数据再提交!";
  9.        exit();
  10.    }
  11.    else
  12.    {
  13.        $db = sqlite_open("db.sqlite");
  14.        $sql = "insert into test (movie,url,content,time) values ( '$movie','$url','$content','$now')";
  15.        $result = sqlite_query($db, $sql);
  16.        if ($result)
  17.        {
  18.            echo "数据添加成功";
  19.            echo "点击<a href='sql.php'>该处</a>继续添加";
  20.        }
  21.        else
  22.        {
  23.            echo "数据添加失败,请检查后重试";
  24.        }
  25.    }
  26. ?>
复制代码

4.  index.php视频点播主界面;
  1. <?php
  2.    $db = sqlite_open("db.sqlite"); //连接数据库
  3.    $sql = "select * from test ";
  4.    $query = sqlite_query($db, $sql); //选出表中数据
  5. ?>
  6. <html>
  7. <head>
  8. <title>视频点播</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  10. </head>
  11. <body>
  12. <table width="100%" border="1">
  13. <tr>
  14. <?php
  15.    while ($res = sqlite_fetch_array($query))
  16.    {
  17.        // show the data
  18.        echo "<td>";
  19.        echo "<a href=red.php?id=" . $res['id'] . ">" . $res['name'] . "</a>";
  20.        echo "</td>";
  21.    }
  22.     
  23. ?>
  24. <tr>
  25. </table>
  26. </body>
  27. </html>
复制代码

5.show.php视频点播播放界面;
  1. <?php
  2.    $id = $_GET['id']; //取得Id的值
  3.     
  4.    $db = sqlite_open("db.sqlite"); //连接数据库
  5.     
  6.    $sql = "select * from test where id='$id'";
  7.    $query = sqlite_query($db, $sql);
  8.    $res = sqlite_fetch_array($query);//取出符合要求的数据
  9.     
  10. ?>
  11. <HTML>
  12. <HEAD>
  13. <TITLE><?php echo $res['movie'] ;?></TITLE>
  14. <META http-equiv=Content-Type content="text/html; charset=gb2312">
  15. <META content="MSHTML 6.00.2800.1106" name=GENERATOR>
  16. </HEAD>
  17. <BODY bgcolor="#F4FFF4">
  18. <table width="576" height="418" border="0" align="center" cellpadding="0" cellspacing="0">
  19.   <tr>
  20.    <td height="62" colspan="3"><img src="vod1.jpg" width="590" height="62"></td>
  21.   </tr>
  22.   <tr>
  23.    <td width="21%"><img src="vod2.jpg" width="130" height="290"></td>
  24.    <td width="55%">
  25.       <object ID=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=326 height=245>
  26.      <param name="src" value="[url]rtsp://localhost:554/<?php[/url] echo $res['url'] ;?>">
  27.      <param name="controls" value="ImageWindow">
  28.      <param name="autostart" value="true">
  29.      <param name="console" value="_master">
  30.      <embed width="326" height="245" src="[url]rtsp://localhost:554/<?php[/url] echo $res['url'] ;?>" controls="ImageWindow" console="_master" >
  31.      </embed>
  32.   </object>
  33.   <object ID=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width=326 height=40>
  34.      <param name="controls" value="ControlPanel">
  35.      <param name="console" value="_master">
  36.      <embed width="326" height="40" src="cabin_w_layout.rpm"
  37.             controls="ControlPanel" console="_master" >
  38.      </embed>
  39.   </object></td>
  40.    <td width="24%"><img src="vod4.jpg" width="135" height="289"></td>
  41.   </tr>
  42.   <tr>
  43.    <td colspan="3"><img src="vod3.jpg" width="590" height="66"></td>
  44.   </tr>
  45. </table>
  46. </body>
  47. </html>
复制代码
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2025 年 2 月 2 日 06:43 , Processed in 0.122939 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表