<?php
/*
'**************************************************************************************************
' 程序名称: CCTVAI开源音乐管理系统
' 官方网站: http://www.cctvai.com
' 联系 Q Q: 1542367792
' QQ交流群：136687984
' 版本：(终结版)
' 备注：未经书面授权，不得向任何第三方提供本软件系统！
' 功能，模板，插件，扩展，定制请联系QQ：1542367792
'**************************************************************************************************
*/
error_reporting(0);
?>
<link type="text/css" rel="stylesheet" href="css/up.css" />
<?php if($view==""){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="on tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="tag-item"><span>修改昵称</span></a>
    </div>  	
   </div> 
  <div class="profile-content"> 
   <form action="do.php?ac=profile" method="post"> 
    <div class="uinArea"> 
     <label class="input-tips">昵称：</label> 
     <div class="inputOuter" style="border: 0px solid #D7D7D7;"> 
      <input type="text" name="cd_nicheng" class="inputstyle" placeholder="用户昵称" value="<?php echo $CcTvAi_com_nicheng;?>" readonly="readonly"/> 
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips">性别：</label> 
     <div class="inputOuter"  style="border: 0px solid #D7D7D7;"> 
	 <select id="cd_sex" class="select_normal" name="cd_sex" style="width:70px;">
          <option value="1"<?php if($CcTvAi_com_sex=="帅哥"){ echo " selected=\"selected\"";} ?>>帅 哥</option>
          <option value="0"<?php if($CcTvAi_com_sex=="靓女"){ echo " selected=\"selected\"";} ?>>美 女</option>
		  </select>
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips">生日：</label> 
     <div class="inputOuter" style="border: 0px solid #D7D7D7;"> 
         <select id="b_year" class="select_normal" name="b_year">
          <option value="0">请选择年</option>
<?php
//生日:年
for ($i=0; $i<100; $i++) {
	$they=date('Y')-$i;
	if ($they>="1970") {
		$selectstr=$they==date('Y', strtotime($CcTvAi_com_birthday)) ? ' selected' : '';
		echo "<option value=\"$they\"$selectstr>$they</option>";
	}
}
?>
         </select>
         <select id="b_month" class="select_normal" name="b_month">
          <option value="">请选择月</option>
<?php
//生日:月
for ($i=1; $i<13; $i++) {
	if ($i<=9) {
		$im="0" . $i;
	} else {
		$im=$i;
	}
	$selectstr=$im==date('m', strtotime($CcTvAi_com_birthday)) ? ' selected' : '';
	echo "<option value=\"$im\"$selectstr>$im</option>";
}
?>
         </select>
         <select id="b_day" class="select_normal" name="b_day">
          <option value="">请选择日</option>
<?php
//生日:日
for ($i=1; $i<32; $i++) {
	if ($i<=9) {
		$iday="0" . $i;
	} else {
		$iday=$i;
	}
	$selectstr=$iday==date('d', strtotime($CcTvAi_com_birthday)) ? ' selected' : '';
	echo "<option value=\"$iday\"$selectstr>$iday</option>";
}
?>
         </select>
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips">城市：</label> 
     <div class="inputOuter" style="border: 0px solid #D7D7D7;"> 
<script type="text/javascript" src="js/script_city.js"></script>
<script type="text/javascript">
<!--
showprovince('birthprovince', 'birthcity', '<?php echo $CcTvAi_com_birthcity;?>', 'birthcitybox');
showcity('birthcity', '<?php echo $CcTvAi_com_birthcity;?>', '', 'birthcitybox');
//-->
</script>
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips">QQ：</label> 
     <div class="inputOuter"> 
      <input type="text" name="cd_qq" class="inputstyle" placeholder="QQ号码" value="<?php echo $CcTvAi_com_qq;?>" maxlength="13" onKeyUp="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/> 
     </div> 
	 <select id="rqq" class="select_normal" name="rqq" style="margin-top: 10px;">
	 <?php if($CcTvAi_com_hidden=="1"){ 
	  echo '<option value="1" selected="selected">公开</option><option value="0">不公开</option>'; 
	 }else{ 
	 echo '<option value="1">公开</option><option value="0" selected="selected">不公开</option>'; 
	 } ?>
		  </select>
    </div> 
    <div class="uinArea"> 
     <label class="input-tips">签名：</label> 
     <div class="inputOuter" style="border: 0px solid #D7D7D7;">
      <textarea name="cd_sign" cols="30" rows="7"><?php echo $CcTvAi_com_sign;?></textarea>
     </div> 
    </div> 
    <div class="ptm-btn-row"> <button class="ptm-btn ptm-btn-primary ptm-btn-block">确认修改</button> </div>
   </form> 
  </div> 

<?php }elseif($view=="avatar"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="on tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="tag-item"><span>修改昵称</span></a>
    </div>  	
   </div> 
  <script type="text/javascript">
      function fileSelected() {
        var file = document.getElementById('Filedata').files[0];
        if (file) {
          var fileSize = 0;
          if (file.size > 1024 * 1024)
            fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + 'MB';
          else
            fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';
          document.getElementById('fileName').innerHTML = '文件名: ' + file.name;
          document.getElementById('fileSize').innerHTML = '文件大小: ' + fileSize;
          document.getElementById('fileType').innerHTML = '文件类型: ' + file.type;
		  var cd_name=/\.[^\.]+/.exec(file.name);
		  var cd_type = "<?php echo cd_uppictype?>";
		  if(cd_type.indexOf(''+cd_name+'') > 0 ){}else{sweetAlert({title: "上传提醒",text: "文件格式错误，请重新选择",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});}
		  
/* 		  var cd_size=document.getElementById('Filedata').files[0].size;
		  var cd_uppicsize="<?php echo (cd_uppicsize*1024*1024); ?>";
		  if(cd_size > cd_uppicsize){sweetAlert({title: "上传提醒",text: "文件太大，请重新选择",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});} */
        }
      }
      function uploadFile() {
        var fd = new FormData();
        fd.append("Filedata", document.getElementById('Filedata').files[0]);
        var xhr = new XMLHttpRequest();
        xhr.upload.addEventListener("progress", uploadProgress, false);
        xhr.addEventListener("load", uploadComplete, false);
        xhr.addEventListener("error", uploadFailed, false);
        xhr.addEventListener("abort", uploadCanceled, false);
        xhr.open("POST", "upload.php?ac=profile");
        xhr.send(fd);
      }
      function uploadProgress(evt) {
        if (evt.lengthComputable) {
          var percentComplete = Math.round(evt.loaded * 100 / evt.total);
		  if(percentComplete==100){
			  document.getElementById('progressNumber').innerHTML = "<div id=\"percent\" style=\"left: -"+ percentComplete.toString() +"%;\">服务器正在处理中,请稍等....</div><div id=\"line\" w=\"100\" style=\"width: "+ percentComplete.toString() +"%;\"></div>";
		  }else{
			  document.getElementById('progressNumber').innerHTML = "<div id=\"percent\" style=\"left: -"+ percentComplete.toString() +"%;\">"+ percentComplete.toString() +"%</div><div id=\"line\" w=\"100\" style=\"width: "+ percentComplete.toString() +"%;\"></div>";
		  }
        }
        else {
          document.getElementById('progressNumber').innerHTML = '未知大小';
        }
      }
      function uploadComplete(evt) {
        var uploadok=evt.target.responseText;
		if(uploadok==10000){
			sweetAlert({title: "上传提醒",text: "请先登录后操作",type: "",confirmButtonColor: "#1abc9c"});
		} else if(uploadok==10001){
			sweetAlert({title: "上传提醒",text: "请上传正确的照片文件",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
		} else if(uploadok==10002){
			sweetAlert({title: "上传提醒",text: "保存文件失败",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
		} else if(uploadok==10003){
			sweetAlert({title: "上传提醒",text: "请选择要上传的文件",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
		} else if(uploadok==10004){
			sweetAlert({title: "上传提醒",text: "上传成功",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
		} else {
			sweetAlert({title: "上传提醒",text: "未知错误",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
		}
		
      }
      function uploadFailed(evt) {
        sweetAlert({title: "上传提醒",text: "文件错误",type: "",confirmButtonColor: "#1abc9c"}, function() {location.href = location.href;});
      }
      function uploadCanceled(evt) {
        sweetAlert({title: "上传提醒",text: "文件上传中断",type: "",confirmButtonColor: "#1abc9c"});
      }
    </script>
<div class="pic-up">
<div class="head"><strong>上传头像</strong></div>
 <div style="padding: 10px;line-height: 25px;">
 <p>请选择您手机上的<?php echo cd_uppictype?>照片文件</p>
 <p>单个文件限制：<?php echo cd_uppicsize?>MB以内</p>
    <div id="fileName"></div>
    <div id="fileSize"></div>
    <div id="fileType"></div>
</div>
		<form class="form" enctype="multipart/form-data" method="post" action="upload.php?ac=profile">
			<input type="file" name="Filedata" class="file" id="Filedata" onchange="fileSelected();"/>
			<input type="button" value="上传" onclick="uploadFile()" class="form-btn"/>
		</form>	
 </div>
<div class="up-barline"><div id="progressNumber"></div></div>
<?php }elseif($view=="password"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="on tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="tag-item"><span>修改昵称</span></a>
    </div>  	
   </div> 
  <div class="profile-content"> 
   <form action="do.php?ac=profilepassword" method="post"> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">当前密码：</label> 
     <div class="inputOuter"> 
      <input type="password" name="roldpassword" class="inputstyle" placeholder="当前使用的密码" value=""/> 
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">新密码：</label> 
     <div class="inputOuter"> 
	 <input type="password" name="rpassword" class="inputstyle" placeholder="请输入新的密码" value=""/> 
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">确认密码：</label> 
     <div class="inputOuter"> 
	 <input type="password" name="rpassword2" class="inputstyle" placeholder="请在输一次新的密码" value=""/> 
     </div> 
    </div> 
    <div class="ptm-btn-row"> <button class="ptm-btn ptm-btn-primary ptm-btn-block">确认修改</button> </div>
   </form> 
  </div> 
<?php }elseif($view=="protectio"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="on tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="tag-item"><span>修改昵称</span></a>
    </div>  	
   </div> 
  <div class="profile-content"> 
   <form action="do.php?ac=profileprotectio" method="post"> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">当前密码：</label> 
     <div class="inputOuter"> 
      <input type="password" name="rpasswords" class="inputstyle" placeholder="当前的登录密码" value=""/> 
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">密保问题：</label> 
     <div class="inputOuter"> 
      <input type="text" name="rquestion" class="inputstyle" placeholder="问题" value=""/> 
     </div> 
    </div> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">密保答案：</label> 
     <div class="inputOuter"> 
      <input type="password" name="ranswer" class="inputstyle" placeholder="答案" value=""/> 
     </div> 
    </div> 
    <div class="ptm-btn-row"> <button class="ptm-btn ptm-btn-primary ptm-btn-block">确认修改</button> </div>
   </form> 
  </div> 
<?php }elseif($view=="email"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="on tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="tag-item"><span>修改昵称</span></a>
    </div>  	
   </div>  
  <div class="profile-content"> 
   <form action="do.php?ac=profileemail" method="post"> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">联系邮箱：</label> 
     <div class="inputOuter"> 
      <input type="text" name="email" class="inputstyle" placeholder="请填写正确的邮箱帐号" value="<?php echo $CcTvAi_com_email;?>"/> 
     </div> 
    </div> 

    <div class="ptm-btn-row"> <button class="ptm-btn ptm-btn-primary ptm-btn-block">确认修改</button> </div>
   </form> 
  </div> 
<?php }elseif($view=="nickname"){?>
   <div class="tag-list"> 
    <div class="tag-section">
	<a href="index.php?ac=profile" class="tag-item"><span>基本资料</span></a>
	<a href="index.php?ac=profile&view=avatar" class="tag-item"><span>修改头像</span></a>
	<a href="index.php?ac=profile&view=password" class="tag-item"><span>修改密码</span></a>
	<a href="index.php?ac=profile&view=protectio" class="tag-item"><span>修改密保</span></a>
	<a href="index.php?ac=profile&view=email" class="tag-item"><span>修改邮箱</span></a>
	<a href="index.php?ac=profile&view=nickname" class="on tag-item"><span>修改昵称</span></a>
    </div>  	
   </div> 
  <div class="profile-content"> 
   <form action="do.php?ac=profilenickname" method="post"> 
    <div class="uinArea"> 
     <label class="input-tips" style="width: 80px;">用户昵称：</label> 
     <div class="inputOuter"> 
      <input type="text" name="nicheng" class="inputstyle" placeholder="中英文昵称" value="<?php echo $CcTvAi_com_nicheng;?>"/> 
     </div> 
    </div> 

    <div class="ptm-btn-row"> <button class="ptm-btn ptm-btn-primary ptm-btn-block">确认修改</button> </div>
   </form> 
  </div> 
<?php }?>