All pastes #161686 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-05 18:35 UTC
rendered paste body
function _user_pics($username, $dirpref, $type) {
	$user_var = $username;
	//$dirpref = "members/";
	$dirthumb = "/thumb";
	echo "<br><br>".$username.$dirpref.$type;
	$a = '0';
	$filepath = "$dirpref$user_var$dirthumb";
	$url_path = "$dirpref$user_var";
	if (file_exists($filepath)) {
		$dir = dir($filepath);
		$userpic = "<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"5\" width=\"100%\">";
		while($entry=$dir->read()) {
			if($entry == "." || $entry == ".." || $entry == "NPHM_site_main.jpg") { 
				continue; 
			} 
  			//  $fp = @fopen("$filepath/$entry","r");
			if ($a == '0') { $userpic .= "<tr>"; }
			$userpic .= "<td align=\"center\"><div align=\"center\"><a href=\"$url_path/$entry\"><img src=\"$filepath/$entry\" alt=\"$entry\" /></a></div></td>";
			if ($type == "1") {
				$userpic .= "<td><a href=\"?page=usertype&delpic=true&picid=$entry\">delete</a><br><a href=\"?page=usertype&setasmain=true&picid=$entry\">Set as Main</a></td>";
			}
			$a = $a + 1;
			if ($a == '3') { 
				$a = 0; 
				$userpic .= "</tr>";
			}
		}
		$userpic .= "</table>";
	} else {
		$userpic = "<div align=\"center\">No Pics</div>";
	}
	return $userpic;
}

_user_pics($username, "members/", "0") <--- works in www.site.come/page.php
_user_pics($username, "../members/", "0")  <-- does NOT work in www.site.come/admin/page.php