有些flash小游戏网站,玩过游戏后,得到的积分可以提交到网站上,获得排名或者积分,换取一些东西等等 不知道这个积分是如何提交上去的?自己的网站如何实现这种提交? 有没有什么教程? 谢谢各位大虾的帮助
解决方案 »
- asp.net 登录验证
- 向广大朋友们 求助
- 如何关闭父页面。。请高手看看
- webpart如何读取登陆用户的信息,根据不同的用户定制的样式显示不同的布局的?
- 小偷问题:如何偷取需要用户登录验证的页面数据?
- ASP与ASP.NET的区别及联系
- 超质 asp.net网站!学习asp的同学们 必看!不看后悔!
- asp.net
- DataGrid中一个DropDownList控件,怎么才能捕捉到这个控件的SelectedIndexChanged事件?
- 双引号怎么替换?
- access不支持联合查询前几条记录怎么办
- asp.net ajax错误:sys.webforms.PageRequestManagerServerErrorException
主要是flash对用户数据进行提交
AS代码:function SaveScore()
{
var Score = new LoadVars();
Score.score = 123;//积分值
var num:Number = Math.random()*10;
Score.sendAndLoad("http://www.xxxgame.com/SaveScore.aspx?score=" + num, Score, "POST");
Score.onLoad = function(success)
{
if (success)
{
msg.text = "保存积分成功!";
} else
{
msg.text = "保存积分失败!";
}
};
}
服务端用Request["score"]得到传上来的值,然后保存clickBtn.onRelease = function()
{
msg.text = "正在保存积分……"
SaveScore();
};
namespace BBS
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class SetUserId : IHttpHandler , System.Web.SessionState.IRequiresSessionState
{ public void ProcessRequest(HttpContext context)
{
context.Response.Buffer = true;
context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
context.Response.Expires = 0;
context.Response.CacheControl = "no-cache";
context.Response.ContentType = "text/plain";
if (Mode.Global.CurrentUser != null)
context.Response.Write("UserID=" + Mode.Global.CurrentUser.Id.ToString() + "&Result=OK&");
} public bool IsReusable
{
get
{
return false;
}
}
}
}
namespace BBS
{
/// <summary>
/// Summary description for $codebehindclassname$
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class GetIntegral : IHttpHandler,System.Web.SessionState.IRequiresSessionState
{
long userid;
int integral;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Buffer = true;
context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
context.Response.Expires = 0;
context.Response.CacheControl = "no-cache";
context.Response.ContentType = "text/plain";
long.TryParse(context.Request.Form["UserID"], out userid);
int.TryParse(context.Request.Form["Score"], out integral);
if (this.integral <= 30)
{
try
{
DataAccess.UserInfoDataAccess.AddFlashGameIntegral(this.userid, this.integral);
context.Response.Write("Result=OK&");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
} public bool IsReusable
{
get
{
return false;
}
}
}
}