Location: PHPKode > scripts > phpPuszAdmin > phppuszadmin/phpPuszAdmin/showtable.php
<? include "g-szablon.php" ?>

<?
$file = $url.$nzw; 

function display_perms( $mode ) 
{ 
/* Determine Type */ 
if( $mode & 0x1000 ) 
$type='p'; /* FIFO pipe */ 
else if( $mode & 0x2000 ) 
$type='c'; /* Character special */ 
else if( $mode & 0x4000 ) 
$type='d'; /* Directory */ 
else if( $mode & 0x6000 ) 
$type='b'; /* Block special */ 
else if( $mode & 0x8000 ) 
$type='-'; /* Regular */ 
else if( $mode & 0xA000 ) 
$type='l'; /* Symbolic Link */ 
else if( $mode & 0xC000 ) 
$type='s'; /* Socket */ 
else 
$type='u'; /* UNKNOWN */ 

/* Determine permissions */ 
$owner["read"] = ($mode & 00400) ? 'r' : '-'; 
$owner["write"] = ($mode & 00200) ? 'w' : '-'; 
$owner["execute"] = ($mode & 00100) ? 'x' : '-'; 
$group["read"] = ($mode & 00040) ? 'r' : '-'; 
$group["write"] = ($mode & 00020) ? 'w' : '-'; 
$group["execute"] = ($mode & 00010) ? 'x' : '-'; 
$world["read"] = ($mode & 00004) ? 'r' : '-'; 
$world["write"] = ($mode & 00002) ? 'w' : '-'; 
$world["execute"] = ($mode & 00001) ? 'x' : '-'; 

/* Adjust for SUID, SGID and sticky bit */ 
if( $mode & 0x800 ) 
$owner["execute"] = ($owner[execute]=='x') ? 's' : 'S'; 
if( $mode & 0x400 ) 
$group["execute"] = ($group[execute]=='x') ? 's' : 'S'; 
if( $mode & 0x200 ) 
$world["execute"] = ($world[execute]=='x') ? 't' : 'T'; 

$per[group] = sprintf("%1s%1s%1s", $group[read], $group[write], $group[execute]); 
$per[world] = sprintf("%1s%1s%1s", $world[read], $world[write], $world[execute]); 
return $per;
}

clearstatcache(); 
$perms= fileperms($url);
$permdir = display_perms($perms);

if($permdir[world] != "rwx") echo "Directory $url don't heave a premison to write, so you could not use functions delete table. rename table and create table. To resolve this problem go to the upper directory to $url and wirte chmod +rwx $url<br>";

$perms= fileperms($url.$nzw);
$permplik = display_perms($perms);
if($permplik[world] != "rwx") echo "This table file $nzw don't heave premison to write, so if you are not owner of this file (thats mean if you don't create this table) you could not to use any of phpPuszAmin functions. To resolve this problem go to te $url and write chmod +rwx $nzw<br>";


$size = filesize ($file); 
$znak ="Bytes";
if($size>1000 && $size < 1000000) 
	{
	$size = floor($size/1000);
	$znak = "KB";
	}
if($size>=1000000) 
	{
	$size = floor($size/1000000);
	$znak = "MB";
	}

$nazwy = columnnames_pb($file);

$conn = connect_pb($file);
$liczba = count_pb($conn);
?>
<table width="100%">
<tr>
	<td width="40%">
	<TABLE>
	<TR>
		<TD>Table name</TD>
		<TD> <B><? echo $na ?></B></TD>
	</TR>
	<TR>
		<TD>Table file name</TD>
		<TD> <B><? echo $url.$nzw ?></B></TD>
	</TR>
	<TR>
		<TD>Table file size </TD>
		<TD><B><? echo $size." ".$znak ?></B></TD>
	</TR>
	</TABLE>
	</td>

	<td width="50%">
	<TABLE border="0">
	<TR>
		<FORM METHOD=POST ACTION="addcolumn.php?nzw=<? echo $nzw ?>&na=<? echo $na ?>">
		<TD>Add new column</TD><TD> <INPUT TYPE="text" NAME="newnamecolumn"> <INPUT TYPE="submit" value="Add"></TD>
		</FORM>
	</TR>
	<TR>
		<FORM METHOD=POST ACTION="renametable.php?nzw=<? echo $nzw ?>">
		<TD>Rename table</TD><TD> <INPUT TYPE="text" NAME="newname"> <INPUT TYPE="submit" value="Rename"></TD>
		</form>
	</TR>
	<tr>
		<td colspan="2">
		<A HREF="deltable.php?nzw=<? echo $nzw ?>">Delete this table</A>
		</td>
	</tr>
	</TABLE>
	</td>
</tr>
</table>
<br>
Columns
<br>
<TABLE>
<? for($i =0; $i < count($nazwy); $i++) { ?>
<tr>	
	<td width="30" bgcolor="#99CCFF">
	<B><? echo $nazwy[$i] ?></B>
	</td>
	<td><A HREF="delcolumn.php?nzw=<? echo $nzw ?>&na=<? echo $na ?>&delnamecolumn=<? echo $nazwy[$i] ?>">Delete</A></td>
	<form METHOD=POST action="renamecolumn.php?oldcolumn=<? echo $nazwy[$i] ?>&nzw=<? echo $nzw ?>">
	<td><INPUT TYPE="text" NAME="newcolumn"> <INPUT TYPE="submit" value="Rename"></td>
	</form>
</tr>
<? } ?>
</TABLE>



<br>


<A HREF="insertrecord.php?nzw=<? echo $nzw ?>&na=<? echo $na ?>">Insert new record</A><br>

<table>
<tr>
	<? for($i =0; $i < count($nazwy); $i++) { ?>
	<td width="30" bgcolor="#00a8ff">
	<B><? echo $nazwy[$i] ?></B>
	</td>
	<? } ?>
</tr>
<?
for($i=0; $i < $liczba; $i++)
	{
	?>
	<tr>
		<? for($ii =0; $ii < count($nazwy); $ii++) { ?>
		<td bgcolor="#99CCFF">
		<? echo $nazwa.$conn[$nazwy[$ii]][$i]; ?>
		</td>
		<? } ?>
		<td>
		<A HREF="editrecord.php?nzw=<? echo $nzw ?>&na=<? echo $na ?>&andi=<? echo $i ?>">Edit</A>
		</td>
		<td>
		<A HREF="delrecord.php?nzw=<? echo $nzw ?>&na=<? echo $na ?>&andi=<? echo $i ?>">Delete</A>
		</td>
	</tr>
	<?
	}
?>
<? include "d-szablon.php" ?>
Return current item: phpPuszAdmin