示例#1
0
文件: tools.php 项目: noikiy/ejia
		'4' => '按天存入不同目录',
	);
	if(!empty($_POST['moveattsubmit']) || $step == 1) {
		$rpp = "500"; //每次处理多少条数据
		$totalrows = isset($totalrows) ? $totalrows : 0;
		$convertedrows = isset($convertedrows) ? $convertedrows : 0;
		$start = isset($start) && $start > 0 ? $start : 0;
		$end =	$start + $rpp - 1;
		$converted = 0;
		$maxid = isset($maxid) ? $maxid : 0;
		$newattachsave = isset($newattachsave) ? $newattachsave : 0;
		$step = 1;
		if($start <= 1) {
			$db->query("UPDATE {$tablepre}settings SET value = '$newattachsave' WHERE variable = 'attachsave'");
			$cattachdir = $db->result($db->query("SELECT value FROM {$tablepre}settings WHERE variable = 'attachdir'"), 0);
			validid('aid', 'attachments');
		}
		$attachpath = isset($cattachdir) ? TOOLS_ROOT.$cattachdir : TOOLS_ROOT.'./attachments';
		$query = $db->query("SELECT aid, tid, dateline, filename, filetype, attachment, isimage, thumb FROM {$tablepre}attachments WHERE aid >= $start AND aid <= $end");
		while ($a = $db->fetch_array($query)) {
			$aid = $a['aid'];
			$tid = $a['tid'];
			$dateline = $a['dateline'];
			$filename = $a['filename'];
			$filetype = $a['filetype'];
			$attachment = $a['attachment'];
			$isimage = $a['isimage'];
			$thumb = $a['thumb'];
			$oldpath = $attachpath.'/'.$attachment;
			if(file_exists($oldpath)) {
				$realname = substr(strrchr('/'.$attachment, '/'), 1);
示例#2
0
 /**
  * Проверка на верный IP
  * @param int $ip IP пользователя
  * @return bool верный IP?
  */
 public function validip($ip)
 {
     return $ip && (validid($ip) ? $ip === ip2ulong(long2ip($ip)) : $ip === long2ip(ip2ulong($ip)));
 }