コード例 #1
0
        public string CheckFirstLogin(string strUid)
        {
            string strContent = null;
            string strSQL     = null;

            strSQL = "SELECT Uid FROM [MT_User] WHERE Uid = " + strUid;
            DataRow dr = SqlHelper.ExecuteDataRow(SqlLibrary.GetXn_Main(), CommandType.Text, strSQL);

            if (dr == null)
            {
                strContent = "1"; //是第一次登录
            }
            else
            {
                strContent = "0"; //不是第一次登录
            }
            return(strContent);
        }
コード例 #2
0
ファイル: Refresh.aspx.cs プロジェクト: cupid0426/MyProject
        protected void Page_Load(object sender, EventArgs e)
        {
            Random rnd = new Random();
            //string strUserName = "******";
            ArrayList alBmp = new ArrayList();
            ArrayList alUid = new ArrayList();

            int intPage = Convert.ToInt32(Request.QueryString["Page"].ToString());

            if (intPage < 0 || !intPage.Equals(intPage))
            {
                intPage = 1;
            }
            //Session["username"] = strUserName;
            //if (Session["username"] == null)
            //{
            //    Response.Redirect("Login.aspx");
            //}

            SqlParameter[] sp = new SqlParameter[2];
            sp[0]       = new SqlParameter("@PageIndex", SqlDbType.Int, 4);
            sp[1]       = new SqlParameter("@PageSize", SqlDbType.Int, 4);
            sp[0].Value = intPage;
            sp[1].Value = 8;

            DataTable dt = SqlHelper.ExecuteDataTable(SqlLibrary.GetXn_Main(), CommandType.StoredProcedure, "Xn_GetShowList", sp);

            if (dt.Rows.Count > 0)
            {
                int i = 1;
                foreach (DataRow dr in dt.Rows)
                {
                    sb.Append("<div class=\"pic" + i + "\">");
                    sb.Append("<div class=\"headpic\"><a href=\"#\"><img src=\"http://ishow.xba.com.cn/image/" + (string)dr["Bmp"].ToString().Trim() + "?tmp=" + rnd.Next(000000, 999999).ToString() + "\" width=\"149\" height=\"115\" /></a></div>");
                    sb.Append("<div class=\"headname\"><a href=\"#\">" + (string)dr["UserId"].ToString().Trim() + "</a></div>");
                    sb.Append("<div class=\"headtime\">16:20</div>");
                    sb.Append("</div>\r\n");
                    i++;
                }
                //ShowImg.Visible = true;
                this.strContent = sb.ToString();
                dt.Dispose();
            }
            else
            {
                strContent = "当前没有在线用户~~~";
            }

            //string strSQL = "SELECT UserId,Bmp FROM [Media] ORDER BY Time DESC";
            //SqlDataReader dr = SqlHelper.ExecuteReader(SqlLibrary.GetXn_Main(), CommandType.Text, strSQL);

            //if (dr != null)
            //{
            //    int i = 1;
            //    //int j = 0;
            //    while (dr.Read())
            //    {
            //        sb.Append("<div class=\"pic" + i + "\">");
            //        sb.Append("<div class=\"headpic\"><a href=\"#\"><img src=\"http://ishow.xba.com.cn/image/" + (string)dr["Bmp"].ToString().Trim() + "?tmp=" + rnd.Next(000000, 999999).ToString() + "\" width=\"149\" height=\"115\" /></a></div>");
            //        sb.Append("<div class=\"headname\"><a href=\"#\">" + (string)dr["UserId"].ToString().Trim() + "</a></div>");
            //        sb.Append("<div class=\"headtime\">16:20</div>");
            //        sb.Append("</div>\r\n");
            //        //j++;
            //        //if (j == 3)
            //        //{
            //        //    sb.Append("");
            //        //    j = 0;
            //        //}
            //        i++;
            //    }
            //    dr.Close();
            //    //ShowImg.Visible = true;
            //    this.strContent = sb.ToString();
            //    dr.Dispose();
            //}
            //else
            //{
            //    strContent = "当前没有在线用户~~~";
            //}
        }
