All pastes #77525 Raw Edit

freeone3000

public php v1 · immutable
·published 2006-07-03 03:47 UTC
rendered paste body
<?php require_once("cp/functions.php"); ?><?php function create_file_link($fname, $curdir) {	$link_name = $_SERVER['PHP_SELF'].'?edit='.$curdir.$fname;		return create_link($link_name, $fname);}function create_dir_link($fname, $curdir) {	$link_name = $_SERVER['PHP_SELF'].'?curdir='.$curdir.$fname;	return create_link($link_name, $fname);} ?><?php if(empty($cp)) {	header("Location: http://freeone3000.be:8080/cp.php");} ?><?php if(isset($_GET['edit'])) {	include_once('cp/edit.php');	return;}if(empty($_GET['curdir'])) {	if($_SESSION['user']=='freeone3000') {		$curdir = '../../';	} else {		$curdir = '../'.$_SESSION['user'].'/';	}} else {	$curdir = $_GET['curdir'];}$handle = @opendir($curdir) or die("Could not open directory $curdir");$output = '';while($fname = readdir($handle)) {	if($fname=='.' || $fname=='..') {		continue;	}	if(is_file($fname)) {		$output .= create_file_link($fname, $curdir);	} else if(is_dir($fname)) {		$output .= create_dir_link($fname, $curdir);	}	$output .= "<br>\n";}closedir($handle);echo($output);?>#And in cp/functions.php<?php function create_link($link_target, $link_name) {	echo("create_link was called.<br>");	return '<a href="'.$link_target.'">'.$link_name.'</a>';} ?>