⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editzhai.php

📁 PHP免费网摘程序 详细说明: 安装说明: 1、把文件上穿上去以后
💻 PHP
字号:
<? include("conn.php");?>
<? include("include/function.php");?>
<?
 
$IfEdit=$_POST[update];
$from=trim($_GET[from]);
$userid=$_COOKIE[userid];
if($IfEdit!="Yes"){
	$id=trim($_GET[id]);
	$from=trim($_GET[from]);
	$qr=mysql_query("select title,userid,fromurl, posttime,tags,intro,rank,isgood from zhai where id='$id' and userid='$userid' limit 1");
	$rs=mysql_fetch_array($qr);
	$title=$rs[title];
	$userid1=$rs[userid];
	$fromurl=$rs[fromurl];
	$picname=$rs[picname];
	$posttime=$rs[posttime];
	$tags=$rs[tags];
	$intro=$rs[intro];
	$rank=$rs[rank];
	$isgood=$rs[isgood];
	 
 
}else{
    $ispub=1;
	$id=$_POST[id];
	$title=$_POST[title];
	$fromurl=$_POST[fromurl];
	$intro=$_POST[intro];
	$rank=$_POST[rank];
	$tags=$_POST[tags];
	$isgood=$_POST[isgood];
	$from=$_POST[from];
	$picname=$_POST[picname];
	
	$tags=ereg_replace("  "," ",$tags);
	
	 
	
	$ls3=explode(".",strtolower($_FILES[pic][name]));
if($_FILES[pic][size]>0&&!($ls3[1]=="jpg"||$ls3[1]=="gif")&&$_FILES[pic][name]!="") {

$err1=1;
$err=1;echo "<script>window.alert('您上传的不是jpg/gif图片文件!!');</script>";
echo "<script>
        location.replace('editzhai.php?id=$id&from=$form');
		</script>";
}
else{
if($_FILES[pic][size]>30000) {
$err=1;echo "<script>window.alert('您上传的图片过大(不能超过30K)!');</script>";

echo "<script>
        location.replace('editzhai.php?id=$id&from=$form');
		</script>";
}
else
{


 $time=time();
 $filename="images/upload/".$time.".".$ls3[1];
 if(copy($_FILES['pic']['tmp_name'],$filename)){
if($_POST[picname]!=""){ @unlink($_POST[picname]);}
 $picname="images/upload/".$time.".".$ls3[1];
 $ispub=0;
 }
 }
}	

	
	
	
	
	
	
	
	mysql_query("update zhai set 
	title='$title',
	fromurl='$fromurl',
	intro='$intro',
	rank='$rank',
	tags='$tags',
	picname='$picname',
	ispub='$ispub',
	 
	where id='$id' and userid='$userid' limit 1"); 
}

?>
<html>
<head>
<title>妹妹网摘_网摘·网络书签·收藏夹</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<style type="text/css">
body {
	font-size: 12px; margin: 0px; background-color: #ffffff; text-decoration: none
}
td {
	font-size: 12px;
}
a:link {
	padding-right: 2px; padding-left: 2px; padding-bottom: 2px; color: #003399; padding-top: 2px; text-decoration: underline
}
a:active {
	padding-right: 2px; padding-left: 2px; padding-bottom: 2px; color: #ff0000; padding-top: 2px; text-decoration: underline
}
a:visited {
	padding-right: 2px; padding-left: 2px; padding-bottom: 2px; color: #551a8b; padding-top: 2px; text-decoration: underline
}
a:hover {
	padding-right: 2px; padding-left: 2px; padding-bottom: 2px; color: #ff0000; padding-top: 2px; text-decoration: underline
}
.whitetxt {
	color: white; text-decoration: none
}
.whitelink:link {
	font-weight: bold; color: white; text-decoration: underline
}
.whitelink:active {
	font-weight: bold; color: white; text-decoration: underline
}
.whitelink:visited {
	font-weight: bold; color: white; text-decoration: underline
}
.whitelink:hover {
	font-weight: bold; color: white; text-decoration: underline
}
.grayscript {
	font-size: 12px; color: #999999; text-decoration: none
}
.border {
	border-right: #d4d4d4 1px dashed; border-top: #d4d4d4 1px dashed; border-left: #d4d4d4 1px dashed; border-bottom: #d4d4d4 1px dashed
}
.notice {
	color: #ff6600
}
.middletxt {
	font-size: 13px; color: #333333
}
</style>
</head>
<?
if($IfEdit!="Yes"){
 
?>
<script language=javascript>
function checkForm(this_form)
{
	if(this_form.title.value == '')
    {
		alert("标题不能为空, 请重新输入!");
		this_form.title.focus();		
		return false;
    }

	if(this_form.fromurl.value == '')
    {
		alert("网址不能为空, 请重新输入!");
		this_form.fromurl.focus();		
		return false;
    }

	str = this_form.title.value;
	len = str.length;	
	
	var tt= "";
	if(str != '')
	{
		var i=0;
		do
		{
			var c = str.substr(i, 1);
			if(c != " ")
			{
				tt += c;
				
				//return false;
			}
		}while(++i < len);
	}	
	
	var length=this_form.title.value.length;
	if(this_form.title.value!="")
	{	
		for(i=0;i<this_form.title.value.length;i++)
		{
			if(this_form.title.value.charcodeAt(i)>255)
			{
				length++;
			}
		}
		 
		if(length > 100)
		{
			alert ("标题50个汉字之内,请重新输入");
			this_form.title.focus();			
			return false;
		}
	}
	
	length=this_form.intro.value.length;
	if(this_form.intro.value!="")
	{	
		for(i=0;i<this_form.intro.value.length;i++)
		{
			if(this_form.intro.value.charcodeAt(i)>255)
			{
				length++;
			}
		}
		 
		if(length > 1000)
		{
			alert ("简介200个汉字之内,请重新输入");
			this_form.intro.focus();						
			return false;
		}
	}
	return true;
}
</script>
<script language="javascript">
function selecttag(obj, index)
{
	if(document.all.tags.value.indexOf(obj.options[index].value) < 0)
	{
		if(obj.options[index].value != "\"0\"")
		{
			if(document.all.tags.value=="")
			{
				document.all.tags.value = obj.options[index].value;
			}
			}else{
			{
				document.all.tags.value += " " + obj.options[index].value;
			}
		}
	}
}
</script>
<form name="form1" method="post" action="editzhai.php" enctype="multipart/form-data"  onsubmit="return checkForm(this)">
  <table cellspacing=0 cellpadding=2 width=450 align=center border=0>
    <input type="hidden" name="id" value="<? echo $id;?>">
    <input type="hidden" name="from" value="<? echo $from;?>">   
    <tr>
      <td width="48" height=35 align=right>标题:</td>
      <td width="394"><input name=title id="title" style="width: 280px" value="<? echo $title;?>" size=40>
          <span class=notice>*</span></td>  
    </tr>
    <tr>
      <td align=right>网址:</td>
      <td><input 
      name=fromurl id="fromurl" style="width: 280px" value="<? echo $fromurl;?>" size=40>
          <span class=notice>*</span></td>  
    </tr>
    <tr>
      <td valign=top align=right>简介:</td>
      <td><textarea name="intro" cols=39 rows=4 id="intro" style="width: 280px"><? echo $intro;?></textarea></td>
    </tr>
    <tr>
      <td align=right>&nbsp;</td>
      <td class=grayscript height=20>选中被收藏网页的文字,自动加为简介</td>
    </tr>
    <tr>
      <td align=right height=23>评分:</td>
      <td><select name="rank">
          <option value="5" <? if($rank==5){ echo "selected"; }?>>☆☆☆☆☆</option>
          <option value="4" <? if($rank==4){ echo "selected"; }?>>☆☆☆☆</option>
          <option value="3" <? if($rank==3){ echo "selected"; }?>>☆☆☆</option>
          <option value="2" <? if($rank==2){ echo "selected"; }?>>☆☆</option>
          <option value="1" <? if($rank==1){ echo "selected"; }?>>☆</option>
      </select></td>
    </tr>
	  <tr>
	    <td class=middletxt align=right height=23>标签:</td>
	    <td><input name="tags" type="text" value="<? echo $tags;?>" size="21" maxlength="100">
	      <span class=notice>*</span> <select onchange="selecttag(this, this.selectedIndex);" name="tagselect" id="tagselect" style="width:105px ">
	        <option value=0>选择已有标签</option>
	        <? echo Gettags($userid);?>
	      </select></td>
	  </tr>
	  <tr>
	    <td align="right" class="middletxt"></td>
	    <td class="grayscript" height="20">可以输入或选择多个标签,标签之间用空格分隔</td>
	  </tr>  
	  <tr>
	  <td class=middletxt valign=top align=right>图片:</td>
                    <td > 
                      <input type="file" name="pic" size="26">
                      <font color="#FF0033">点击选择图片上传</font><br><br>
                      注意:<font color="#ff0000">图片尺寸是宽130象素 * 高88象素,</font>大小不能大于10K字节,并且图片文件只能是后缀为gif或jpg的格式文件</td>
   <input name="update" type="hidden" value="Yes">
	  <input name="picname" type="hidden" value="<?=$picname;?>"> </tr>
				  
    
  </table>
  <table cellspacing=0 cellpadding=2 width=400 align=center border=0>
    <tr>
      <td align=right width=70 height=40>&nbsp;</td>
      <td valign=center width=322><input name="zhai" type="submit" class="button" id="zhai" value="保存到妹妹网摘"></td>
    </tr>
    <tr align=middle>
      <td colspan=2>&nbsp;</td>
    </tr>
  </table>
</form>
<?
 
}else{
?>
<script>
	setTimeout("op();",1000)
	function op()
	{	
		window.location="<? echo $from;?>";
	}
</script>
<table width="760" height="300" border="0" cellpadding="0" cellspacing="0" class="notice" align="center">
  <tr>
    <td align="center">修改成功...1秒钟后自动返回</td>
  </tr>
</table>
<?
}
?>
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -