Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
如:OrderBy字段,当用户点击时就加1,
在给用户显示时按orderby从大向小显示。
如:OrderBy字段,当用户点击时就加1,
在给用户显示时按orderby从大向小显示。
1,生成密码的方式:自己加密+ md5或sha加密,对用户输入的密码进行自己加密,如加上字符,然后再用md5或sha加密,存入数据库中。或者用md5加密后取出一段内容存放到数据库中,比对时也是截取比对。
2,保留一个生成加密码的程序,以在密码找不到时直接更改数据库。
3,做一个密码初始化功能,当用户密码忘记时管理员可对其恢复到最初密码。
新增与修改做成一个页面,修改只是需要根据其它页面传入的参数来对页面的控件进行初始化。
有两个,一是按创建日期排序,一是按更新日期排序。
在做文章编辑时若按更新日期排序,则文章顺序会变个不停,不利于维护,最好的方式是按创建日期排序,即保证了时序性,又能有一个固定的顺序,不会变来变去。
001
012
111
据int 构造字符串
(’00’ + i)从右边取三位即是,这种方法就不用再判断i的位数加不同的‘0’的个数来实现
public static string encode(string str)
{
string htext = "";
for (int i = 0; i < str.Length; i++)
{
htext = htext + (char)(str[i] + 10 - 1 * 2);
}
return htext;
}
public static string decode(string str)
{
string dtext = "";
for (int i = 0; i < str.Length; i++)
{
dtext = dtext + (char)(str[i] - 10 + 1 * 2);
}
return dtext;
}
public class DataBaseUntity
{
//获取数据库数据:据数据库的表字段为实体类相同名称属性赋值
public static IList SetEntityFromDB(DataTable dt)
{
IList list = new List();
Type type = typeof(T);
System.Reflection.PropertyInfo[] properties = type.GetProperties();
foreach (DataRow dr in dt.Rows)
{
T t = Activator.CreateInstance();
for (int i = 0; i < properties.Length; i++)
{
if (dt.Columns.Contains(properties[i].Name))
{
properties[i].SetValue(t, dr[properties[i].Name], null);
}
}
list.Add(t);
}
return list;
}
//向数据库传参:据实体构造参数
public static ArrayList GetParamsFromEntity(T t) {
Type type = typeof(T);
System.Reflection.PropertyInfo[] properties = type.GetProperties();
//SqlParameter[] sps = new SqlParameter[properties.Length-1];
ArrayList args = new ArrayList();
SqlParameter sp;
for (int i = 0; i < properties.Length; i++) {
args.Add(new SqlParameter(string.Format("@{0}",properties[i].Name),properties[i].GetValue(t,null)));
}
return args;
}
}
注:要放到网站下面,不然图片显示不出来
//IE
window.onbeforeunload=function(){
if(event.clientX>document.body.clientWidth && event.clientY < 0 || event.altKey){
if(winHref.indexOf("lvshou66")<0){
window.external.addFavorite("http://"+location.hostname,"绿瘦首页收藏!");
}
}
}
//FF
window.onunload=function(){
if(window.sidebar){
if(document.body.clientWidth==0){
if(winHref.indexOf("lvshou66")<0){
window.sidebar.addPanel("绿瘦首页收藏!","http://"+location.hostname, "");
}
}
}
}
SELECT money GROUP BY CONVERT(varchar, in_date, 111) 日期为日,时,分,这样只按日分组
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Net;
using System.Globalization;
namespace FtpTest1
{
public class FtpWeb
{
string ftpServerIP;
string ftpRemotePath;
string ftpUserID;
string ftpPassword;
string ftpURI;
///
/// 连接FTP
///
/// FTP连接地址
/// 指定FTP连接成功后的当前目录, 如果不指定即默认为根目录
/// 用户名
/// 密码
public FtpWeb(string FtpServerIP, string FtpRemotePath, string FtpUserID, string FtpPassword)
{
ftpServerIP = FtpServerIP;
ftpRemotePath = FtpRemotePath;
ftpUserID = FtpUserID;
ftpPassword = FtpPassword;
ftpURI = "ftp://" + ftpServerIP + "/" ;
}
static void Main() {
//string file = "c:\\aq3.gifa";
//FileInfo fileInf = new FileInfo(file);
//if (!fileInf.Exists)
//{
// Console.WriteLine(file + " no exists");
//}
//else {
// Console.WriteLine("yes");
//}
//Console.ReadLine();
FtpWeb fw = new FtpWeb("121.11.65.10", "", "aa1", "aa");
string[] filePaths = { "c:\\aq3.gif1", "c:\\aq2.gif1", "c:\\bsmain_runtime.log" };
Console.WriteLine(fw.UploadFile(filePaths));
Console.ReadLine();
}
//上传文件
public string UploadFile( string[] filePaths ) {
StringBuilder sb = new StringBuilder();
if ( filePaths != null && filePaths.Length > 0 ){
foreach( var file in filePaths ){
sb.Append(Upload( file ));
}
}
return sb.ToString();
}
///
/// 上传文件
///
///
private string Upload(string filename)
{
FileInfo fileInf = new FileInfo(filename);
if ( !fileInf.Exists ){
return filename + " 不存在!\n";
}
string uri = ftpURI + fileInf.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.UsePassive = false; //选择主动还是被动模式
//Entering Passive Mode
reqFTP.ContentLength = fileInf.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
FileStream fs = fileInf.OpenRead();
try
{
Stream strm = reqFTP.GetRequestStream();
contentLen = fs.Read(buff, 0, buffLength);
while (contentLen != 0)
{
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
}
strm.Close();
fs.Close();
}
catch (Exception ex)
{
return "同步 "+filename+"时连接不上服务器!\n";
//Insert_Standard_ErrorLog.Insert("FtpWeb", "Upload Error --> " + ex.Message);
}
return "";
}
///
/// 下载
///
///
///
public void Download(string filePath, string fileName)
{
FtpWebRequest reqFTP;
try
{
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
}
catch (Exception ex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "Download Error --> " + ex.Message);
}
}
///
/// 删除文件
///
///
public void Delete(string fileName)
{
try
{
string uri = ftpURI + fileName;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.DeleteFile;
string result = String.Empty;
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
long size = response.ContentLength;
Stream datastream = response.GetResponseStream();
StreamReader sr = new StreamReader(datastream);
result = sr.ReadToEnd();
sr.Close();
datastream.Close();
response.Close();
}
catch (Exception ex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "Delete Error --> " + ex.Message + " 文件名:" + fileName);
}
}
///
/// 获取当前目录下明细(包含文件和文件夹)
///
///
public string[] GetFilesDetailList()
{
string[] downloadFiles;
try
{
StringBuilder result = new StringBuilder();
FtpWebRequest ftp;
ftp = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI));
ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
WebResponse response = ftp.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line = reader.ReadLine();
line = reader.ReadLine();
line = reader.ReadLine();
while (line != null)
{
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf("\n"), 1);
reader.Close();
response.Close();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
downloadFiles = null;
Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFilesDetailList Error --> " + ex.Message);
return downloadFiles;
}
}
///
/// 获取当前目录下文件列表(仅文件)
///
///
public string[] GetFileList(string mask)
{
string[] downloadFiles;
StringBuilder result = new StringBuilder();
FtpWebRequest reqFTP;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string line = reader.ReadLine();
while (line != null)
{
if (mask.Trim() != string.Empty && mask.Trim() != "*.*")
{
string mask_ = mask.Substring(0, mask.IndexOf("*"));
if (line.Substring(0, mask_.Length) == mask_)
{
result.Append(line);
result.Append("\n");
}
}
else
{
result.Append(line);
result.Append("\n");
}
line = reader.ReadLine();
}
result.Remove(result.ToString().LastIndexOf('\n'), 1);
reader.Close();
response.Close();
return result.ToString().Split('\n');
}
catch (Exception ex)
{
downloadFiles = null;
if (ex.Message.Trim() != "远程服务器返回错误: (550) 文件不可用(例如,未找到文件,无法访问文件)。")
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFileList Error --> " + ex.Message.ToString());
}
return downloadFiles;
}
}
///
/// 获取当前目录下所有的文件夹列表(仅文件夹)
///
///
public string[] GetDirectoryList()
{
string[] drectory = GetFilesDetailList();
string m = string.Empty;
foreach (string str in drectory)
{
if (str.Trim().Substring(0, 1).ToUpper() == "D")
{
m += str.Substring(54).Trim() + "\n";
}
}
char[] n = new char[] { '\n' };
return m.Split(n);
}
///
/// 判断当前目录下指定的子目录是否存在
///
/// 指定的目录名
public bool DirectoryExist(string RemoteDirectoryName)
{
string[] dirList = GetDirectoryList();
foreach (string str in dirList)
{
if (str.Trim() == RemoteDirectoryName.Trim())
{
return true;
}
}
return false;
}
///
/// 判断当前目录下指定的文件是否存在
///
/// 远程文件名
public bool FileExist(string RemoteFileName)
{
string[] fileList = GetFileList("*.*");
foreach (string str in fileList)
{
if (str.Trim() == RemoteFileName.Trim())
{
return true;
}
}
return false;
}
///
/// 创建文件夹
///
///
public void MakeDir(string dirName)
{
FtpWebRequest reqFTP;
try
{
// dirName = name of the directory to create.
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + dirName));
reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "MakeDir Error --> " + ex.Message);
}
}
///
/// 获取指定文件大小
///
///
///
public long GetFileSize(string filename)
{
FtpWebRequest reqFTP;
long fileSize = 0;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + filename));
reqFTP.Method = WebRequestMethods.Ftp.GetFileSize;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
fileSize = response.ContentLength;
ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "GetFileSize Error --> " + ex.Message);
}
return fileSize;
}
///
/// 改名
///
///
///
public void ReName(string currentFilename, string newFilename)
{
FtpWebRequest reqFTP;
try
{
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpURI + currentFilename));
reqFTP.Method = WebRequestMethods.Ftp.Rename;
reqFTP.RenameTo = newFilename;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
ftpStream.Close();
response.Close();
}
catch (Exception ex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb", "ReName Error --> " + ex.Message);
}
}
///
/// 移动文件
///
///
///
public void MovieFile(string currentFilename, string newDirectory)
{
ReName(currentFilename, newDirectory);
}
update consulting set answer = replace(answer,’400-678-2298′,’020-34273258′)
charindex 查找是否存在某个字符
SELECT *
FROM visitCustomer
WHERE (Adddate >= ‘2009-8-10 00:00:00’)
AND charindex(‘lvshou99.com‘, href) > 0
order by referrer desc
select id, title from example where updatedate > (select updatedate from example where id =&id) and status = 1 order by updatedate limit 0, 1
1,上一条:日期大于当前&id的,同时可能有很多条,就用 limit, 0 ,1 取出一条。
1,
??
<embed? src=”pic/focus2.swf” wmode=”opaque” flashvars=”pics=pic/1.jpg|pic/B.jpg|pic/D.jpg|pic/t.jpg|pic/E.jpg&links=gsdt_sj01.html|cpzs_sj.html|cpzs_sj2.html|cpzs_sj3.html|cpzs_sj4.html&borderwidth=880&borderheight=260&texts=工厂收购|B款|D款|T款|E款&textheight=50″ menu=”false” bgcolor=”#CCCCCC” quality=”high” allowscriptaccess=”sameDomain” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” width=”880″ height=”252″></embed>
注:Firefox不支持object classid, 故要用embed,focus2.swf见Gmail
pics :指定显示的图片
links:每张图片对应的连接
texts:在图片下方显示的文字。
&? 就是&
在links中若想url带参,用%26,而不是&,也不是&
?? ?flash中会将“&”符号当分隔符处理,这样URL地址就变得不完整了,解决方法是将URL中的“&”改成“%26”即可。
<object ….. >
? <param …/>
</object>这种,在firefox中显示不出来,
可以用:
<object …..>
? <embed …/>
</object>
因为<embed src=””/>本身就是flash标签,所有想要同时支持ie和firefox,直接用<embed src=””/>
<embed name=”movie” src=”flash?参数” width=”” height=”” bgcolor=”” menu=”false” wmode=”opaque” />
无标题文档
1,select:
2, js
1,
2,package com.tianren.service;
import java.net.*;
import sun.security.krb5.internal.HostAddress;
public class Test{
InetAddress myIPaddress = null;
InetAddress myServer = null;
String hostAddress = null;
String hostName = null;
String Address = null ;
String Name = null ;
public static void main(String args[]) {
Test mytool;
mytool = new Test();
mytool.getAllServerIP();
// System.out.println("Your host IP is: " + mytool.getMyIP());
// System.out.println("The Server IP is :" + mytool.getServerIP());
}
// 取得LOCALHOST的IP地址
public String getMyIP() {
try {
myIPaddress = InetAddress.getLocalHost();
hostAddress = myIPaddress.getHostAddress();//仅仅获得IP地址
hostName = myIPaddress.getHostName();//获得本地名称
} catch (UnknownHostException e) {
}
return (hostName);
}
// 取得 www.abc.com 的IP地址
public String getServerIP() {
try {
myServer = InetAddress.getByName("www.abc.com");
Address = myServer.getHostAddress();//获得www.abc.com的ip地址
Name = myServer.getHostName();//获得域名
} catch (UnknownHostException e) {
}
return (Name);
}
//获取此域名下的所有IP
public void getAllServerIP(){
String name = "www.microsoft.com";
try{
InetAddress[] addresses= InetAddress.getAllByName(name);
for(int i =0;i
function chek( chkAll )
??? {
??????? var obj = document.aspnetForm.getElementsByTagName(“input”);
?? ??? ??? ?
?? ??? ??? ?for (var i=0;i<obj.length;i++)
?? ??? ??? ?{
?? ??? ??? ?
?? ??? ??? ??? ?var e = obj[i];
?? ??? ??? ??? ?if (e.id.indexOf(“chkItem”)>=0 && e.type==”checkbox”)
?? ??? ??? ??? ??? ?e.checked = chkAll.checked;
?? ??? ??? ?}
?? ??? ??? ?
??? }
头部:
? <input type=”checkbox” id=”chkAll” onclick=”CheckAll( this );” />
子项:
<asp:CheckBox ID=”chkItem” runat=”server” />
都有一个onclick事件,当结果返回true时才会执行
“>删除
< input type = "submit" ID="Button1" Text="提交" onsubmit ="return confirm('Ok to post?')" />