# Table structure for table 'topic' #主题 CREATE TABLE topic ( id bigint(20) unsigned NOT NULL auto_increment, topic varchar(50) NOT NULL, #主题名称 memo text NOT NULL, #备注 PRIMARY KEY (id) ); # -------------------------------------------------------- # Table structure for table 'type' CREATE TABLE type ( id bigint(20) unsigned DEFAULT '0' NOT NULL, type varchar(50) NOT NULL, #类别名称 memo text NOT NULL, #备注 PRIMARY KEY (id) ); # -------------------------------------------------------- # Table structure for table 'downcontent' CREATE TABLE downcontent ( id bigint(20) unsigned DEFAULT '0' NOT NULL, topic_id bigint(20) DEFAULT '0' NOT NULL, #主题ID type_id bigint(20) DEFAULT '0' NOT NULL, #类别ID name varchar(50) NOT NULL, #名称 filename varchar(20) NOT NULL, #文件名 size varchar(30) NOT NULL, #文件大小 time date DEFAULT '0000-00-00' NOT NULL,#日期 info text NOT NULL, #简介 count bigint(20) DEFAULT '0' NOT NULL, #下载次数 memo text NOT NULL, #备注 PRIMARY KEY (id), KEY(topic_id,type_id) );
好事做到底,建格用户表 CREATE TABLE user ( id bigint(20) unsigned DEFAULT '0' NOT NULL, account varchar(30) NOT NULL, password varchar(30) NOT NULL, type enum('admin','user') DEFAULT 'user' NOT NULL, PRIMARY KEY (id) ); 用户验证完了以后如果是admin类型的用户的话就到管理页面,最好用session保护,否则别人可能会绕过验证的,php的upload函数很简单copy就行了!
贴个例子吧: <?php // set up basic connection $conn_id = ftp_connect("$ftp_server"); // login with username and password $login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass"); // check connection if ((!$conn_id) || (!$login_result)) { echo "Ftp connection has failed!"; echo "Attempted to connect to $ftp_server for user $user"; die; } else { echo "Connected to $ftp_server, for user $user"; }// upload the file $upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY); // check upload status if (!$upload) { echo "Ftp upload has failed!"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file"; }// close the FTP stream ftp_quit($conn_id); ?>
ftp_pwd — Returns the current directory name ftp_cdup — Changes to the parent directory ftp_chdir — Changes directories on a FTP server ftp_mkdir — Creates a directory ftp_rmdir — Removes a directory ftp_nlist — Returns a list of files in the given directory.就这几个函数了!和FTP的命令差不多
CREATE TABLE topic (
id bigint(20) unsigned NOT NULL auto_increment,
topic varchar(50) NOT NULL, #主题名称
memo text NOT NULL, #备注
PRIMARY KEY (id)
);
# --------------------------------------------------------
# Table structure for table 'type'
CREATE TABLE type (
id bigint(20) unsigned DEFAULT '0' NOT NULL,
type varchar(50) NOT NULL, #类别名称
memo text NOT NULL, #备注
PRIMARY KEY (id)
);
# --------------------------------------------------------
# Table structure for table 'downcontent'
CREATE TABLE downcontent (
id bigint(20) unsigned DEFAULT '0' NOT NULL,
topic_id bigint(20) DEFAULT '0' NOT NULL, #主题ID
type_id bigint(20) DEFAULT '0' NOT NULL, #类别ID
name varchar(50) NOT NULL, #名称
filename varchar(20) NOT NULL, #文件名
size varchar(30) NOT NULL, #文件大小
time date DEFAULT '0000-00-00' NOT NULL,#日期
info text NOT NULL, #简介
count bigint(20) DEFAULT '0' NOT NULL, #下载次数
memo text NOT NULL, #备注
PRIMARY KEY (id),
KEY(topic_id,type_id)
);
CREATE TABLE user (
id bigint(20) unsigned DEFAULT '0' NOT NULL,
account varchar(30) NOT NULL,
password varchar(30) NOT NULL,
type enum('admin','user') DEFAULT 'user' NOT NULL,
PRIMARY KEY (id)
);
用户验证完了以后如果是admin类型的用户的话就到管理页面,最好用session保护,否则别人可能会绕过验证的,php的upload函数很简单copy就行了!
<?php
// set up basic connection
$conn_id = ftp_connect("$ftp_server"); // login with username and password
$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass"); // check connection
if ((!$conn_id) || (!$login_result)) {
echo "Ftp connection has failed!";
echo "Attempted to connect to $ftp_server for user $user";
die;
} else {
echo "Connected to $ftp_server, for user $user";
}// upload the file
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY); // check upload status
if (!$upload) {
echo "Ftp upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}// close the FTP stream
ftp_quit($conn_id);
?>
ftp_cdup — Changes to the parent directory
ftp_chdir — Changes directories on a FTP server
ftp_mkdir — Creates a directory
ftp_rmdir — Removes a directory
ftp_nlist — Returns a list of files in the given directory.就这几个函数了!和FTP的命令差不多
account:www
pass:www
我觉得这个上传够用了,用ftp有点浪费!这个帐号两天有效!
ftp_mkdir()
ftp_chdir()
ftp_put()呵呵~~明白了~~:)散分了~~:)