<?php
require('top.php');

InitGP(array('action','l_title','l_url','l_sort','l_presentation','l_img_url','l_review','id',),'GP',false);
// 频道管理
if ($action == 'ins') {
	strlen($l_img_url)>10 ? $l_img_true = 1 :  $l_img_true = 0;
	$sql = "INSERT INTO ".$db_tablepre."link (l_title,l_url,l_sort,l_presentation,l_img_url,l_img_true,l_review) VALUES ('".$l_title."', '".$l_url."',".$l_sort.",'".$l_presentation."','".$l_img_url."',".$l_img_true.",".$l_review.")";
	sql_return($sql) && Showmsg('post_Success');

}
elseif ($action == 'm') {
	$sql = "SELECT * FROM ".$db_tablepre."link WHERE l_id=".$id;
	$row= sql_return($sql,2);
	$l_title = $row['l_title'];
	$l_url = $row['l_url'];
	$l_sort = $row['l_sort'];
	$l_presentation = $row['l_presentation'];
	$l_img_url = $row['l_img_url'];
	$l_review = $row['l_review'];
}

elseif ($action == 'up') {
	strlen($l_img_url)>10 ? $l_img_true = 1 :  $l_img_true = 0;
	$sql = "UPDATE ".$db_tablepre."link SET l_title='".$l_title."',l_url='".$l_url."',l_sort=".$l_sort.",l_presentation='".$l_presentation."',l_img_url='".$l_img_url."',l_img_true=".$l_img_true.",l_review=".$l_review." WHERE l_id=".$id;
	sql_return($sql) && Showmsg('post_Success');
}


elseif ($action == 'del') {
		$sql = 'DELETE FROM '.$db_tablepre.'link WHERE l_id='.$id;
		sql_return($sql) && Showmsg('dle_Success');
}

else {
	$sql = "SELECT * FROM ".$db_tablepre."link ";
	$query = sql_return($sql);
	
}

require PrintEot($self_template,'A');
?>