All pastes #655994 Raw Edit

Untitled

public php v1 · immutable
#655994 ·published 2007-08-13 19:43 UTC
rendered paste body
<?php	session_start();	require_once "./dbconnect.php";	//main code	$imageDir = "img/";	$unsorted = scandir($imageDir);		foreach ($unsorted as $filesList) {		if (!ereg("thumb", $filesList)) {			$files[] .= $filesList;		}	}		$numImgs = count($files);	$numImgs++;			$file = $_GET['photo'];	$path_parts = pathinfo('img/trash/' . $file);	$oldBase = $path_parts['filename'];	$oldExt = '.' . $path_parts['extension'];	$oldFile = 'img/trash/' . $file;	$oldThumb = 'img/trash/' . $oldBase . '_thumb' . $oldExt;		if (preg_match("field", $file)) {		$photoCat = "field";	} else {		$photoCat = "pipeline";	}	if (!file_exists($newFile) and !file_exists($newThumb)) {		$newFile = 'img/' . $file;		$newThumb = 'img/' . $oldBase . '_thumb' . $oldExt;	} else {		$newFile = 'img/' . $photoCat . "_photo" . $numImgs . $oldExt;		//$targetPath = $targetPath . $photoCategory . "_photo" . $numImgs . $uploadExt;		$newThumb = 'img/' . $photoCat . "_photo" . $numImgs . "_thumb" . $oldExt;	}	if (rename($oldFile, $newFile) && rename($oldThumb, $newThumb)) {		header( "Location: ./dragon_admin.php?page_name=photo_conf");	} else {		header( 'Location: ./dragon_admin.php?page_name=photo_conf");	}?>