Unexplained PHP Error

A

Anonymous

Guest
I have no idea whats wrong with my code but I do know I'm getting an error in the getJSImageList() function because that's where it stops. The page is located at http://www.thetechbox.com/editpage.php and the code is:

Code:
<? // Pre-Ish-Ing //
// Set Variables
$versionCreator = "0.2";
$cellColor = "#CCCCFF";
$titleCellColor = "#FFFFFF";

// Functions
function ImageDirectoryListing($directory,$type)
{
        $dirHandle = @opendir($directory) or die("Path $directory is invalid");

        for($i = 0;$file = readdir($dirHandle); )
        {
                if(strpos($file, $type) !== false)
                {
                        $i++;
                        $fileList[$i] = $file;
                }
        }

        return $fileList; 

}
function colorPulldownMenu($name,$numTabs)
{
	$colorName = array("Red","Green","Blue","Yellow","Magenta","Cyan");
	$colorCode = array("#FF0000","#00FF00","#0000FF","#FFFF00","#FF00FF","#00FFFF");

	for($i=0;$i<$numTabs;$i++)
	{
		$tabs = $tabs."	";
	}
	echo "<select name=\"$name\">\n";
	for($i=0;$i<6;$i++)
	{
		echo $tabs."	"."<option name=\"$colorCode[$i]\">$colorName[$i]\n";
	}
	echo $tabs."	"."<option name=\"other\">Other\n";	
	echo $tabs."</select> ";
	
}
function getTabs($num)
{
        for($i=0;$i<$num;$i++)
        {
                $tabs = $tabs."	";
        }
	return $tabs;
}
function getJSImageList($path,$type,$name0,$name1,$tabs)
{
	echo "Started Function getJSImageList()";
	// var $name0 = new Array(...,...,....,...);
	$List = ImageDirectoryListing($path,$type);
	// Make Array for Names of Images
	$returnValue = "var ".$name0." = new Array(".$List[1];
	for($i = 2; $i <= count($List);$i++)
	{
		$returnValue = $returnValue.",".$List[$i];
	}
	//Make Array for width of Image
	$returnValue = $returnValue.");\n";
	$img = @imagecreatefromjpeg($path."/".$List[1]);
	$returnValue = $returnValue."var ".$name1."Width = new Array(".imagesx($img);
	for($i = 2; $i <= count($List); $i++)
	{
		$img0 = @imagecreatefromjpeg($path."/".$List[$i]);
		$returnValue = $returnValue.",".imagesx($img0);
	}
	$returnValue = $returnValue.");\n";
	//Make Array for Height of Image
	$returnValue = $returnValue."var ".$name1."Height = new Array(".imagesy($img); 
	for($i = 2; $i <= count($List); $i++)
	{
		$img0 = @imagecreatefromjpeg($path."/".$List[$i]);
		$returnValue = $returnValue.",".imagesy($img0);
	}
	$returnValue = $returnValue.");\n";
	
	echo "Ended Function getJSImageList()";
	return $returnValue;
}

/* Pseudo Code //
// 1. Javascript for adding images and (pulldown menu, "add" image button, checkboxes for alignment, border, etc.
// 2. Javascript for adding URL's, link type pulldown(same window, new window, etc.), address or page selection (radio button selection) NOTE: for page selection use pull down with all the current pages titled using their titles, not addresses, Checkbox to use link around current image selection.
// 3. Javascript for tables... first selection..how many rows, how many colums, percentage of window size... Table Editor also
// 4. Title Content Single Line Text Box
// 5. Actually content window
// 6. Preview Page and Save
*/ // End of Pseudo Code //
?>
<html>
<head>
	<title>Page Creator <?=$versionCreator?></title>
	<script>
	
	</script>
</head>
<body>
	<h1 align="center">Page Creator <? echo $versionCreator; ?></h1>
	<? // Main Table ?>
	<table width="75%" align="center" border="1" style="border-collapse: collapse" bordercolor="#000000">
	<?//	<table width="100%" align="center"> ?>
		<tr>
		<td bgcolor="<? echo $titleCellColor;?>">
				Add Link
			</td>
		</tr>
		<tr>
			<td>
				<table width="100%">
					<form name="linkForm">
					<tr>
						<td width="50%" bgcolor="<? echo $cellColor;?>">
							Link Address:<br>
							<input type="text" name="linkAddress"><br>
							Link Type:
							<input type="radio" name="linkTarget" value="_blank"> New Window<br>
							<input type="radio" name="linkTarget" value="_self"> Current Window<br>
						</td>
						<td width="50%" bgcolor="<? echo $cellColor;?>">
							<? colorPulldownMenu("linkClickedColor",7);?> Clicked Color<br>
							<? colorPulldownMenu("linkUnclickedColor",7);?> Unclicked Color<br>
							<? colorPulldownMenu("linkActiveColor",7);?> Active Color<br>
						</td>
					</tr>
				</table>
			</td>
			
		</tr>
		<tr>
			<td bgcolor="<? echo $titleCellColor;?>">
				Add Image
			</td>
		</tr>
		<tr>
			<td>
				<table width="100%">
				<tr>
					<td bgcolor="<? echo $cellColor; ?>" width="50%">
						<form>
						<div align="left">
							<input type="radio" name="Align" value="c"> Align Center<br>
							<input type="radio" name="Align" value="l"> Align Left<br>
							<input type="radio" name="Align" value="r"> Align Right</br>
							<br>
							<select name="imagename">
								<?
								$path = "/var/www/html/PageCreator";
								$listing_imagename = ImageDirectoryListing("/var/www/html/PageCreator",".jpg");
								$joe = count($listing_imagename);
								$tabs = getTabs("8");
								for($i = 1; $i <= count($listing_imagename); $i++)
								{
										echo $tabs."<option value=\"$listing_imagename[$i]\">$listing_imagename[$i]</option>\n";
								}
								
								?>
							</select>
						</div>
					</td>
					<td width="50%" bgcolor="<? echo $cellColor; ?>">
						<input type="checkbox" value="Put Link Here" name="linkImage"> Link It? (uses Link Info from Above<br>
						<input type="text" size="5" name="imageWidth" value=""> Width<br>
						<input type="text" size="5" name="imageHeight" value=""> Height<br>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<input type="submit" value="Add Image">
				</form>
			</td>
		</tr>
		<tr>
			<td bgcolor="#000000">
			<textarea cols="100%" rows="15">Type Web Page Here</textarea>
			</td>
		</tr>
		<tr>
			<td>
				<input type="submit" value="Make Page!">
			</td>
		</tr>
			
		</table>
	
</body>
</html>
 
hi!
its a delirium:
Code:
$returnValue = "var ".$name0." = new Array(".$List[1];
for($i = 2; $i <= count($List);$i++)
{
$returnValue = $returnValue.",".$List[$i];
}
//Make Array for width of Image
$returnValue = $returnValue.");\n";
$img = @imagecreatefromjpeg($path."/".$List[1]);
$returnValue = $returnValue."var ".$name1."Width = new Array(".imagesx($img);
for($i = 2; $i <= count($List); $i++)
{
$img0 = @imagecreatefromjpeg($path."/".$List[$i]);
$returnValue = $returnValue.",".imagesx($img0);
}
$returnValue = $returnValue.");\n";
 
wait... I don't understand what you're talking about... a delirium?
 
bonkers said:
wait... I don't understand what you're talking about... a delirium?
interestin what do you mean by this :?: :?: (shortest variant)
Code:
$var = "fignya" = "someothervalue"
 
Back
Top