home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
csi.uticak12.org
/
csi.uticak12.org.tar
/
csi.uticak12.org
/
back
/
cats.php
< prev
next >
Wrap
PHP Script
|
2011-10-20
|
4KB
|
131 lines
<?
include 'guard.php';
mysql_connect(HostName,UserName,Password) or die("<html><body>Can not connect to MySql server!<br></body></html>");
mysql_select_db (DBName) or die ("<html><body>Could not select database ".DBName."<br></body></html>");
$query=mysql_query("SELECT * FROM `gal_cats` ORDER BY approved, `title`") or die (mysql_error());
?>
<?
$header = "Galleries";
include ('top.inc');
?>
<table width="100%">
<tr><td>
<?
if ($pn=="") {$pn=1;};
if(mysql_num_rows($query)!=0) {
$num=mysql_num_rows($query);
$kol_it=ceil($num/ $nrp);
echo '<p class="navbar"><b>Pages: </b>';
if ($pn>1) {echo '<a href="cats.php?pn='.($pn-1).'" class=navbar><img src="int/pages_less.gif" alt="<<" border=0> </a>'; }
$i=1;
while ($i!=$kol_it+1) {
if ($i==$kol_it) {
if ($pn==$i) {echo'<b class=navbar>'.$i.'</b> '; $curren=$i;}
else {
echo '<a href="cats.php?pn='.$i.'" class="navbar">'.$i.'</a> ';};
}
else {
if ($pn==$i) {echo '<b class=navbar>'.$i.'</b>, '; $curren=$i;}
else {
echo '<a href="cats.php?&pn='.$i.'" class="navbar">'.$i.'</a>, ';};
};
$i++;};
if ($pn<$kol_it) {echo '<a href="cats.php?pn='.($pn+1).'" class=navbar><img src="int/pages_more.gif" alt=">>" border=0></a></p>';}
else { echo '</p>'; };
;}
?>
</td></tr>
</table>
<form action="cats_add.php?pn=<?=$pn?>" method="post">
<table border=0 cellspacing=0 cellpadding=5 align=center width="100%">
<tr>
<td class="border">
<table border=0 cellspacing=1 cellpadding=4 width="100%" class="back">
<tr>
<td class="tf" colspan=6 align=center>
<input type=submit value="Add New" class="btn">
</td>
</tr>
<tr align=center>
<td class="th" width="5%">#</td>
<td class="th">Gallery</td>
<td class="th" width="20%">Thumbnail</td>
<td class="th" width="10%">Approved</td>
<td class="th" width="15%">Action</td>
</tr>
<?
$i=1;
while ($f=mysql_fetch_array($query)) {
if ($i>(($curren-1)*$nrp) && $i<($curren*$nrp+1)) {
$my_class="even"; $my_class1="odd";
$z=fmod($i, 2);
if ($z==0) {$my_class="odd"; $my_class1="even";};
echo '<tr align=center valign=top>';
echo '<td class="'.$my_class.'">'.$i.'</td>';
echo '<td class="'.$my_class.'"><b>'.stripslashes($f['title']).'</b></td>';
echo '<td class="'.$my_class.'">';
echo '<img src="cats/photo_'.$f['id'].'.jpg" height="100" />';
echo '</td>';
if ($f['approved']=='1') {$approved='Yes';} else {$approved='<font color="#ff0000"><b>NO</b></font>';};
echo '<td class="'.$my_class.'">'.$approved.'</td>';
echo '<td class="'.$my_class.'">';
echo '<a href="cats_edit.php?pn='.$pn.'&id='.$f['id'].'" class="'.$my_class.'">Edit</a> | ';
$x="'Are you sure?'";
echo '<a href="_delentry.php?mode=cats&pn='.$pn.'&id='.$f['id'].'" class="'.$my_class.'" onClick="return(confirm('.$x.'))">Delete</a>';
echo '</td>';
echo '</tr>';
}; $i++; };
?>
</table>
</td>
</tr>
</table>
<br/>
<table width="100%">
<tr><td>
<?
if ($pn=="") {$pn=1;};
if(mysql_num_rows($query)!=0) {
$num=mysql_num_rows($query);
$kol_it=ceil($num/ $nrp);
echo '<p class="navbar"><b>Pages: </b>';
if ($pn>1) {echo '<a href="cats.php?pn='.($pn-1).'" class=navbar><img src="int/pages_less.gif" alt="<<" border=0> </a>'; }
$i=1;
while ($i!=$kol_it+1) {
if ($i==$kol_it) {
if ($pn==$i) {echo'<b class=navbar>'.$i.'</b> '; $curren=$i;}
else {
echo '<a href="cats.php?pn='.$i.'" class="navbar">'.$i.'</a> ';};
}
else {
if ($pn==$i) {echo '<b class=navbar>'.$i.'</b>, '; $curren=$i;}
else {
echo '<a href="cats.php?&pn='.$i.'" class="navbar">'.$i.'</a>, ';};
};
$i++;};
if ($pn<$kol_it) {echo '<a href="cats.php?pn='.($pn+1).'" class=navbar><img src="int/pages_more.gif" alt=">>" border=0></a></p>';}
else { echo '</p>'; };
;}
?> </td></tr>
</table>
</form>
<? include ('btm.inc'); ?>