コード例 #3
0
ファイル: Show.aspx.cs プロジェクト: cupid0426/MyProject
        protected void Page_Load(object sender, EventArgs e)
        {
            Random rnd           = new Random();
            string strSessionKey = null;

            string[] arrFriend_List;
            string   tinyurl      = null;
            string   name         = null;
            int      intPage      = 1;
            int      intPageCount = 0;

            ShowImg.Visible = false;
            //string strUserName = "******";
            ArrayList  alBmp = new ArrayList();
            ArrayList  alUid = new ArrayList();
            XiaoNeiApi xn    = new XiaoNeiApi();

            strSessionKey = Request.QueryString["xn_sig_session_key"].ToString();
            intPage       = Convert.ToInt32(Request.QueryString["page"].ToString());

            if (intPage < 0 || !intPage.Equals(intPage))
            {
                intPage = 1;
            }

            xn.strSessionKey = strSessionKey;
            arrFriend_List   = xn.friends_getAppFriends().Split('|');
            uInfo.Uid        = xn.users_getLoggedInUser();

            JObject o = JObject.Parse(xn.users_getInfo(uInfo.Uid));

            tinyurl = (string)o["tinyurl"];
            name    = (string)o["name"];
            sb_FriendList.Append("<li class=\"headbg\"><a href=\"#\"><img src='" + tinyurl + "' width=\"50\" height=\"50\" /></a><br /><a href=\"#\">" + name + "</a></li>");

            if (arrFriend_List.Length > 0 && arrFriend_List[0].ToString() != "")
            {
                foreach (string strContent in arrFriend_List)
                {
                    o       = JObject.Parse(strContent);
                    tinyurl = (string)o["tinyurl"];
                    name    = (string)o["name"];
                    //sb_FriendList.Append("<li style='float:left;'><img src='" + tinyurl + "' width=\"50\" height=\"50\" alt='" + name + "' /></li>");
                    sb_FriendList.Append("<li class=\"headbg\"><a href=\"#\"><img src='" + tinyurl + "' width=\"50\" height=\"50\" /></a><br /><a href=\"#\">" + name + "</a></li>");
                }
            }

            strFriend_List = sb_FriendList.ToString();

            string strSQL = "SELECT ISNULL(Count(id),0) AS Count FROM [Media]";

            intPageCount = Convert.ToInt32(SqlHelper.ExecuteScalar(SqlLibrary.GetXn_Main(), CommandType.Text, strSQL));
            if (intPageCount % 8 > 0)
            {
                intPageCount = intPageCount / 8 + 1;
            }
            else
            {
                intPageCount = intPageCount / 8;
            }

            if (intPageCount > 0)
            {
                int j;
                sb_Page.Append("<ul style=\"list-style:none; margin:0 auto; width:" + 15 * intPageCount + "px;\">");
                for (j = 1; j <= intPageCount; j++)
                {
                    if (j == intPage)
                    {
                        //sb_Page.Append("<li class=\"pagebutton\" onclick=\"highlight(this,'pagebutton')\"><a href=\"javascript:;\" onclick=\"vGetRands(" + j + ")\"></a></li>");//<a href=\"Show.aspx?xn_sig_session_key=" + xn.strSessionKey + "&page=" + j + "\" style=\"display:block; width:15px; height:15px;\"></a>
                        sb_Page.Append("<li class=\"pagebutton\" onclick=\"highlight(this,'pagebutton')\"><a href=\"javascript:;\" onclick=\"vGetRands(" + j + ")\" style=\"display:block; width:15px; height:15px;\" ></a></li>");//<a href=\"Show.aspx?xn_sig_session_key=" + xn.strSessionKey + "&page=" + j + "\" style=\"display:block; width:15px; height:15px;\"></a>
                    }
                    else
                    {
                        sb_Page.Append("<li class=\"pg2\" onclick=\"highlight(this,'pagebutton')\"><a href=\"javascript:;\" onclick=\"vGetRands(" + j + ")\" style=\"display:block; width:15px; height:15px;\" ></a></li>");//<a href=\"Show.aspx?xn_sig_session_key=" + xn.strSessionKey + "&page=" + j + "\" style=\"display:block; width:15px; height:15px;\"></a>
                    }
                }
                sb_Page.Append("</ul>");
                this.strPageShow = sb_Page.ToString();

                SqlParameter[] sp = new SqlParameter[2];
                sp[0]       = new SqlParameter("@PageIndex", SqlDbType.Int, 4);
                sp[1]       = new SqlParameter("@PageSize", SqlDbType.Int, 4);
                sp[0].Value = intPage;
                sp[1].Value = 8;

                DataTable dt = SqlHelper.ExecuteDataTable(SqlLibrary.GetXn_Main(), CommandType.StoredProcedure, "Xn_GetShowList", sp);
                if (dt.Rows.Count > 0)
                {
                    int i = 1;
                    foreach (DataRow dr in dt.Rows)
                    {
                        sb.Append("<div class=\"pic" + i + "\">");
                        sb.Append("<div class=\"headpic\"><a href=\"#\"><img src=\"http://ishow.xba.com.cn/image/" + (string)dr["Bmp"].ToString().Trim() + "?tmp=" + rnd.Next(000000, 999999).ToString() + "\" width=\"149\" height=\"115\" /></a></div>");
                        sb.Append("<div class=\"headname\"><a href=\"#\">" + (string)dr["UserId"].ToString().Trim() + "</a></div>");
                        sb.Append("<div class=\"headtime\">16:20</div>");
                        sb.Append("</div>\r\n");
                        i++;
                    }
                    ShowImg.Visible = true;
                    this.strContent = sb.ToString();
                    dt.Dispose();
                }
                else
                {
                    strContent = "当前没有在线用户~~~";
                }
            }

            //string strSQL = "SELECT UserId,Bmp FROM [Media] ORDER BY Time DESC";
            //SqlDataReader dr = SqlHelper.ExecuteReader(SqlLibrary.GetXn_Main(), CommandType.Text, strSQL);
            //if (dr != null)
            //{
            //    int j = 0;
            //    sb.Append("<tr>");
            //    while (dr.Read())
            //    {
            //        //sb.Append("<td align=\"center\"><table><tr><td style='border-collapse:collapse;border: 1px solid #20B2AA;width:160px;height:160px;'><img src=\"./image/" + (string)dr["Bmp"].ToString().Trim() + "?tmp=" + rnd.Next(000000,999999).ToString() +"\"/></td></tr><tr><td>" + (string)dr["UserId"].ToString().Trim() + "</td></tr></table></td>");
            //        sb.Append("<td align=\"center\"><table><tr><td style='border-collapse:collapse;border: 1px solid #20B2AA;width:160px;height:160px;'><img src=\"http://ishow.xba.com.cn/image/" + (string)dr["Bmp"].ToString().Trim() + "?tmp=" + rnd.Next(000000, 999999).ToString() + "\"/></td></tr><tr><td>" + (string)dr["UserId"].ToString().Trim() + "</td></tr></table></td>");
            //        j++;
            //        if (j == 3)
            //        {
            //            sb.Append("</tr>");
            //            sb.Append("<tr>");
            //            j = 0;
            //        }
            //    }
            //    sb.Append("</tr>");
            //    dr.Close();
            //    ShowImg.Visible = true;
            //    strContent = sb.ToString();
            //}
            //else
            //{
            //    strContent = "当前没有在线用户~~~";
            //}
        }
