예제 #1
0
    public string insert(string username, string password, string email, string myid, string myidkey, string regip, string regdate, string lastloginip, string lastlogintime, string salt)
    {
        string sql = "";
        try
        {
            MySqlConnection connection1 = new MySqlConnection("Database=allin;Data Source = localhost;User Id = sasa;Password = takeeasy822822");
            mysqldata_conn mysqlcn = new mysqldata_conn();

            MySqlCommand command1 = new MySqlCommand();
            connection1.Open();
            MySqlDataAdapter da1 = new MySqlDataAdapter();
            DataSet ds = new DataSet();
            sql = "insert into uc_members (username,password,email,myid,myidkey,regip,regdate,lastloginip,lastlogintime,salt) values ('" + username + "','" + password + "','" + email + "','" + myid + "','" + myidkey + "','" + regip + "'," + regdate + "," + lastloginip + "," + lastlogintime + ",'" + salt + "')";

            command1 = new MySqlCommand(sql, connection1);
            command1.ExecuteNonQuery();
            command1 = new MySqlCommand("SELECT LAST_INSERT_ID()", connection1);
            da1.SelectCommand = command1;

            da1.Fill(ds, "aa");
            connection1.Close();
            return ds.Tables["aa"].Rows[0][0].ToString();
        }
        catch (Exception ex)
        {
            this.Response.Write(sql);
            return "";
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        check ck = new check();
        string u = "0";

        u = ck.CheckNumber(GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();

        string sql = "";

        sql = "";

        sql = "SELECT UCenterHomeUid FROM TB_User WHERE userid = " + u;

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "tb_user");

        string uid = "0";

        uid = ds.Tables["tb_user"].Rows[0][0].ToString();

        mysqldata_conn mysqlcn = new mysqldata_conn();

        //以下为获得“我的好友”
        sql = "SELECT friendid FROM uc_friends WHERE uid = " + uid;

        ds = mysqlcn.mdb_ds(sql, "uc_friends");

        string uidlist = "";

        for (int i = 0; i < ds.Tables["uc_friends"].Rows.Count; i++)
        {
            if (uid != "")
            {
                uidlist += ds.Tables["uc_friends"].Rows[i][0].ToString() + ",";
            }

        }

        uidlist += "0";

        sql = "SELECT TOP 8 * FROM V_SHOW_ALL WHERE UCenterHomeUid in (" + uidlist + ") ORDER BY POSTDATE DESC";

        ds = cn.mdb_ds(sql, "myfriends");

        Repeater1.DataSource = ds.Tables["myfriends"].DefaultView;
        Repeater1.DataBind();
    }
예제 #3
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        check ck = new check();
        data_conn cn = new data_conn();
        string sql = "";
        sql = sql + "select * ";
        sql = sql + "from TB_User ";
        sql = sql + "where UserName = '******'";
        DataSet ds = new DataSet();
        ds = cn.mdb_ds(sql, "T_User");

        if (ds.Tables["T_User"].Rows.Count > 0)
        {
            MessageBox("opfail", "用户名已有人使用");
            return;
        }
        else if (UserPassword.Value.Length < 6 || UserPassword.Value.Length > 15)
        {
            MessageBox("opfail", "密码长度必须在6~15个字符之间");
            return;
        }
        else if (Company.Value == "" || RealName.Value == "" || Phone.Value == "" || UserEmail.Value == "")
        {
            MessageBox("opfail", "必填项不能为空");
            return;
        }
        else if (!isEmail(UserEmail.Value))
        {
            MessageBox("opfail", "邮箱格式不正确");
            return;
        }
        else if (UserPassword.Value != UserPassword2.Value)
        {
            MessageBox("opfail", "2次密码不一致");
            return;
        }
        else if (!Checkbox1.Checked)
        {

            MessageBox("opfail", "请仔细阅读并同意服务条款");
            return;
        }

        string recommendUserID;
        if (this.Request.Cookies["recommendUserID"] == null)
        {
            recommendUserID = "0";
        }
        else
        {
            if (this.Request.Cookies["recommendUserID"].Value == "")
            {
                recommendUserID = "0";
            }
            else
            {
                recommendUserID = Request.Cookies["recommendUserID"].Value;
            }
        }

        if (this.Request.Cookies["UID"] == null)
        {

        }
        else
        {
            if (Request.Cookies["UID"].Value == "")
            {

            }
            else
            {
                data_conn Uidcn = new data_conn();
                DataSet Uidds = Uidcn.mdb_ds("select UserID from TB_User where UCenterHomeUid=" + Request.Cookies["UID"].Value, "uid");
                if (Uidds.Tables["uid"].Rows.Count == 1)
                {
                    recommendUserID = Uidds.Tables["uid"].Rows[0][0].ToString();
                    mysqldata_conn mycn = new mysqldata_conn();
                    mycn.mdb_exe("update uchome_space set credit=credit+10 where uid=" + Request.Cookies["UID"].Value);
                }
            }
        }

        sql = "";
        sql += "INSERT INTO ";
        sql += "TB_User ";
        sql += "(";
        sql += "UserName, ";
        sql += "UserPassword, ";
        sql += "UserEmail, ";
        sql += "UserPoint, ";
        sql += "RealName, ";
        sql += "IfPass, ";
        sql += "ifvip, ";
        sql += "ifmanage, ";
        sql += "CompanyName, ";
        sql += "Phone, ";
        sql += "Regtime)";
        sql += "VALUES ";
        sql += "(";

        sql += "'" + ck.CheckInput(UserName.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(UserPassword.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(UserEmail.Value.ToString()) + "', ";
        sql += "0, ";
        sql += "'" + ck.CheckInput(RealName.Value.ToString()) + "', ";

        sql += "1, ";
        sql += "1, ";
        sql += "0, ";
        sql += "'" + ck.CheckInput(Company.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Phone.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(DateTime.Now.ToString()) + "' ";
        sql += ")";
        cn.mdb_exe(sql);
        sql = "SELECT * FROM TB_User WHERE UserName = '******'";

        ds = cn.mdb_ds(sql, "user");

        string sql_account = "insert into TB_ORDER_ACCOUNT (userid) VALUES (" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ")";
        cn.mdb_exe(sql_account);
        //增加账户信息

        AllinOrder AllinOrder1 = new AllinOrder();
        AllinOrder1.SetOrderTry(ds.Tables["user"].Rows[0]["UserID"].ToString());

        if (ds.Tables["user"].Rows.Count != 0)
        {
            try
            {
                points p = new points();
                p.AddNewPoints(ds.Tables["user"].Rows[0]["UserID"].ToString());
            }
            catch (Exception ex)
            {

            }

            string userid = ds.Tables["user"].Rows[0]["UserID"].ToString();
            string usernm = ds.Tables["user"].Rows[0]["UserName"].ToString();
            string ifvip = ds.Tables["user"].Rows[0]["ifvip"].ToString();
            string ifmanage = ds.Tables["user"].Rows[0]["ifmanage"].ToString();
            string realname = ds.Tables["user"].Rows[0]["realname"].ToString();
            string useremail = ds.Tables["user"].Rows[0]["useremail"].ToString();

            Response.Cookies["user_id"].Value = userid;
            Response.Cookies["user_name"].Value = Server.UrlEncode(usernm);
            Response.Cookies["ifvip"].Value = ifvip;
            Response.Cookies["ifmanage"].Value = ifmanage;

            Response.Cookies["user_id"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["user_name"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["ifvip"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["ifmanage"].Expires = DateTime.Now.AddDays(365);

            Response.Cookies["realname"].Value = Server.UrlEncode(realname);
            Response.Cookies["useremail"].Value = Server.UrlEncode(useremail);

            Response.Cookies["realname"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["useremail"].Expires = DateTime.Now.AddDays(365);

            if (recommendUserID != "0")
            {
                cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + userid + "," + recommendUserID + ")");
                cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + recommendUserID + "," + userid + ")");
                Mark mark = new Mark();
                mark.MarkOperate(Convert.ToInt32(recommendUserID), 10, "推荐会员", Convert.ToInt32(userid));
            }

            mysqldata_conn mysqlcn = new mysqldata_conn();
            DataSet dscount = mysqlcn.mdb_ds("select * from uc_members where username='******'", "ucenter");

            if (dscount.Tables["ucenter"].Rows.Count == 0)
            {
                Random r = new Random();
                string salt = r.Next().ToString().Substring(0, 6);
                string username = usernm;
                string password = MD5(MD5(ds.Tables["user"].Rows[0]["UserPassword"].ToString()) + salt);
                string email = ds.Tables["user"].Rows[0]["UserEmail"].ToString();
                string myid = "";
                string myidkey = "";
                string regip = Page.Request.UserHostAddress;
                string regdate = UnixTimestamp();
                string lastloginip = "0";
                string lastlogintime = "0";

                string id = this.insert(username, "8fc24ae194289b94e36272a5f9882611", email, myid, myidkey, regip, regdate, lastloginip, lastlogintime, "594882");

                if (id != "")
                {
                    mysqlcn.mdb_exe("insert into uchome_member (uid,username,password) values (" + id + ",'','" + MD5(id + "|" + UnixTimestamp()) + "')");
                    mysqlcn.mdb_exe("insert into uc_memberfields (uid,blacklist) values (" + id + ",'')");

                    string myemail;
                    string qq;
                    string msn;
                    if (ds.Tables["user"].Rows[0]["UserEmail"].ToString() != "")
                    {
                        myemail = ds.Tables["user"].Rows[0]["UserEmail"].ToString();
                    }
                    else
                    {
                        myemail = "";
                    }

                    qq = "";
                    msn = "";

                    mysqlcn.mdb_exe("insert into uchome_spacefield (uid,email,qq,msn,blood,birthprovince,birthcity,resideprovince,residecity,note,spacenote,authstr,theme,css,privacy,friend,feedfriend,sendmail) values (" + id + ",'" + myemail + "','" + qq + "','" + msn + "','','','','','','','','','','','','','','')");

                    //插入实名
                    string namestatus = "0";

                    //实名

                    mysqlcn.mdb_exe("insert into uchome_space (uid,groupid,username,name,namestatus,domain,dateline,ip) values (" + id + ",5,'" + username + "',''," + namestatus + ",''," + UnixTimestamp() + ",'" + Page.Request.UserHostAddress + "')");
                    cn.mdb_exe("update TB_User set UCenterHomeUid=" + id + " where UserId=" + userid);

                    //在ucenter中添加推荐好友

                    if (Request.Cookies["UID"] == null)
                    {

                    }
                    else
                    {
                        if (Request.Cookies["UID"].Value == "")
                        {

                        }

                        else
                        {

                            string gid = "0";
                            if (this.Request.Cookies["g"] == null)
                            {

                            }
                            else
                            {
                                if (Request.Cookies["g"].Value == "")
                                {

                                }
                                else
                                {
                                    gid = Request.Cookies["g"].Value;
                                    try
                                    {
                                        int g = Convert.ToInt32(gid);

                                        if (g > 0 && g < 8)
                                        {
                                            gid = g.ToString();
                                        }
                                        else
                                        {
                                            gid = "0";
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        gid = "0";
                                    }
                                }

                            }

                            DataSet myUidds = mysqlcn.mdb_ds("select username from uc_members where uid=" + Request.Cookies["UID"].Value, "uid");
                            mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + id + "," + Request.Cookies["UID"].Value + ",'" + myUidds.Tables["uid"].Rows[0][0].ToString() + "',1,0,''," + UnixTimestamp() + ")");
                            mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + Request.Cookies["UID"].Value + "," + id + ",'" + username + "',1," + gid + ",''," + UnixTimestamp() + ")");
                            mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + id + "," + Request.Cookies["UID"].Value + ",3,'')");
                            mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + Request.Cookies["UID"].Value + "," + id + ",3,'')");
                        }
                    }

                }

            }
            Response.Cookies["useremail"].Value = UserEmail.Value.ToString();

            try
            {
                SendEmail(UserName.Value.ToString(), UserPassword.Value.ToString(), UserEmail.Value.ToString(), "GB");
            }
            catch (Exception ex)
            {
                Response.Redirect("trysuccess.aspx");
            }

        }
    }
예제 #4
0
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        check ck = new check();
        order order1 = new order();
        string u = ck.CheckNumber(order1.GetRequestQueryString("u", "0"));

        mysqldata_conn mycn = new mysqldata_conn();
        data_conn cn=new data_conn ();
        DataSet ds = cn.mdb_ds("select * from TB_User where UserID=" + u,"UCenterHomeUid");
        string fuid = ds.Tables["UCenterHomeUid"].Rows[0]["UCenterHomeUid"].ToString();
        //Response.Write("select * from TB_User where UserID=" + Request.Cookies["user_id"].Value.ToString());
        ds = cn.mdb_ds("select * from TB_User where UserID=" + Request.Cookies["user_id"].Value.ToString(), "UCenterHomeUid");
        string uid = ds.Tables["UCenterHomeUid"].Rows[0]["UCenterHomeUid"].ToString();
        string fuername = ds.Tables["UCenterHomeUid"].Rows[0]["UCenterHomeUid"].ToString();
        mycn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,dateline) values (" + uid + "," + fuid + ",'',1," + UnixTimestamp() + ")");

        mycn.mdb_exe("insert into uc_friends (uid,friendid,direction) values (" + uid + "," + fuid + ",3)");
        mycn.mdb_exe("insert into uc_friends (uid,friendid,direction) values (" + fuid + "," + uid + ",3)");

        ScriptManager.RegisterStartupScript(ImageButton2, ImageButton2.GetType(), "Alert", "alert('好友添加成功');window.location.href='friend.aspx'", true);
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();
        order order1 = new order();
        check ck = new check();
        string u = ck.CheckNumber(order1.GetRequestQueryString("u", "0"));
        string myu = ck.CheckNumber(order1.GetRequestCookies("user_id", ""));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();

        string sql = "SELECT * FROM TB_USER WHERE userid = " + u;

        ds = cn.mdb_ds(sql, "user");

        Label1.Text = ds.Tables["user"].Rows[0]["companyname"].ToString();
        Label9.Text = ds.Tables["user"].Rows[0]["postnumber"].ToString();
        Label11.Text = ds.Tables["user"].Rows[0]["address"].ToString();

        Label4.Text = "<span><a href=\"/company/" + setkey(u) + "\" style='font-size:14px; font-weight:bold; color:#FF6600;' target=\"_blank\">" + ds.Tables["user"].Rows[0]["realname"].ToString() + "</a></span>";
        Literal25.Text = "<a href=\"/member/pm_detail.aspx?pid=1&cid=" + u + "\" target=\"_blank\"><img src=\"/images/fcl/bot_1.jpg\"  border=\"0\" style= 'margin-top: 12px;'/></a>";

        if ((bool)ds.Tables["user"].Rows[0]["HeadURL"] == true)
        {
            imghead.Src = "/member/Head/" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ".jpg";
        }
        else
        {
            imghead.Src = "/member/Head/default.jpg";
        }

        LtrStars1.Text = Star1(ds.Tables["user"].Rows[0]["star_allin"].ToString());
        LtrStars2.Text = Star2(ds.Tables["user"].Rows[0]["star_user"].ToString());

        try
        {
            ImageButton1.ImageUrl = "/images/get/company_tel.aspx?u=" + setkey(u);
            ImageButton3.ImageUrl = "/images/get/company_email.aspx?u=" + setkey(u);
            ImageButton4.ImageUrl = "/images/get/company_mobile.aspx?u=" + setkey(u);
        }
        catch
        {

        }

        AllinUser AllinUser1 = new AllinUser();

        mysqldata_conn mycn = new mysqldata_conn();
        sql = "SELECT uid FROM uc_friends WHERE uid = " + AllinUser1.GetUserDetail(myu)[10] + " AND friendid = " + ds.Tables["user"].Rows[0]["UCenterHomeUid"].ToString();
        //Response.Write(sql);
        DataSet dsu = new DataSet();
        dsu = mycn.mdb_ds(sql, "ufriend");

        if (dsu.Tables["ufriend"].Rows.Count > 0)
        {
            ImageButton2.Visible = false;
            Label2.Visible = true;
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        check ck = new check();
        string u = "0";

        u = ck.CheckNumber(GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();

        string sql = "";

        sql = "SELECT UCenterHomeUid FROM TB_User WHERE userid = " + u;

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "tb_user");

        string uid = "0";

        uid = ds.Tables["tb_user"].Rows[0][0].ToString();

        if (uid == "")
        {
            uid = "0";
        }

        mysqldata_conn mysqlcn = new mysqldata_conn();

        //以下为获得“我的好友”
        sql = "SELECT friendid FROM uc_friends WHERE uid = " + uid;

        ds = mysqlcn.mdb_ds(sql, "uc_friends");

        ltrMyFriendCount.Text = ds.Tables["uc_friends"].Rows.Count.ToString();

        string uidlist = "";

        for (int i = 0; i < ds.Tables["uc_friends"].Rows.Count; i++)
        {
            if (uid != "")
            {
                uidlist += ds.Tables["uc_friends"].Rows[i][0].ToString() + ",";
            }

        }

        uidlist += "999999";

        sql = "SELECT TOP 3 * FROM TB_User WHERE UCenterHomeUid in (" + uidlist + ") ORDER BY USERID";

        ds = cn.mdb_ds(sql, "myfriends");

        RptMyFriends.DataSource = ds.Tables["myfriends"].DefaultView;
        RptMyFriends.DataBind();

        //以下为获得“最近来访”
        sql = "SELECT vuid FROM uchome_visitor WHERE uid = " + uid + " ORDER BY dateline DESC ";

        //Response.Write(sql);

        ds = mysqlcn.mdb_ds(sql, "uchome_visitor");

        ltrVisitFriendCount.Text = ds.Tables["uchome_visitor"].Rows.Count.ToString();

        uidlist = "";

        for (int i = 0; i < ds.Tables["uchome_visitor"].Rows.Count; i++)
        {
            if (uid != "")
            {
                uidlist += ds.Tables["uchome_visitor"].Rows[i][0].ToString() + ",";
            }
        }

        uidlist += "999999";

        sql = "SELECT TOP 3 * FROM TB_User WHERE UCenterHomeUid in (" + uidlist + ") ";
        sql += "ORDER BY PATINDEX('% ' + CONVERT(nvarchar(4000), UCenterHomeUid) + ' %', ' ' + CONVERT(nvarchar(4000), REPLACE('" + uidlist + "',',', ' , ')) + ' ')";

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "visitfriends");

        RptVisitFriends.DataSource = ds.Tables["visitfriends"].DefaultView;
        RptVisitFriends.DataBind();
    }
