注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

一车,一房,一个温暖家

10万左右的车,80平方的房子,这是我奋斗的暖暖的家

 
 
 

日志

 
 

引用 common.cs   

2015-06-20 20:09:12|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
本文转载自yjdd005@126《common.cs》

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Common 的摘要说明
/// </summary>
public class Common
{
    STDB web;
 public Common()
 {
        web = new STDB();
 }
    public bool adlogin(string stb,string tbname,string tbpwd,string name, string pwd)
    {
        SqlDataReader rd;
        pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5").ToString().ToLower().Substring(8, 16);
        string sql = "select * from " + stb + "  where " + tbname + "='" + name + "' and " + tbpwd + "='" + pwd + "'";
        rd = web.ExcReadersql(sql);
        if (rd.Read())
        {
            rd.Close();
            return true;
        }
        else
        {
            rd.Close();
            return false;
        }
    }
    public bool chkreg(string tb, string tbname, string name)
    {
        string sql = "select * from " + tb + "  where " + tbname + "='" + name + "'";
        SqlDataReader rd;
        rd = web.ExcReadersql(sql);
        if (rd.Read())
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public void userlgin(string uid,string stip)
    {
        web.Excnosql("insert into AdminLog(uid,lgintime,lgip)values('" + uid + "',getdate(),'" + stip + "')");
    }
    public void Adminlgin(string uid, string stip)
    {
        web.Excnosql("insert into userlog(AdminUid,Adminlgintime,Adminlgip)values('" + uid + "',getdate(),'" + stip + "')");
    }
    public void weberl(string sql, string url, string say)
    {

        if (web.Excnosql(sql) == true)
        {
            web.say(say + "成功!");
            if (url != "")
            {
                web.Goto(url);
            }
        }
        else
        {
            web.say(say + "失败!");
            if (url != "")
            {
                web.Goto(url);
            }
        }
    }
    public string tabid(string tb, string tbname, string name)
    {
        string sql = "select top 1 * from " + tb + "  where " + tbname + "='" + name + "' order by id desc";
        SqlDataReader rd;
        rd = web.ExcReadersql(sql);
        if (rd.Read())
        {
            return rd["id"].ToString();
        }
        else
        {
            return "";
        }
    }
    public string tabchkstr(string tb, string tbchkname,string tbname,string name)
    {
        string sql = "select " + tbchkname + " from " + tb + "  where " + tbname + "='" + name + "' order by id desc";
        SqlDataReader rd;
        rd = web.ExcReadersql(sql);
        if (rd.Read())
        {
            return rd[0].ToString();
        }
        else
        {
            return "";
        }
    }
    public string tabchkstrid(string tb, string tbchkname, string tbname, string name)
    {
        string sql = "select " + tbchkname + " from " + tb + "  where " + tbname + "=" + name + " order by id desc";
        SqlDataReader rd;
        rd = web.ExcReadersql(sql);
        if (rd.Read())
        {
            return rd[0].ToString();
        }
        else
        {
            return "";
        }
    }
}

  评论这张
 
阅读(7)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018