コード例 #4
0
        /// <summary>
        /// 读取用户基本信息
        /// </summary>
        /// <param name="strUid"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public string users_getInfo(string strUid, string strPassword)
        {
            HTTPproc.Encoding = System.Text.Encoding.UTF8;

            string   strCallID     = null;
            string   strSig_Key    = null;
            string   strContent    = null;
            string   strParameters = null;
            string   strSQL        = null;
            DateTime dt            = DateTime.Now;

            int      intStatus        = 0;
            int      intUid           = 0;
            int      intSex           = 0;
            string   strName          = null;
            string   strProvince      = null;
            string   strCity          = null;
            string   strTinyurl       = null;
            string   strHeadurl       = null;
            DateTime dtBirthday       = DateTime.Parse("1900-01-01");
            DateTime dtLastActiveTime = dt;


            strSQL = "SELECT Uid FROM [MT_User] WHERE Uid = " + strUid;
            DataRow dr = SqlHelper.ExecuteDataRow(SqlLibrary.GetXn_Main(), CommandType.Text, strSQL);

            if (dr == null)
            {
                strCallID     = Timestamp().ToString();//fields=uid,name,sex,birthday,tinyurl,headurl,hometown_location
                strSig_Key    = string.Format("api_key={0}call_id={1}fields=uid,name,sex,birthday,tinyurl,headurl,hometown_locationformat={2}method={3}session_key={4}uids={5}v=1.0{6}", this.Api_Key, strCallID, this.strFormat, "users.getInfo", this.strSessionKey, strUid, this.Secret_Key);
                strSig_Key    = UserMd5(strSig_Key);
                strParameters = string.Format("api_key={0}&call_id={1}&fields=uid,name,sex,birthday,tinyurl,headurl,hometown_location&format={2}&method={3}&session_key={4}&uids={5}&v=1.0&sig={6}", this.Api_Key, strCallID, this.strFormat, "users.getInfo", this.strSessionKey, strUid, strSig_Key);
                try
                {
                    strContent = CleanBadWords(HTTPproc.OpenRead(this.RESTServer_URI, strParameters));
                    JObject o = JObject.Parse(strContent);
                    intUid = (int)o["uid"];
                    try
                    {
                        strTinyurl = (string)o["tinyurl"];
                    }
                    catch
                    {
                        strTinyurl = "";
                    }
                    try
                    {
                        dtBirthday = DateTime.Parse((string)o["birthday"]);
                    }
                    catch
                    {
                        dtBirthday = DateTime.Parse("1900-01-01");
                    }
                    try
                    {
                        strProvince = (string)o["hometown_location"]["province"];
                    }
                    catch
                    {
                        strProvince = "";
                    }
                    try
                    {
                        strCity = (string)o["hometown_location"]["city"];
                    }
                    catch
                    {
                        strCity = "";
                    }
                    try
                    {
                        intSex = (int)o["sex"];
                    }
                    catch
                    {
                        intSex = 0;
                    }
                    strName    = (string)o["name"];
                    strHeadurl = (string)o["headurl"];

                    intStatus = SqlLibrary.Xn_AddNewUser(intUid, strPassword, strName, intSex, dtBirthday, strProvince, strCity, strTinyurl, strHeadurl, dtLastActiveTime);

                    if (intStatus == 1)
                    {
                        strContent = "1"; //添加用户成功
                    }
                    else
                    {
                        strContent = "0"; //已有此用户
                    }
                }
                catch (Exception ex)
                {
                    strContent = ex.ToString();
                    strContent = "-1";
                }
            }
            return(strContent);
        }