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

📄 admin.php

📁 easy cms for getion you image with high qualite
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/***********************************************************************  Copyright (C) 2006 Aizu Ikmal Ahmad (aizu@ikmal.com.my)  This file is part of iFoto.  iFoto is free software; you can redistribute it and/or modify it  under the terms of the GNU General Public License as published  by the Free Software Foundation; either version 2 of the License,  or (at your option) any later version.  iFoto is distributed in the hope that it will be useful, but  WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston,  MA  02111-1307  USA************************************************************************/include('config.php');if(@$_COOKIE['ifotocp'] == md5($admin_username.$admin_password)){	if(@$_GET['p'] == 'logout'){		logout();	}else{		html_interface();	}}else{	if(@$_POST['login'] == $admin_username && @$_POST['password'] == $admin_password){		setcookie('ifotocp', md5($admin_username.$admin_password), time()+3600, '/', false);		//reload		echo '<meta http-equiv=refresh content=0;URL=?>';	}else{		html_login();	}}function admin_contents(){	$page_request = @$_GET['p'];	switch($page_request){		case 'gallery' : gallery(); break;		case 'comments' : comments(); break;		case 'thumbnails' : thumbnails(); break;		case 'sentinal' : sentinal(); break;		default : homepage(); break;	}}function homepage(){	?>	<center>	<br /><br />	Welcome to <b><font color="#FF6600">i</font>Foto Control Panel</b> version 1.0	<br /><br />	<b>NOTES</b><br />	This is the initial release of control panel since a lot of user want to upload thier photos by using web.	<br />	But to enable this feature, you must make sure the 'gallery' directory is writable by webserver.	<br /><br />	If you have any questions or comments, feel free to contact me at <a href="mailto:aizu@ikmal.com.my">aizu@ikmal.com.my</a> (email).	<br /><br />	</center>	<?}function gallery(){	?>	<div style="float:left; width:300px;">		<b>Gallery List</b><br />	</div>	<div style="float:right; width:300px; text-align:right; padding-right:10px;">		<a href="#" onclick="pop('dir_masteradd','')">Add New Album</a>	</div>	<br /><br />	<?	$opendiryg = "gallery/";	if ($handle = opendir($opendiryg)) {		while (false !== ($file = readdir($handle))) {			if ($file != "." && $file != ".." && $file != "Thumbs.db") {				?>					<div style="border:1px solid #CCCCCC; background:#CCCCCC; padding:5px;">						<div style="float:left; width:300px;">							<b><?=$file?></b>						</div>						<div style="float:right; text-align:right; width:400px;">							<?if(is_writable($opendiryg.$file)){?>								<a href="#" onclick="pop('dir_add','<?=urlencode($file)?>')">Add new sub-gallery</a> | <a href="#" onclick="pop('dir_genthumbs','<?=urlencode($file)?>')">Regenerate Thumbs</a> | <a href="#" onclick="pop('dir_upload','<?=urlencode($file)?>')">Upload new photos</a> | <a href="#" onclick="pop('dir_rename','<?=urlencode($file)?>')">Rename</a> | <a href="#" onclick="pop('dir_delete','<?=urlencode($file)?>')">Delete</a>							<?}else{?>								<div style="border:1px solid #FC9A9A; background:#FEDADA; padding:0px; width:200px; text-align:center;">Directory not writable (<a href="">?</a>)</div>							<?}?>						</div>						<div style="clear:both;"></div>					</div>				<?				$opendiryg_sub = "gallery/$file";				if ($handle_sub = opendir($opendiryg_sub)) {					while (false !== ($file_sub = readdir($handle_sub))) {						if ($file_sub != "." && $file_sub != ".." && $file_sub != "Thumbs.db") {							if(is_dir($opendiryg_sub.'/'.$file_sub)){								?>									<div style="margin-left:20px; border:1px solid #CCCCCC; background:#E3E3E3; padding:5px;">										<div style="float:left; width:360px;">											<b><?=$file_sub?></b>										</div>										<div style="float:right; text-align:right; width:300px;">											<?if(is_writable($opendiryg.$file)){?>												<a href="#" onclick="pop('dir_genthumbs','<?=urlencode($file.'/'.$file_sub)?>')">Regenerate Thumbs</a> | <a href="#" onclick="pop('dir_upload','<?=urlencode($file.'/'.$file_sub)?>')">Upload new photos</a> | <a href="#" onclick="pop('dir_rename','<?=urlencode($file.'/'.$file_sub)?>')">Rename</a> | <a href="#" onclick="pop('dir_delete','<?=urlencode($file.'/'.$file_sub)?>')">Delete</a>											<?}else{?>												<div style="border:1px solid #FC9A9A; background:#FEDADA; padding:0px; width:200px; text-align:center;">Directory not writable (<a href="">?</a>)</div>											<?}?>										</div>										<div style="clear:both;"></div>									</div>								<?									$opendiryg_file = $opendiryg_sub.'/'.$file_sub;									if ($handle_file = opendir($opendiryg_file)) {										while (false !== ($file_tri = readdir($handle_file))) {											if ($file_tri != "." && $file_tri != ".." && $file_tri != "Thumbs.db") {												$file_id = base64_encode($file .'/' . $file_sub.']|['.$file_tri . ']|[' . filectime('gallery/'.$file .'/' . $file_sub.'/'.$file_tri));												?>													<div style="margin-left:40px; border:1px solid #CCCCCC; border-bottom:0px; padding:5px;">														<img style="border:1px solid #666666;" src="data/thumbdata_<? echo base64_encode($file .'/' . $file_sub.']|['.$file_tri . ']|[' . filectime('gallery/'.$file .'/' . $file_sub.'/'.$file_tri)); ?>.jpg" width="20">														<?=$file_tri?> -														<?if(is_writable($opendiryg.$file)){?>															<a href="#" onclick="pop('file_rename','<?=$file_id?>')">Rename Filename</a> | <a href="#" onclick="pop('file_desc','<?=$file_id?>')">Edit Description</a> | <a href="#" onclick="pop('file_delete','<?=$file_id?>')">Delete</a>														<?}else{?>															<span style="border:1px solid #FC9A9A; background:#FEDADA; padding:0px 10px; text-align:center;">File not writable (<a href="">?</a>)</span>														<?}?>													</div>												<?											}										}										closedir($handle_file);									}							}else{								$file_id = base64_encode($file . ']|['.$file_sub . ']|[' . filectime('gallery/'.$file .'/' . $file_sub));								?>									<div style="margin-left:20px; border:1px solid #CCCCCC; border-bottom:0px; padding:5px;">										<img style="border:1px solid #666666;" src="data/thumbdata_<? echo base64_encode($file.']|['.$file_sub . ']|[' . filectime('gallery/'.$file.'/'.$file_sub)); ?>.jpg" width="20">										<?=$file_sub?> -										<?if(is_writable($opendiryg.$file)){?>											<a href="#" onclick="pop('file_rename','<?=$file_id?>')">Rename Filename</a> | <a href="#" onclick="pop('file_desc','<?=$file_id?>')">Edit Description</a> | <a href="#" onclick="pop('file_delete','<?=$file_id?>')">Delete</a>										<?}else{?>											<span style="border:1px solid #FC9A9A; background:#FEDADA; padding:0px 10px; text-align:center;">File not writable (<a href="">?</a>)</span>										<?}?>									</div>								<?							}						}					}					closedir($handle_sub);				}			}		}		closedir($handle);	}}function comments(){	?>	<b>Comment List</b>	<div class="comments">		<div class="list">		<?		$filename = 'data/comments.dat';		if(!file_exists($filename)){			$fp = fopen($filename, 'w');			fwrite($fp, '');			fclose($fp);		}		$comments_data = implode ('', file ($filename));		$comments_arr = explode('}|+|{', $comments_data);		if(@$_GET['act'] == 'delete'){			$key_to_delete = $_GET['id'];			unset($comments_arr[$key_to_delete]);			$content_to_write = '';			$total_comments = count($comments_arr);			$i = 1;			foreach ($comments_arr as $comments_data){				if($i != $total_comments){$append_saperator = '}|+|{';}else{$append_saperator = '';}				$content_to_write .= $comments_data.$append_saperator;				$array[] = $comments_data;				$i++;			}			$fp = fopen($filename, 'w');			fwrite($fp, $content_to_write);			fclose($fp);			?>			<div style="border:1px solid #C6C6C6; padding:10px; width:200px; text-align:center; margin:0 auto;">				Comment deleted.			</div>			<br />			<?		}		if($comments_data){			foreach ($comments_arr as $comments_key => $comments_data){				$comments_data = unserialize($comments_data);				?>				<div class="thumb"><a href="" target="_blank"><img src="data/thumbdata_<?=$comments_data['id']?>.jpg" width="50px" border="0" /></a></div>				<div class="entry">					<div class="meta">						<b><?php echo $comments_data['name'];?></b> - <?php echo $comments_data['email'];?><?php if($comments_data['website']){echo ' (<a href="http://'.str_replace('http://','',$comments_data['website']).'" target="_blank">'.$comments_data['website'].'</a>)';}?> on <?php echo date('l, j F Y', $comments_data['time']);?>						- <a href="?p=comments&act=delete&id=<?php echo $comments_key;?>">Delete</a>					</div>					<div class="comment"><?php echo $comments_data['comment'];?></div>				</div>				<div class="clear"></div>				<?			}		}else{			echo 'No comment.';		}		?>		</div>

⌨️ 快捷键说明

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