upload image php scripts have a problem

A

Anonymous

Guest
I have a table call " photos". The images_upload.php page is for upload images by using browse button in the form and now is running a problem that indicats:
Fatal error: Call to undefined function: select() in /home/symphon1/public_html/admin/images_upload.php on line 26

Or Fatal error: Call to undefined function: author() in /home/symphon1/public_html/admin/images_upload.php on line 25

Can someone to tell me what is problem of that? Here are codes below, Thanks.
<?php require_once('../Connections/apress.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

auth();
$photo=select("$db.photos","id='$photoID'", "" );

if(!empty($upload))
{

//uploads thumbnail
if($_FILES['name']['name']!="")
{
$dir=$admin[dir];
$_FILES['name']['name']-str_replace(" ","",$_FILES['name']['name']);
//check is image is uploaded and move it to the images folder
if(!move_uploaded_file($_FILES['name']['tmp_name'], "images".$_FILES['name']['name']))
$message="Couldn't upload image";
chmod("images".$_FILES['name']['name'],0777);

//choose the image height
$scale="-geometry '115x115>' ";

//image save path
$newThum="images".$_FILES['name']['name']." images".$_FILES['name']['name'];

//imagemagick command format
$command = "/usr/local/bin/convert $scale $newThum";

//execute command
`$command`;

//choose the image height
$scale="-geometry '325x325>' ";

//image save path
$newThum="images".$_FILES['name']['name']." images".$_FILES['name']['name'];

//imagemagick command format
$command = "/usr/local/bin/convert $scale $newThum";

//execute command
`$command`;
}
$_POST[name]=$_FILES['name']['name'];
$remove=array('upload');
insert("$db.images");

}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>uploadimage</title>
<link href="../main.css" rel="stylesheet" media="screen">
</head>

<body leftmargin="20" marginheight="10" marginwidth="20" topmargin="10">
<form action="<?php print $PHP_SELF;?>" method="post" name="form" enctype="multipart/form-data">
<br>
Upload Image to <?php print "$photo[images]"; ?>'s gallery:<hr size=1><br>
<input type="file" name="name" value="" size="19"><br>
<br>
<input type="submit" name="upload" value="Upload Image">
<input type="hidden" name="photoID" value="<?php print $photoID;?>" >


</form>
</body>

</html>
 
begeiste said:
Fatal error: Call to undefined function: select() in /home/symphon1/public_html/admin/images_upload.php on line 26

Or Fatal error: Call to undefined function: author() in /home/symphon1/public_html/admin/images_upload.php on line 25

The error messages answered the question for you. You're calling functions called select() and author() that haven't been defined anywhere.
 
Maybe I didn't address clearly, actually I know what's wrong with the lines, but don't know how to correct them. Do you know how to correct them? Thanks
 
Hi Fellows:

So far I have figured by myself with this codes, but there is a link of Upload Image to gallery! which I still don't know how to open the images.php by click on this. http://www.symphonyimage.com/admin/dis.php


<?php require_once('../Connections/apress.php'); ?>
<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO photo (photo_ID, name) VALUES (%s, %s)",
GetSQLValueString($HTTP_POST_VARS['photo_ID'], "int"),
GetSQLValueString($HTTP_POST_VARS['name'], "date"));

mysql_select_db($database_apress, $apress);
$Result1 = mysql_query($insertSQL, $apress) or die(mysql_error());
}

if ((isset($HTTP_POST_VARS['photo_ID'])) && ($HTTP_POST_VARS['photo_ID'] != "") && (isset($HTTP_POST_VARS['delete_me']))) {
$deleteSQL = sprintf("DELETE FROM photos WHERE photo_ID=%s",
GetSQLValueString($HTTP_POST_VARS['photo_ID'], "int"));

mysql_select_db($database_apress, $apress);
$Result1 = mysql_query($deleteSQL, $apress) or die(mysql_error());

$deleteGoTo = "/admin/dis.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
$deleteGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $deleteGoTo));
}

mysql_select_db($database_apress, $apress);
$query_rst_results = "SELECT * FROM photos";
$rst_results = mysql_query($query_rst_results, $apress) or die(mysql_error());
$row_rst_results = mysql_fetch_assoc($rst_results);
$totalRows_rst_results = mysql_num_rows($rst_results);

$queryString_rst_results = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
$params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rst_results") == false &&
stristr($param, "totalRows_rst_results") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rst_results = "&" . implode("&", $newParams);
}
}
$queryString_rst_results = sprintf("&totalRows_rst_results=%d%s", $totalRows_rst_results, $queryString_rst_results);
?>

<?php echo "<?xml version=\"1.0\" encoding=\"big5\"?".">"; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>dispage</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<style type="text/css">

</style>
</head>

<body>



<div align="center">
<h3>Thanks for your visiting our photo Gallery </h3></div>



<div align="center">
<table width="650" border="0" cellspacing="0" cellpadding="0" class="t">
<tr>
<td width="149" class="title">PhotoID</td>
<td width="149" class="title">Name</td>
<td width="352" class="title">Scenery</td>
</tr>
</table>
<?php do { ?>
<table width="650" border="0" cellspacing="2" cellpadding="2" class="tborder">
<tr>
<td width="144"><?php echo $row_rst_results['photo_ID']; ?></td>
<td width="142"><?php echo $row_rst_results['name']; ?>
</td>
<td width="108"><a href="<?php echo $row_rst_results['images'];?>" target="_blank"><img src="<?php echo $row_rst_results['images']; ?>" alt="dynamicimage" name="imageplace" id="imageplace" border="0" /></a></td>
<td width="25"><a href="/admin/edit_image?image=<?php echo $row_rst_results['images']; ?>">edit</a></td>

<td width="118" ><a href="#" onclick="calendar=window.open('images.php?photo_ID=<?php echo $values['photo_ID'];?>','feedback','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=150'); return false;">Upload Image to gallery!</a></td>
<td width="73"> <form name="delete_form" id="delete_form" method="post" action="">
<input name="delete_me" type="checkbox" id="delete_me" value="checkbox" />
<input type="submit" name="Submit" value="Delete" />
<input name="photo_ID" type="hidden" id="photo_ID2" value="<?php echo $row_rst_results['photo_ID']; ?>" />
</form></td>
</tr>
</table>
<?php } while ($row_rst_results = mysql_fetch_assoc($rst_results)); ?>
<br />
<p class="title"> </p>
<p class="title">Total Records:
<?php echo $totalRows_rst_results ?>
</p>
</div>
</body>
</html>
<?php
mysql_free_result($rst_results);
?>
 
Back
Top