예제 #7
0
    protected void submitbtn_ServerClick(object sender, EventArgs e)
    {
        check check1 = new check();
        GetRequest GetRequest1 = new GetRequest();

        string u = "";
        u = check1.CheckNumber(GetRequest1.GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        DataSet ds1 = new DataSet();
        DataSet ds2 = new DataSet();
        string sql = "";

        string surl = url2.Value.Trim();
        string vurl = "";

        if (surl.IndexOf("http://") == -1)
        {
            surl = "http://" + surl;
        }

        sql = "SELECT * FROM TB_REPASTE_VIDEO WHERE '" + check1.CheckRecord(surl) + "' LIKE '%' + vtag + '%'";

        ds = cn.mdb_ds(sql, "video");

        if (ds.Tables["video"].Rows.Count > 0)
        {

            string regexp1 = ds.Tables["video"].Rows[0]["surl"].ToString();
            string regexp2 = ds.Tables["video"].Rows[0]["durl"].ToString();

            Match TitleMatch = Regex.Match(surl, regexp1, RegexOptions.IgnoreCase | RegexOptions.Multiline);

            string urlkey = TitleMatch.Groups[1].Value.ToString();
            if (urlkey != "")
            {
                vurl = Regex.Replace(regexp2, "urlkey", urlkey);
            }

        }

        sql = "INSERT INTO TB_REPASTE_TOPIC (topic,txt,userid,url) VALUES ('" + check1.CheckInput(title.Value) + "','" + vurl + "<br/>" + check1.CheckRecord(HiddenField1.Value) + "'," + u + ",'" + check1.CheckInput(url2.Value) + "'); SELECT @@identity ";

        ds1 = cn.mdb_ds(sql, "topic");

        string redirect_tid = ds1.Tables["topic"].Rows[0][0].ToString();//获得转贴主记录的id号

        sql = "INSERT INTO TB_REPASTE_REPASTE (tid,userid) VALUES ('" + ds1.Tables["topic"].Rows[0][0].ToString() + "'," + u + "); SELECT @@identity ";

        ds2 = cn.mdb_ds(sql, "paste");

        string redirect_rid = ds2.Tables["paste"].Rows[0][0].ToString();//获得转贴的id号

        sql = "SELECT TOP 4 * FROM V_REPASTE_INDEX WHERE userid2 = " + u + " ORDER BY rid DESC";

        ds2 = cn.mdb_ds(sql, "index");

        string body_template = "";

        for (int i = 0; i < ds2.Tables["index"].Rows.Count; i++)
        {
            body_template = body_template + "<a href=\"/club/repaste/detail.aspx?rid=" + ds2.Tables["index"].Rows[i]["rid"].ToString() + "\">" + check1.CheckRecord(ds2.Tables["index"].Rows[i]["topic"].ToString()) + "</a><br/>";
            if (i == ds2.Tables["index"].Rows.Count - 1)
            {
                body_template += "<div style=\"width:98%;text-align:right;\"><a href=\"/club/repaste/other.aspx?uid=" + u + "\">查看TA的全部转贴>></a></div>";
            }
        }

        string[] udetail;
        AllinUser AllinUser1 = new AllinUser();
        udetail = AllinUser1.GetUserDetail(u);

        string uhomeid = udetail[10];

        mysqldata_conn mysqlcn = new mysqldata_conn();

        sql = "select uc_members.uid,uc_members.username,uchome_space.name from uc_members left join uchome_space on uc_members.uid = uchome_space.uid where uc_members.uid = " + uhomeid;

        ds2 = mysqlcn.mdb_ds(sql, "uc");

        string uhomename = "";

        if (ds2.Tables["uc"].Rows[0]["name"].ToString() == "")
        {
            uhomename = ds2.Tables["uc"].Rows[0]["username"].ToString();
        }
        else
        {
            uhomename = ds2.Tables["uc"].Rows[0]["name"].ToString();
        }

        sql = "DELETE FROM uchome_feed WHERE appid = 1 AND icon = 'repaste' AND uid = " + uhomeid + ";INSERT INTO uchome_feed (appid,icon,uid,username,dateline,friend,hash_data,title_template,body_template) VALUES (1,'repaste'," + uhomeid + ",'" + uhomename + "'," + UnixTimestamp() + ",0,'" + UnixTimestamp() + "','<b>{actor}</b> 转贴给大家','" + body_template + "')";

        //Response.Write(sql);
        mysqlcn.mdb_exe(sql);

        if (Radio2.Checked == true)
        {
            sql = "";
            if (answer1.Value != "")
            {
                DataSet ds_v = new DataSet();
                sql = "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer1.Value) + "',1," + redirect_tid + ");SELECT @@identity ";
                ds_v = cn.mdb_ds(sql,"vote");
                sql = "INSERT INTO TB_REPASTE_VIEW (userid,tid,voteid) VALUES (" + u + "," + redirect_tid + "," + ds_v.Tables["vote"].Rows[0][0].ToString() + ");";
            }

            if (answer2.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer2.Value) + "',0," + redirect_tid + ");";
            }

            if (answer3.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer3.Value) + "',0," + redirect_tid + ");";
            }

            if (answer4.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer4.Value) + "',0," + redirect_tid + ");";
            }

            if (answer5.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer5.Value) + "',0," + redirect_tid + ");";
            }

            if (answer6.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer6.Value) + "',0," + redirect_tid + ");";
            }

            if (answer7.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer7.Value) + "',0," + redirect_tid + ");";
            }

            if (answer8.Value != "")
            {
                sql += "INSERT INTO TB_REPASTE_VOTE (txt,vcount,tid) VALUES ('" + check1.CheckInput(answer8.Value) + "',0," + redirect_tid + ");";
            }
            cn.mdb_exe(sql);
        }

        Response.Redirect("detail.aspx?rid=" + redirect_rid);
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        login login1 = new login();
        login1.login();

        check check1 = new check();
        GetRequest GetRequest1 = new GetRequest();
        string p = "";
        p = check1.CheckNumber(GetRequest1.GetRequestQueryString("p", "1"));

        string u = "";
        u = check1.CheckNumber(GetRequest1.GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        string sql = "";

        sql = "SELECT UCenterHomeUid FROM TB_User WHERE userid = " + u;

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "tb_user");

        string uid = "0";

        uid = ds.Tables["tb_user"].Rows[0][0].ToString();

        mysqldata_conn mysqlcn = new mysqldata_conn();

        //以下为获得“我的好友”
        sql = "SELECT friendid FROM uc_friends WHERE uid = " + uid;

        ds = mysqlcn.mdb_ds(sql, "uc_friends");

        //ltrMyFriendCount.Text = ds.Tables["uc_friends"].Rows.Count.ToString();

        string uidlist = "";

        for (int i = 0; i < ds.Tables["uc_friends"].Rows.Count; i++)
        {
            if (uid != "")
            {
                uidlist += ds.Tables["uc_friends"].Rows[i][0].ToString() + ",";
            }

        }

        uidlist += "0";

        sql = "SELECT * FROM TB_User WHERE UCenterHomeUid in (" + uidlist + ") ORDER BY USERID";

        ds = cn.mdb_ds(sql, "myfriends");

        int item = 0;
        item = (Convert.ToInt32(p) - 1) * 10;

        sql = "SELECT TOP 10 * ";
        sql += "FROM (SELECT * FROM V_REPASTE_INDEX) AS T WHERE uhomeid2 in (" + uidlist + ") AND rid NOT IN ";
        sql += "(SELECT TOP " + item.ToString() + " rid FROM V_REPASTE_INDEX WHERE uhomeid2 in (" + uidlist + ") ORDER BY rid DESC) ORDER BY rid DESC";

        //Response.Write(sql);
        ds = cn.mdb_ds(sql, "repaste");
        Repeater1.DataSource = ds.Tables["repaste"].DefaultView;
        Repeater1.DataBind();

        sql = "SELECT rid as c FROM V_REPASTE_INDEX WHERE uhomeid2 in (" + uidlist + ")";
        ds = cn.mdb_ds(sql, "repaste");

        string base_url = "friend.aspx?p=";

        string end_url = "";

        int cp = Convert.ToInt32(p);
        int tp = 1;
        int count = 0;
        count = ds.Tables["repaste"].Rows.Count;

        if (count % 10 > 0 || count == 0)
        {
            tp = count / 10 + 1;
        }
        else
        {
            tp = count / 10;
        }

        string s = "";
        if (cp == 1)
        {
            //s = s + " <span class=\"selected2\">首页</span> ";
            //s = s + " <span class=\"selected2\">上一页</span> ";
            s = s + " <span class=\"selected2\">1</span> ";
            for (int i = 2; i <= (tp < 10 ? tp : 10); i++)
            {
                s = s + " <a href=\"" + base_url + "" + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }
        else
        {
            s = s + " <a href=\"" + base_url + "1" + end_url + "\"><span>首页</span></a> ";
            s = s + " <a href=\"" + base_url + (cp - 1) + end_url + "\"><span>上一页</span></a> ";
            for (int i = (cp <= 5 ? 1 : (tp - cp < 5 ? (tp - 9 < 1 ? 1 : tp - 9) : cp - 4)); i <= cp - 1; i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }

            s = s + " <span class=\"selected2\">" + cp + "</span> ";

            for (int i = cp + 1; i <= (cp + 5 >= tp ? tp : (cp <= 5 ? (tp >= 10 ? 10 : tp) : cp + 5)); i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }

        if (cp == tp)
        {
            //s = s + " <span class=\"selected2\">下一页</span> ";
            //s = s + " <span class=\"selected2\">尾页</span> ";
        }
        else
        {
            s = s + " <a href=\"" + base_url + (cp + 1) + end_url + "\">下一页</a> ";
            s = s + " <a href=\"" + base_url + tp + end_url + "\">尾页</a> ";
        }
        pagecontrol_string = s;
    }
예제 #9
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        check ck = new check();
        data_conn cn = new data_conn();
        string sql = "";
        sql = sql + "select * ";
        sql = sql + "from TB_User ";
        sql = sql + "where UserName = '******'";
        DataSet ds = new DataSet();
        ds = cn.mdb_ds(sql, "T_User");

        if (WordsIScn(UserName.Value) && WordsIScn(Text1.Value) && WordsIScn(Text2.Value) && WordsIScn(Text3.Value) && WordsIScn(Text4.Value) && WordsIScn(Text5.Value) && WordsIScn(Text6.Value) && WordsIScn(Text7.Value) && WordsIScn(Text8.Value) && WordsIScn(Text9.Value) && WordsIScn(Text10.Value) && WordsIScn(Text11.Value) && WordsIScn(Text12.Value) && WordsIScn(Text13.Value) && WordsIScn(Text14.Value) && WordsIScn(TEXTAREA1.Value))
        {

        }
        else
        {
            MessageBox("opfail", "不能出现中文字符");
            return;
        }

        if (ds.Tables["T_User"].Rows.Count > 0)
        {
            MessageBox("opfail", "该用户名已被使用");
            return;
        }

        if (Text1.Value != Text2.Value)
        {
            MessageBox("opfail", "两遍输入的密码不相同");
            return;
        }

        if (!Checkbox1.Checked)
        {
            MessageBox("opfail", "Please read the service terms and agree");
            return;
        }

        if (UserName.Value == "" || Text1.Value == "" || Text2.Value == "" || Text3.Value == "" || Text5.Value == "" || DropDownList1.SelectedValue == "" || Text6.Value == "" || Text8.Value == "" || Text11.Value == "" || Text12.Value == "")
        {
            MessageBox("opfail", "*号为必填项");
            return;
        }

        string recommendUserID;
        if (this.Request.Cookies["recommendUserID"] == null)
        {
            recommendUserID = "0";
        }
        else
        {
            if (this.Request.Cookies["recommendUserID"].Value == "")
            {
                recommendUserID = "0";
            }
            else
            {
                recommendUserID = Request.Cookies["recommendUserID"].Value;
            }
        }

        if (this.Request.Cookies["UID"] == null)
        {

        }
        else
        {
            if (Request.Cookies["UID"].Value == "")
            {

            }
            else
            {
                data_conn Uidcn = new data_conn();
                DataSet Uidds = Uidcn.mdb_ds("select UserID from TB_User where UCenterHomeUid=" + Request.Cookies["UID"].Value, "uid");
                if (Uidds.Tables["uid"].Rows.Count == 1)
                {
                    recommendUserID = Uidds.Tables["uid"].Rows[0][0].ToString();
                    mysqldata_conn mycn = new mysqldata_conn();
                    mycn.mdb_exe("update uchome_space set credit=credit+10 where uid=" + Request.Cookies["UID"].Value);
                }
            }
        }

        sql = "";
        sql += "INSERT INTO ";
        sql += "TB_User ";
        sql += "(";
        sql += "UserName, ";
        sql += "UserPassword, ";
        sql += "RealName, ";
        sql += "First_Name, ";
        sql += "Last_Name, ";
        sql += "EN_CompanyName, ";
        sql += "CompanyType, ";//int
        sql += "Phone, ";
        sql += "Fax, ";
        sql += "UserEmail, ";
        sql += "Usermsn, ";
        sql += "Website, ";
        sql += "EN_Country, ";
        sql += "EN_City, ";
        sql += "EN_Address, ";
        sql += "PostNumber, ";
        sql += "EN_Company_profile, ";
        sql += "UserPoint, ";
        sql += "IfPass, ";
        sql += "ifvip, ";
        sql += "ifmanage, ";
        sql += "ifEn, ";
        sql += "Regtime)";
        sql += "VALUES ";
        sql += "(";

        sql += "'" + ck.CheckInput(UserName.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text1.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text3.Value.ToString()) + " " + ck.CheckInput(Text4.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text3.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text4.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text5.Value.ToString()) + "', ";
        sql += "" + ck.CheckInput(DropDownList1.SelectedValue) + ", ";
        sql += "'" + ck.CheckInput(Text6.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text7.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text8.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text9.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text10.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text11.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text12.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text13.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(Text14.Value.ToString()) + "', ";
        sql += "'" + ck.CheckInput(TEXTAREA1.Value.ToString()) + "', ";
        sql += "0, ";
        sql += "1, ";
        sql += "1, ";
        sql += "0, ";
        sql += "1, ";
        sql += "'" + ck.CheckInput(DateTime.Now.ToString()) + "' ";
        sql += ")";
        cn.mdb_exe(sql);
        sql = "SELECT * FROM TB_User WHERE UserName = '******'";

        ds = cn.mdb_ds(sql, "user");

        string sql_account = "insert into TB_ORDER_ACCOUNT (userid) VALUES (" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ")";
        cn.mdb_exe(sql_account);
        //增加账户信息

        if (ds.Tables["user"].Rows.Count != 0)
        {
            try
            {
                points p = new points();
                p.AddNewPoints(ds.Tables["user"].Rows[0]["UserID"].ToString());
            }
            catch (Exception ex)
            {

            }

            string userid = ds.Tables["user"].Rows[0]["UserID"].ToString();
            string usernm = ds.Tables["user"].Rows[0]["UserName"].ToString();
            string ifvip = ds.Tables["user"].Rows[0]["ifvip"].ToString();
            string ifmanage = ds.Tables["user"].Rows[0]["ifmanage"].ToString();
            string realname = ds.Tables["user"].Rows[0]["realname"].ToString();
            string useremail = ds.Tables["user"].Rows[0]["useremail"].ToString();

            Response.Cookies["user_id"].Value = userid;
            Response.Cookies["user_name"].Value = Server.UrlEncode(usernm);
            Response.Cookies["ifvip"].Value = ifvip;
            Response.Cookies["ifmanage"].Value = ifmanage;

            Response.Cookies["user_id"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["user_name"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["ifvip"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["ifmanage"].Expires = DateTime.Now.AddDays(365);

            Response.Cookies["realname"].Value = Server.UrlEncode(realname);
            Response.Cookies["useremail"].Value = Server.UrlEncode(useremail);

            Response.Cookies["realname"].Expires = DateTime.Now.AddDays(365);
            Response.Cookies["useremail"].Expires = DateTime.Now.AddDays(365);

            if (recommendUserID != "0")
            {
                cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + userid + "," + recommendUserID + ")");
                cn.mdb_exe("insert into T_FRIEND (UID,FID) values (" + recommendUserID + "," + userid + ")");
                Mark mark = new Mark();
                mark.MarkOperate(Convert.ToInt32(recommendUserID), 10, "推荐会员", Convert.ToInt32(userid));
            }

            mysqldata_conn mysqlcn = new mysqldata_conn();
            DataSet dscount = mysqlcn.mdb_ds("select * from uc_members where username='******'", "ucenter");

            if (dscount.Tables["ucenter"].Rows.Count == 0)
            {
                Random r = new Random();
                string salt = r.Next().ToString().Substring(0, 6);
                string username = usernm;
                string password = MD5(MD5(ds.Tables["user"].Rows[0]["UserPassword"].ToString()) + salt);
                string email = ds.Tables["user"].Rows[0]["UserEmail"].ToString();
                string myid = "";
                string myidkey = "";
                string regip = Page.Request.UserHostAddress;
                string regdate = UnixTimestamp();
                string lastloginip = "0";
                string lastlogintime = "0";

                string id = this.insert(username, "8fc24ae194289b94e36272a5f9882611", email, myid, myidkey, regip, regdate, lastloginip, lastlogintime, "594882");

                if (id != "")
                {
                    mysqlcn.mdb_exe("insert into uchome_member (uid,username,password) values (" + id + ",'','" + MD5(id + "|" + UnixTimestamp()) + "')");
                    mysqlcn.mdb_exe("insert into uc_memberfields (uid,blacklist) values (" + id + ",'')");

                    string myemail;
                    string qq;
                    string msn;
                    if (ds.Tables["user"].Rows[0]["UserEmail"].ToString() != "")
                    {
                        myemail = ds.Tables["user"].Rows[0]["UserEmail"].ToString();
                    }
                    else
                    {
                        myemail = "";
                    }

                    qq = "";
                    msn = "";

                    mysqlcn.mdb_exe("insert into uchome_spacefield (uid,email,qq,msn,blood,birthprovince,birthcity,resideprovince,residecity,note,spacenote,authstr,theme,css,privacy,friend,feedfriend,sendmail) values (" + id + ",'" + myemail + "','" + qq + "','" + msn + "','','','','','','','','','','','','','','')");

                    //插入实名
                    string namestatus = "0";

                    //实名

                    mysqlcn.mdb_exe("insert into uchome_space (uid,groupid,username,name,namestatus,domain,dateline,ip) values (" + id + ",5,'" + username + "',''," + namestatus + ",''," + UnixTimestamp() + ",'" + Page.Request.UserHostAddress + "')");
                    cn.mdb_exe("update TB_User set UCenterHomeUid=" + id + " where UserId=" + userid);

                    //在ucenter中添加推荐好友

                    if (Request.Cookies["UID"] == null)
                    {

                    }
                    else
                    {
                        if (Request.Cookies["UID"].Value == "")
                        {

                        }

                        else
                        {

                            string gid = "0";
                            if (this.Request.Cookies["g"] == null)
                            {

                            }
                            else
                            {
                                if (Request.Cookies["g"].Value == "")
                                {

                                }
                                else
                                {
                                    gid = Request.Cookies["g"].Value;
                                    try
                                    {
                                        int g = Convert.ToInt32(gid);

                                        if (g > 0 && g < 8)
                                        {
                                            gid = g.ToString();
                                        }
                                        else
                                        {
                                            gid = "0";
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        gid = "0";
                                    }
                                }
                            }

                            DataSet myUidds = mysqlcn.mdb_ds("select username from uc_members where uid=" + Request.Cookies["UID"].Value, "uid");
                            mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + id + "," + Request.Cookies["UID"].Value + ",'" + myUidds.Tables["uid"].Rows[0][0].ToString() + "',1,0,''," + UnixTimestamp() + ")");
                            mysqlcn.mdb_exe("insert into uchome_friend (uid,fuid,fusername,status,gid,note,dateline) values (" + Request.Cookies["UID"].Value + "," + id + ",'" + username + "',1," + gid + ",''," + UnixTimestamp() + ")");
                            mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + id + "," + Request.Cookies["UID"].Value + ",3,'')");
                            mysqlcn.mdb_exe("insert into uc_friends (uid,friendid,direction,comment) values (" + Request.Cookies["UID"].Value + "," + id + ",3,'')");
                        }
                    }

                }
                else
                {
                    Response.Write("safasdfasdf");
                }

            }
            Response.Cookies["useremail"].Value = Text8.Value.ToString();

            Response.Redirect("/en/login_2.aspx");

        }
    }