<!--#include file="inc/Conn.asp"-->
<!--#include file="inc/Function_PC.asp"-->
<!--#include file="loginisok.asp"-->
<%
unav=4
bclassname="会员中心"
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息 - <%=Dream_SiteTitle%></title>
<meta name="keywords" content="<%=Dream_SiteKeywords%>" />
<meta name="description" content="<%=Dream_SiteDescription%>" />
<!--#include file="jscss.asp"-->
<!--#include file="inc/zdsbphone.asp"-->
<script type="text/javascript" src="../js/jquery.wallform.js"></script>
<script type="text/javascript">
$(function(){
	$('#photoimg').die('click').live('change', function(){
		var imgnum=1
		if($("#preview div").length<imgnum){
		var status = $("#up_status");
		var btn = $("#up_btn");		
		$("#imageform").ajaxForm({
			target: '#preview', 
			beforeSubmit:function(){
				status.show();
				btn.hide();
			}, 
			success:function(){
				status.hide();
				btn.show();
			}, 
			error:function(){
				status.hide();
				btn.show();
		}}).submit();		
		}else{
		alert("最多只能上传"+imgnum+"传图片!");
		}
	});
});
</script>
<script>
$(document).ready(function(){
  $("button").live("click",function(){
  var imgid=$(this).val();
  //alert($(this).attr("name"));
  var buttonname=$(this).attr("name");
  var imgsrc=$("#"+imgid+" img").attr("src");
  if ($(this).attr("name")=="del"){  
	  $.get("delimg.asp?src="+imgsrc,function(data,status){if(data){alert(data);}});
	  $("#"+imgid+"").remove();  
  }
  });
  $('#button').click(function (){$("#picurl").html($("#preview").html());});
});
</script>
</head>
<body>
<!--#include file="nheader.asp"-->
<div class="conment">
	<div class="local">当前位置：<a href="index.asp">首页</a> > <a href="user.asp">会员中心</a> > 修改信息</div>
	<div class="about_nav">
		<h3>会员中心</h3>
		<ul>		
		<!--#include file="usernav.asp"-->
		</ul>		
	</div>
	<div class="about_right">
		<div class="about_right_title"><h3>修改信息</h3><span>注：图片格式gif,jpg,bmp,jpeg,png；不要超过2M。</span></div>
		<div class="about_right_con">
			<%
			id=request("id")
			Set rs=Server.CreateObject("Adodb.RecordSet")
			rs.open "Select * From Dream_Menpiao where Dream_UserID='"&session("Dream_UserName")&"' and id="&id,conn,1,3
			if not rs.eof then		
			imgurl=rs("Dream_DefaultPicUrl")
			p_title=rs("Dream_Title")
			p_titlecon=rs("Dream_TitleCon")
			p_area=rs("Dream_Area")
			p_qq=rs("Dream_QQ")
			p_theme=rs("Dream_Theme")
			p_address=rs("Dream_Address")
			p_phone=rs("Dream_Phone")
			p_mapurl=rs("Dream_MapUrl")
			p_content=rs("Dream_content")
			p_content3=rs("Dream_content3")
			p_content4=rs("Dream_content4")
			else
			response.Redirect "listinfo.asp"
			end if
			session("imgurlstr")=imgurl
			%>
			<div class="reg">	
			<form id="imageform" name="form1" method="post" enctype="multipart/form-data" action="upfile1.asp">
				<div class="updemo"><div id="up_status" style="display:none"><img src="loader.gif" alt="uploading"/></div>
				<div id="up_btn" class="btn">
					<span>添加缩略图</span>
					<input id="photoimg" type="file" name="photoimg">
				</div>
				</div>	
			</form>
			<div id="preview"><%if imgurl<>"" then%><div id="img0"><img src="<%=imgurl%>"><br><button value="img0" name="del">删除</button></div><%end if%></div>
			<ul>
				<form name="form1" method="post" action="addinfo_ok.asp?action=editinfo">
				<input name="id" type="hidden" value="<%=rs("id")%>">
				<textarea name="picurl" id="picurl" style="display:none"></textarea>
				<li><span>所属地区：</span>
				<select name="p_area" id="p_area">
					<option value="请选择">选择地区</option>
				<%
				set rs=server.CreateObject("adodb.recordset")
				sql="select * from Dream_Area where Dream_ClassID=0 order by Dream_Zid asc"
				rs.open sql,conn,1,1
				if not(rs.eof and rs.bof) then
				do while not rs.eof
				%>
					<option value="<%=rs("id")%>" <%if p_area=rs("id") then%> selected<%end if%>> + <%=rs("Dream_Names")%></option>
				<%
					set rss=server.CreateObject("adodb.recordset")
					sqls="select * from Dream_Area where Dream_ClassID="&rs("id")&" order by Dream_Zid asc"
					rss.open sqls,conn,1,1
					if not(rss.eof and rss.bof) then
					do while not rss.eof
					%>
					<option value="<%=rss("id")%>" <%if p_area=rss("id") then%> selected<%end if%>> --- <%=rss("Dream_Names")%></option>
					<%
					rss.movenext
					loop
					end if
					rss.close
					set rss=nothing 
				rs.movenext
				loop
				else
				%>
					<option value="0">暂无分类</option>
					<%
				end if
				rs.close
				set rs=nothing
				%>
				</select></li>
				<li><span>所属分类：</span><select name="p_theme" id="p_theme">
				<option value="请选择">选择分类</option>
				<%
				set rs=server.CreateObject("adodb.recordset")
				sql="select * from Dream_Theme where Dream_ClassID=0 order by Dream_Zid asc"
				rs.open sql,conn,1,1
				if not(rs.eof and rs.bof) then
				do while not rs.eof
				%>
					<option value="<%=rs("id")%>" <%if p_theme=rs("id") then%> selected<%end if%>> + <%=rs("Dream_Names")%></option>
				<%
					set rss=server.CreateObject("adodb.recordset")
					sqls="select * from Dream_Theme where Dream_ClassID="&rs("id")&" order by Dream_Zid asc"
					rss.open sqls,conn,1,1
					if not(rss.eof and rss.bof) then
					do while not rss.eof
					%>
					<option value="<%=rss("id")%>" <%if p_theme=rss("id") then%> selected<%end if%>> --- <%=rss("Dream_Names")%></option>
					<%
					rss.movenext
					loop
					end if
					rss.close
					set rss=nothing 
				rs.movenext
				loop
				else
				%>
					<option value="0">暂无分类</option>
					<%
				end if
				rs.close
				set rs=nothing
				%>
				</select></li>
				<li><span>标题：</span><input type="text" name="p_title" id="p_title" class="input_1" value="<%=p_title%>"></li>
				<li><span>简要：</span><input type="text" name="p_titlecon" id="p_titlecon" class="input_1" value="<%=p_titlecon%>"></li>
				<li><span>电话：</span><input type="text" name="p_phone" id="p_phone" class="input_1" value="<%=p_phone%>"></li>
				<li><span>QQ：</span><input type="text" name="p_qq" id="p_qq" class="input_1" value="<%=p_qq%>"></li>
				<li><span>地址：</span><input type="text" name="p_address" id="p_address"  class="input_1" value="<%=p_address%>"></li>
				<li><span>地图链接：</span><input type="text" name="p_mapurl" id="p_mapurl" class="input_1" value="<%=p_mapurl%>"></li>				
				<li class="nop"><span>优惠信息：</span><textarea name="p_content4" rows="4" id="p_content4"><%=p_content4%></textarea></li>
				<li class="nop"><span>温馨提示：</span><textarea name="p_content" rows="4" id="p_content"><%=p_content%></textarea></li>
				<li class="nop"><span>商家介绍：</span><textarea name="p_content3" rows="4" id="p_content3"><%=p_content3%></textarea></li>
				<input type="hidden" name="p_ceshi">
				<li class="an">
			   <input type="submit"  id="button" value="修改名片" class="input_an" >
			 </li>
			</form>
			</ul>
			</div>
		</div>
	</div>
</div>
<!--#include file="footer.asp"-->
</section>
<script>
$('#button').click(function () {
	var p_area = $('#p_area').val();
	var p_theme = $('#p_theme').val();
	var p_title = $('#p_title').val();
	if (p_area == "请选择") {
		alert("请选择所属地区");
		return false;
	}
	if (p_theme == "请选择") {
		alert("请选择所属分类");
		return false;
	}	
	if (p_title.length<1) {
		alert("标题不能为空");
		return false;
	}
});	
</script>
</body>
</html>
