home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
csi.uticak12.org
/
csi.uticak12.org.tar
/
csi.uticak12.org
/
back
/
cats_add.php
< prev
next >
Wrap
PHP Script
|
2011-10-20
|
3KB
|
79 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>");
if ($act=='1') {
$ftitle=addslashes($ftitle);
$res=mysql_query("INSERT INTO `gal_cats` (`title`, `approved`) VALUES ('$ftitle', '$fapproved')") or die (mysql_error());
$id=mysql_insert_id();
$filename=$_FILES['bpic2']['tmp_name'];
if ($filename!="") {
if (file_exists('cats/photo_'.$id.'.jpg')) {unlink ('cats/photo_'.$id.'.jpg');};
copy ($filename, 'cats/photo_'.$id.'.jpg');
};
echo '<script>location.href="cats.php?pn='.$pn.'"</script>';
};
?>
<?
$header = "Galleries - Add new";
include ('top.inc');
?>
<form action="cats_add.php?pn=<?=$pn?>" method="post" name="form1" ENCTYPE="multipart/form-data">
<table border=0 cellspacing=0 cellpadding=5 align=center width="100%">
<tr>
<td class="border">
<table border=0 cellspacing=1 cellpadding=5 width="100%" class="back">
<tr>
<td class="th" colspan=2><p align="center">Gallery Details</p></td>
</tr>
<tr>
<td class="even" align=right width="40%"><b>Approved:</b></td>
<td class="even"><input type="checkbox" name="fapproved" value="1" <? if ($fapproved=='1') {echo 'checked';};?>></td>
</tr>
<tr>
<td class="odd" align=right width="40%"><b>Title:</b></td>
<td class="odd"><input type="text" name="ftitle" value="<?=$ftitle?>" class="inp" size="60"></td>
</tr>
<tr>
<td colspan="2" align="center" class="even">
<img src="
<?
if (file_exists("cats/photo_".$id.".jpg")) {
echo "cats/photo_".$id.".jpg";} else {
echo "int/0.gif";
};
?>
" alt="" height="100" name="img_big2" border="1"><br><br>
</td>
</tr>
<tr>
<td class="even" align=right width="40%">
<b>Browse thumbnail:</b>
</td>
<td class="even">
<input type="file" size="30" class="inp" name="bpic2" onFocus="if (form1.bpic2.value!='') {document.all['img_big2'].src=form1.bpic2.value; form1.bpic2.value=form1.bpic2.value;}">
</td>
</tr>
<tr>
<td class="tf" align=center colspan=2>
<input type=submit class="btn" value="Submit">
<input type=button class="btn" value="Back" onClick="location.href='cats.php?pn=<?=$pn?>'">
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="act" value="1">
</form>
<? include ('btm.inc'); ?>