/*
 * 程序名称: JumboTCMS(将博内容管理系统通用版)
 * 
 * 程序版本: 6.x
 * 
 * 程序作者: 将博开发团队 (商业合作请联系：791104444@qq.com)
 * 
 * 版权申明: http://www.jumbotcms.net/about/copyright.html
 * 
 * 技术答疑: http://forum.jumbotcms.net/
 * 
 */

using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using JumboTCMS.Utils;
using JumboTCMS.Common;
namespace JumboTCMS.WebFile.Mobile
{
    public partial class _GetUserInfo : JumboTCMS.UI.BasicPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.ClearContent();
            //Response.AddHeader("Access-Control-Allow-Origin", "*");
            //Response.AddHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
            string _username = q("username");
            string _password = JumboTCMS.Utils.Strings.Left(q("password"), 14);
            string _callback = q("callback");
            int iExpires = 0;
            string logininfo = new JumboTCMS.DAL.Normal_UserDAL().GetUserInfo(_username, _password);
            string _res = CallBack(logininfo, _callback);
            System.IO.StreamWriter sw = new System.IO.StreamWriter(HttpContext.Current.Server.MapPath("~/jsonp.log"), true, System.Text.Encoding.UTF8);
            sw.WriteLine(System.DateTime.Now.ToString());
            sw.WriteLine("\tIP 地 址：" + Const.GetUserIp);
            sw.WriteLine("\t访 问 者：" + ThisUser());
            sw.WriteLine("\t浏 览 器：" + HttpContext.Current.Request.Browser.Browser + " " + HttpContext.Current.Request.Browser.Version);
            sw.WriteLine("\t请    求：" + ServerUrl() + Const.GetCurrentUrl);
            sw.WriteLine("\t返    回：" + _res);
            sw.WriteLine("---------------------------------------------------------------------------------------------------");
            sw.Close();
            sw.Dispose();
            Response.Write(_res);//ok表示成功
        }
        private string CallBack(string json, string callbackKey)
        {
            if (callbackKey == "")
                return json;
            else
                return callbackKey + "(" + json + ")";
        }
    }
}
